RETURN(0);
}
+/*** SERVER NAME ***
+ * <FSNAME><SEPERATOR><TYPE><INDEX>
+ * FSNAME is between 1 and 8 characters (inclusive).
+ * Excluded characters are '/' and ':'
+ * SEPERATOR is either ':' or '-'
+ * TYPE: "OST", "MDT", etc.
+ * INDEX: Hex representation of the index
+ */
+
/** Get the fsname ("lustre") from the server name ("lustre-OST003F").
* @param [in] svname server name including type and index
* @param [out] fsname Buffer to copy filesystem name prefix into.
*/
int server_name2fsname(const char *svname, char *fsname, const char **endptr)
{
- const char *dash = strrchr(svname, '-');
- if (!dash) {
- dash = strrchr(svname, ':');
- if (!dash)
- return -EINVAL;
- }
+ const char *dash;
- /* interpret <fsname>-MDTXXXXX-mdc as mdt, the better way is to pass
- * in the fsname, then determine the server index */
- if (!strcmp(LUSTRE_MDC_NAME, dash + 1)) {
- dash--;
- for (; dash > svname && *dash != '-' && *dash != ':'; dash--)
- ;
- if (dash == svname)
- return -EINVAL;
- }
+ dash = svname + strnlen(svname, 8); /* max fsname length is 8 */
+ for (; dash > svname && *dash != '-' && *dash != ':'; dash--)
+ ;
+ if (dash == svname)
+ return -EINVAL;
if (fsname != NULL) {
strncpy(fsname, svname, dash - svname);
size_t svsize)
{
int rc;
- const const char *dash;
+ const char *dash;
/* We use server_name2fsname() just for parsing */
rc = server_name2fsname(label, NULL, &dash);
if (rc != 0)
return rc;
- if (*dash != '-')
- return -1;
+ if (endptr != NULL)
+ *endptr = dash;
if (strlcpy(svname, dash + 1, svsize) >= svsize)
return -E2BIG;
if (rc != 0)
return rc;
- if (*dash != '-')
- return -EINVAL;
-
dash++;
if (strncmp(dash, "MDT", 3) == 0)
dash += 3;
- if (strcmp(dash, "all") == 0)
+ if (strncmp(dash, "all", 3) == 0) {
+ if (endptr != NULL)
+ *endptr = dash + 3;
return rc | LDD_F_SV_ALL;
+ }
index = simple_strtoul(dash, (char **)endptr, 16);
- *idx = index;
+ if (idx != NULL)
+ *idx = index;
+
+ /* Account for -mdc after index that is possible when specifying mdt */
+ if (endptr != NULL && strncmp(LUSTRE_MDC_NAME, *endptr + 1,
+ sizeof(LUSTRE_MDC_NAME)-1) == 0)
+ *endptr += sizeof(LUSTRE_MDC_NAME);
return rc;
}
static int lmd_make_exclusion(struct lustre_mount_data *lmd, const char *ptr)
{
const char *s1 = ptr, *s2;
- __u32 index, *exclude_list;
- int rc = 0, devmax;
- ENTRY;
-
- /* The shortest an ost name can be is 8 chars: -OST0000.
- We don't actually know the fsname at this time, so in fact
- a user could specify any fsname. */
- devmax = strlen(ptr) / 8 + 1;
-
- /* temp storage until we figure out how many we have */
- OBD_ALLOC(exclude_list, sizeof(index) * devmax);
- if (!exclude_list)
- RETURN(-ENOMEM);
+ __u32 index, *exclude_list;
+ int rc = 0, devmax;
+ ENTRY;
+
+ /* The shortest an ost name can be is 8 chars: -OST0000.
+ We don't actually know the fsname at this time, so in fact
+ a user could specify any fsname. */
+ devmax = strlen(ptr) / 8 + 1;
+
+ /* temp storage until we figure out how many we have */
+ OBD_ALLOC(exclude_list, sizeof(index) * devmax);
+ if (!exclude_list)
+ RETURN(-ENOMEM);
- /* we enter this fn pointing at the '=' */
- while (*s1 && *s1 != ' ' && *s1 != ',') {
- s1++;
- rc = server_name2index(s1, &index, &s2);
- if (rc < 0) {
- CERROR("Can't parse server name '%s'\n", s1);
- break;
- }
- if (rc == LDD_F_SV_TYPE_OST)
- exclude_list[lmd->lmd_exclude_count++] = index;
- else
- CDEBUG(D_MOUNT, "ignoring exclude %.7s\n", s1);
- s1 = s2;
- /* now we are pointing at ':' (next exclude)
- or ',' (end of excludes) */
- if (lmd->lmd_exclude_count >= devmax)
- break;
- }
- if (rc >= 0) /* non-err */
- rc = 0;
-
- if (lmd->lmd_exclude_count) {
- /* permanent, freed in lustre_free_lsi */
- OBD_ALLOC(lmd->lmd_exclude, sizeof(index) *
- lmd->lmd_exclude_count);
- if (lmd->lmd_exclude) {
- memcpy(lmd->lmd_exclude, exclude_list,
- sizeof(index) * lmd->lmd_exclude_count);
- } else {
- rc = -ENOMEM;
- lmd->lmd_exclude_count = 0;
- }
- }
- OBD_FREE(exclude_list, sizeof(index) * devmax);
- RETURN(rc);
+ /* we enter this fn pointing at the '=' */
+ while (*s1 && *s1 != ' ' && *s1 != ',') {
+ s1++;
+ rc = server_name2index(s1, &index, &s2);
+ if (rc < 0) {
+ CERROR("Can't parse server name '%s': rc = %d\n",
+ s1, rc);
+ break;
+ }
+ if (rc == LDD_F_SV_TYPE_OST)
+ exclude_list[lmd->lmd_exclude_count++] = index;
+ else
+ CDEBUG(D_MOUNT, "ignoring exclude %.*s: type = %#x\n",
+ (uint)(s2-s1), s1, rc);
+ s1 = s2;
+ /* now we are pointing at ':' (next exclude)
+ or ',' (end of excludes) */
+ if (lmd->lmd_exclude_count >= devmax)
+ break;
+ }
+ if (rc >= 0) /* non-err */
+ rc = 0;
+
+ if (lmd->lmd_exclude_count) {
+ /* permanent, freed in lustre_free_lsi */
+ OBD_ALLOC(lmd->lmd_exclude, sizeof(index) *
+ lmd->lmd_exclude_count);
+ if (lmd->lmd_exclude) {
+ memcpy(lmd->lmd_exclude, exclude_list,
+ sizeof(index) * lmd->lmd_exclude_count);
+ } else {
+ rc = -ENOMEM;
+ lmd->lmd_exclude_count = 0;
+ }
+ }
+ OBD_FREE(exclude_list, sizeof(index) * devmax);
+ RETURN(rc);
}
static int lmd_parse_mgssec(struct lustre_mount_data *lmd, char *ptr)
exit 0
fi
- if [ -n "$($LCTL list_nids | grep -v '\(tcp\|lo\)[[:digit:]]*$')" ]; then
- skip "LU-2200: Test cannot run over Infiniband"
- exit 0
- fi
-
local IMGTYPE=$(facet_fstype $SINGLEMDS)
tarballs=$($r find $RLUSTRE/tests -maxdepth 1 -name \'disk*-$IMGTYPE.tar.bz2\')
}
fi
else
+ if [ -n "$($LCTL list_nids | grep -v '\(tcp\|lo\)[[:digit:]]*$')" ]; then
+ [[ $(lustre_version_code mgs) -ge $(version_code 2.3.59) ]] ||
+ { skip "LU-2200: Cannot run over Inifiniband w/o lctl replace_nids "
+ "(Need MGS version at least 2.3.59)"; return 0; }
+
+ local osthost=$(facet_active_host ost1)
+ local ostnid=$(do_node $osthost $LCTL list_nids | head -1)
+
+ $r mount -t lustre -o loop,nosvc $tmp/mdt $tmp/mnt/mdt
+ $r lctl replace_nids $fsname-OST0000 $ostnid
+ $r lctl replace_nids $fsname-MDT0000 $nid
+ $r umount $tmp/mnt/mdt
+ fi
+
mopts=loop,exclude=$fsname-OST0000
fi
# on an architecture with different number of bits per
# "long".
#
- if [ $(t32_bits_per_long $(uname -m)) != \
- $(t32_bits_per_long $img_arch) ]; then
+ if [ $(t32_bits_per_long $(uname -m)) != \
+ $(t32_bits_per_long $img_arch) ]; then
echo "Different number of bits per \"long\" from the disk image"
for list in list.orig list; do
sed -i -e 's/^[0-9]\+[ \t]\+//' $tmp/$list
error_noexit "tunefs.lustre before remounting the MDT"
return 1
}
- $r mount -t lustre -o loop,exclude=$fsname-OST0000 $tmp/mdt \
+ $r mount -t lustre -o loop,exclude=$fsname-OST0000 $tmp/mdt \
$tmp/mnt/mdt || {
error_noexit "Remounting the MDT"
return 1
t32_check
for tarball in $tarballs; do
- t32_test $tarball || rc=$?
+ t32_test $tarball || let "rc += $?"
done
return $rc
}
t32_check
for tarball in $tarballs; do
- t32_test $tarball writeconf || rc=$?
+ t32_test $tarball writeconf || let "rc += $?"
done
return $rc
}