ENTRY;
CDEBUG(D_MGS, "writing new mdt %s\n", mti->mti_svname);
-
- /* COMPAT_146 */
- if (mti->mti_flags & LDD_F_UPGRADE14) {
- /* We're starting with an old uuid. Assume old name for lov
- as well since the lov entry already exists in the log. */
- CDEBUG(D_MGS, "old mds uuid %s\n", mti->mti_uuid);
- if (strncmp(mti->mti_uuid, fsdb->fsdb_mdtlov + 4,
- strlen(fsdb->fsdb_mdtlov) - 4) != 0) {
- CERROR("old mds uuid %s doesn't match log %s (%s)\n",
- mti->mti_uuid, fsdb->fsdb_mdtlov,
- fsdb->fsdb_mdtlov + 4);
- RETURN(-EINVAL);
- }
- }
- /* end COMPAT_146 */
if (mti->mti_uuid[0] == '\0') {
/* Make up our own uuid */
GOTO(out, rc);
rc = record_marker(obd, llh, fsdb, CM_START, mti->mti_svname,"add mdc");
/* COMPAT_146 */
- if (mti->mti_flags & LDD_F_UPGRADE14) {
+ if (fsdb->fsdb_flags & FSDB_OLDLOG14) {
/* Old client log already has MDC entry, but needs mount opt
for new client name (lustre-client) */
/* FIXME Old MDT log already has an old mount opt
class_del_profiles()) */
rc = record_mount_opt(obd, llh, cliname, fsdb->fsdb_clilov,
fsdb->fsdb_mdc);
+ /* Only add failnids with --writeconf
+ rc = mgs_write_log_failnids(obd, mti, llh, fsdb->fsdb_mdc);
+ */
/* end COMPAT_146 */
} else {
for (i = 0; i < mti->mti_nid_count; i++) {
/* We also have to update the other logs where this osc is part of
the lov */
- if (mti->mti_flags & LDD_F_UPGRADE14) {
+ if (fsdb->fsdb_flags & FSDB_OLDLOG14) {
/* If we're upgrading, the old mdt log already has our
entry. Let's do a fake one for fun. */
+ /* Note that we can't add any new failnids, since we don't
+ know the old osc names. */
flags = CM_SKIP | CM_UPGRADE146;
} else if ((mti->mti_flags & LDD_F_UPDATE) != LDD_F_UPDATE) {
/* If the update flag isn't set, don't really update
int rc;
ENTRY;
+ /* FIXME how do we delete a failnid? Currently --writeconf is the
+ only way. Maybe make --erase-params pass a flag to really
+ erase all params from logs - except it can't erase the failnids
+ given when a target first registers, since they aren't processed
+ as params... */
+
/* Verify that we know about this target */
if (mgs_log_is_empty(obd, mti->mti_svname)) {
LCONSOLE_ERROR("The target %s has not registered yet. "
/* Create mdc/osc client name (e.g. lustre-OST0001-osc) */
if (mti->mti_flags & LDD_F_SV_TYPE_MDT) {
- name_create(&cliname, mti->mti_svname, "-mdc");
+ /* COMPAT_146 */
+ if (fsdb->fsdb_mdc)
+ name_create(&cliname, fsdb->fsdb_mdc, "");
+ else
+ name_create(&cliname, mti->mti_svname, "-mdc");
} else if (mti->mti_flags & LDD_F_SV_TYPE_OST) {
+ /* COMPAT_146 */
+ if (fsdb->fsdb_flags & FSDB_OLDLOG14) {
+ LCONSOLE_ERROR("Failover NIDs cannot be added to old "
+ "clients for %s. Consider updating the "
+ "configuration with --writeconf.\n",
+ mti->mti_svname);
+ RETURN(-EINVAL);
+ }
name_create(&cliname, mti->mti_svname, "-osc");
} else {
RETURN(-EINVAL);
/* But don't try to match the value. */
if ((tmp = strchr(comment, '=')))
*tmp = 0;
+ /* FIXME we should skip settings that are the same as old values */
rc = mgs_modify(obd, fsdb, mti, logname, tgtname, comment, CM_SKIP);
LCONSOLE_INFO("%sing parameter %s.%s in log %s\n", rc ?
"Sett" : "Modify", tgtname, comment, logname);
if (!mti->mti_params)
RETURN(0);
- /* FIXME we should cancel out old settings of the same parameters,
- and skip settings that are the same as old values */
-
/* For various parameter settings, we have to figure out which logs
care about them (e.g. both mdt and client for lov settings) */
while (ptr) {
/* Add the client type to match the obdname
in class_config_llog_handler */
} else if (mti->mti_flags & LDD_F_SV_TYPE_MDT) {
- name_create(&cname, mti->mti_svname, "-mdc");
+ /* COMPAT_146 */
+ if (fsdb->fsdb_mdc)
+ name_create(&cname, fsdb->fsdb_mdc, "");
+ else
+ name_create(&cname, mti->mti_svname,
+ "-mdc");
} else if (mti->mti_flags & LDD_F_SV_TYPE_OST) {
+ /* COMPAT_146 */
+ if (fsdb->fsdb_flags & FSDB_OLDLOG14) {
+ LCONSOLE_ERROR("Old clients for %s can't "
+ "be modified. Consider updating the "
+ "configuration with --writeconf\n",
+ mti->mti_svname);
+ /* We don't know the names of all the
+ old oscs*/
+ rc = -EINVAL;
+ goto end_while;
+ }
name_create(&cname, mti->mti_svname, "-osc");
} else {
rc = -EINVAL;
}
/* COMPAT_146 */
-/* upgrade pre-mountconf logs to mountconf at first connect */
+/* verify that we can handle the old config logs */
int mgs_upgrade_sv_14(struct obd_device *obd, struct mgs_target_info *mti)
{
struct fs_db *fsdb;
rc = mgs_find_or_make_fsdb(obd, mti->mti_fsname, &fsdb);
if (rc)
RETURN(rc);
-
+
if (fsdb->fsdb_flags & FSDB_LOG_EMPTY) {
LCONSOLE_ERROR("The old client log %s-client is missing. Was "
"tunefs.lustre successful?\n",
CDEBUG(D_MGS, "found old, unupdated client log\n");
}
- if ((mti->mti_flags & LDD_F_SV_TYPE_MDT) &&
- mgs_log_is_empty(obd, mti->mti_svname)) {
- LCONSOLE_ERROR("The old MDT log %s is missing. Was "
- "tunefs.lustre successful?\n",
- mti->mti_svname);
- RETURN(-ENOENT);
+ if (mti->mti_flags & LDD_F_SV_TYPE_MDT) {
+ if (mgs_log_is_empty(obd, mti->mti_svname)) {
+ LCONSOLE_ERROR("The old MDT log %s is missing. Was "
+ "tunefs.lustre successful?\n",
+ mti->mti_svname);
+ RETURN(-ENOENT);
+ }
+
+ /* We're starting with an old uuid. Assume old name for lov
+ as well since the lov entry already exists in the log. */
+ CDEBUG(D_MGS, "old mds uuid %s\n", mti->mti_uuid);
+ if (strncmp(mti->mti_uuid, fsdb->fsdb_mdtlov + 4,
+ strlen(fsdb->fsdb_mdtlov) - 4) != 0) {
+ CERROR("old mds uuid %s doesn't match log %s (%s)\n",
+ mti->mti_uuid, fsdb->fsdb_mdtlov,
+ fsdb->fsdb_mdtlov + 4);
+ RETURN(-EINVAL);
+ }
+ }
+
+ if (!(fsdb->fsdb_flags & FSDB_OLDLOG14)) {
+ LCONSOLE_ERROR("%s-client is supposedly an old log, but no old "
+ "LOV or MDT was found. Consider updating the "
+ "configuration with --writeconf.\n",
+ mti->mti_fsname);
}
- rc = mgs_write_log_target(obd, mti);
RETURN(rc);
}
/* end COMPAT_146 */
} else {
strncpy(fsname, devname, ptr - devname);
}
- fsname[MTI_NAME_MAXLEN] = 0;
+ fsname[MTI_NAME_MAXLEN - 1] = 0;
CDEBUG(D_MGS, "setparam on fs %s device %s\n", fsname, devname);
rc = mgs_find_or_make_fsdb(obd, fsname, &fsdb);
if (rc)
RETURN(rc);
if (fsdb->fsdb_flags & FSDB_LOG_EMPTY) {
- CERROR("No filesystem targets for %s\n", fsname);
+ CERROR("No filesystem targets for %s. cfg_device from lctl "
+ "is '%s'\n", fsname, devname);
+ mgs_free_fsdb(obd, fsdb);
RETURN(-EINVAL);
}
}
run_test 31 "Connect to non-existent node (shouldn't crash)"
+test_32a() {
+ [ -z "$TUNEFS" ] && echo "No tunefs" && return
+ [ ! -r disk1_4.zip ] && echo "Cant find disk1_4.zip, skipping" && return
+ unzip -o -j -d $TMP/$tdir disk1_4.zip || { echo "Cant unzip disk1_4, skipping" && return ; }
+ load_modules
+ sysctl lnet.debug=$PTLDEBUG
+
+ $TUNEFS $TMP/$tdir/mds || error "tunefs failed"
+ # nids are wrong, so client wont work, but server should start
+ start mds $TMP/$tdir/mds "-o loop" || return 3
+ local UUID=$(cat $LPROC/mds/lustre-MDT0000/uuid)
+ echo MDS uuid $UUID
+ [ "$UUID" == "mdsA_UUID" ] || error "UUID is wrong: $UUID"
+
+ $TUNEFS --mgsnode=`hostname` $TMP/$tdir/ost1 || error "tunefs failed"
+ start ost1 $TMP/$tdir/ost1 "-o loop" || return 5
+ UUID=$(cat $LPROC/obdfilter/lustre-OST0000/uuid)
+ echo OST uuid $UUID
+ [ "$UUID" == "ost1_UUID" ] || error "UUID is wrong: $UUID"
+
+ local NID=$($LCTL list_nids | head -1)
+
+ echo "OSC changes should return err:"
+ $LCTL conf_param lustre-OST0000.osc.max_dirty_mb=15 && return 7
+ $LCTL conf_param lustre-OST0000.failover.node=$NID && return 8
+ echo "ok."
+ echo "MDC changes should succeed:"
+ $LCTL conf_param lustre-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
+ $LCTL conf_param lustre-MDT0000.failover.node=$NID || return 10
+ echo "ok."
+
+ #With a new good MDT failover nid, we should be able to mount a client
+ #(but it cant talk to OST)
+ mount_client $MOUNT
+ set_and_check "cat $LPROC/mdc/*/max_rpcs_in_flight" "lustre-MDT0000.mdc.max_rpcs_in_flight" || return 11
+
+ zconf_umount `hostname` $MOUNT -f
+ cleanup_nocli
+
+ [ -d $TMP/$tdir ] && rm -rf $TMP/$tdir
+}
+run_test 32a "Upgrade from 1.4 (not live)"
+
+test_32b() {
+ [ -z "$TUNEFS" ] && echo "No tunefs" && return
+ [ ! -r disk1_4.zip ] && echo "Cant find disk1_4.zip, skipping" && return
+ unzip -o -j -d $TMP/$tdir disk1_4.zip || { echo "Cant unzip disk1_4, skipping" && return ; }
+ load_modules
+ sysctl lnet.debug=$PTLDEBUG
+
+ # writeconf will cause servers to register with their current nids
+ $TUNEFS --writeconf $TMP/$tdir/mds || error "tunefs failed"
+ start mds $TMP/$tdir/mds "-o loop" || return 3
+ local UUID=$(cat $LPROC/mds/lustre-MDT0000/uuid)
+ echo MDS uuid $UUID
+ [ "$UUID" == "mdsA_UUID" ] || error "UUID is wrong: $UUID"
+
+ $TUNEFS --mgsnode=`hostname` $TMP/$tdir/ost1 || error "tunefs failed"
+ start ost1 $TMP/$tdir/ost1 "-o loop" || return 5
+ UUID=$(cat $LPROC/obdfilter/lustre-OST0000/uuid)
+ echo OST uuid $UUID
+ [ "$UUID" == "ost1_UUID" ] || error "UUID is wrong: $UUID"
+
+ echo "OSC changes should succeed:"
+ $LCTL conf_param lustre-OST0000.osc.max_dirty_mb=15 || return 7
+ $LCTL conf_param lustre-OST0000.failover.node=$NID || return 8
+ echo "ok."
+ echo "MDC changes should succeed:"
+ $LCTL conf_param lustre-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
+ echo "ok."
+
+ # MDT and OST should have registered with new nids, so we should have
+ # a fully-functioning client
+ echo "Check client and old fs contents"
+ mount_client $MOUNT
+ set_and_check "cat $LPROC/mdc/*/max_rpcs_in_flight" "lustre-MDT0000.mdc.max_rpcs_in_flight" || return 11
+ [ "$(cksum $MOUNT/passwd | cut -d' ' -f 1,2)" == "2479747619 779" ] || return 12
+ echo "ok."
+
+ cleanup
+ [ -d $TMP/$tdir ] && rm -rf $TMP/$tdir
+}
+run_test 32b "Upgrade from 1.4 with writeconf"
+
umount_client $MOUNT
cleanup_nocli