Whamcloud - gitweb
b=19890 fix mgs conf for mds and client for nosvc option
authorMikhail Pershin <mikhail.pershin@oracle.com>
Thu, 18 Nov 2010 07:14:58 +0000 (10:14 +0300)
committerVitaly Fertman <vitaly.fertman@sun.com>
Thu, 18 Nov 2010 22:34:30 +0000 (01:34 +0300)
i=zam
i=ericm

lustre/mgs/mgs_llog.c
lustre/tests/conf-sanity.sh

index 3ab77d8..45c098e 100644 (file)
@@ -1073,6 +1073,12 @@ struct temp_comp
 
 static int mgs_write_log_mdc_to_mdt(struct obd_device *, struct fs_db *,
                                     struct mgs_target_info *, char *);
+static int mgs_write_log_osc_to_lov(struct obd_device *obd, struct fs_db *fsdb,
+                                    struct mgs_target_info *mti,
+                                    char *logname, char *suffix, char *lovname,
+                                    enum lustre_sec_part sec_part, int flags);
+static void name_create_mdt_and_lov(char **logname, char **lovname,
+                                    struct fs_db *fsdb, int i);
 
 static int mgs_steal_llog_handler(struct llog_handle *llh,
                                   struct llog_rec_hdr *rec,
@@ -1194,6 +1200,21 @@ static int mgs_steal_llog_handler(struct llog_handle *llh,
                 memset(tmti, 0, sizeof(*tmti));
                 RETURN(rc);
         }
+
+        if (lcfg->lcfg_command == LCFG_LOV_ADD_OBD) {
+                char mdt_index[9];
+                char *logname, *lovname;
+
+                name_create_mdt_and_lov(&logname, &lovname, fsdb, mti->mti_stripe_index);
+                sprintf(mdt_index, "-MDT%04x", mti->mti_stripe_index);
+
+                mgs_write_log_osc_to_lov(obd, fsdb, tmti, logname,
+                                         mdt_index, lovname,
+                                         LUSTRE_SP_MDT, 0);
+                name_destroy(&logname);
+                name_destroy(&lovname);
+                RETURN(rc);
+        }
         RETURN(rc);
 }
 
@@ -1437,7 +1458,7 @@ static int mgs_write_log_mdc_to_mdt(struct obd_device *obd, struct fs_db *fsdb,
         int i, rc;
 
         ENTRY;
-        if (mgs_log_is_empty(obd, mti->mti_svname)) {
+        if (mgs_log_is_empty(obd, logname)) {
                 CERROR("log is empty! Logical error\n");
                 RETURN (-EINVAL);
         }
@@ -1686,9 +1707,8 @@ static int mgs_write_log_osc_to_lov(struct obd_device *obd, struct fs_db *fsdb,
                mti->mti_svname, logname);
 
         if (mgs_log_is_empty(obd, logname)) {
-                /* The first item in the log must be the lov, so we have
-                   somewhere to add our osc. */
-                rc = mgs_write_log_lov(obd, fsdb, mti, logname, lovname);
+                CERROR("log is empty! Logical error\n");
+                RETURN (-EINVAL);
         }
 
         name_create(&nodeuuid, libcfs_nid2str(mti->mti_nids[0]), "");
@@ -1818,6 +1838,13 @@ static int mgs_write_log_ost(struct obd_device *obd, struct fs_db *fsdb,
 
         /* Append ost info to the client log */
         name_create(&logname, mti->mti_fsname, "-client");
+        if (mgs_log_is_empty(obd, logname)) {
+                /* Start client log */
+                rc = mgs_write_log_lov(obd, fsdb, mti, logname,
+                                       fsdb->fsdb_clilov);
+                rc = mgs_write_log_lmv(obd, fsdb, mti, logname,
+                                       fsdb->fsdb_clilmv);
+        }
         mgs_write_log_osc_to_lov(obd, fsdb, mti, logname, "",
                                  fsdb->fsdb_clilov, LUSTRE_SP_CLI, 0);
         name_destroy(&logname);
index d066c17..6d9c9b0 100644 (file)
@@ -130,6 +130,12 @@ stop_mds() {
        stop $SINGLEMDS -f  || return 97
 }
 
+stop_mgs() {
+       echo "stop mgs service on `facet_active_host mgs`"
+       # These tests all use non-failover stop
+       stop mgs -f  || return 97
+}
+
 start_ost() {
        echo "start ost1 service on `facet_active_host ost1`"
        start ost1 `ostdevname 1` $OST_MOUNT_OPTS $@ || return 95
@@ -700,6 +706,27 @@ test_21c() {
 }
 run_test 21c "start mds between two osts, stop mds last"
 
+test_21d() {
+        if combined_mgs_mds ; then
+                skip "need separate mgs device" && return 0
+        fi
+        stopall
+
+        reformat
+
+        start_mgs
+        start_ost
+        start_ost2
+        start_mds
+        wait_osc_import_state mds ost2 FULL
+
+        stop_ost
+        stop_ost2
+        stop_mds
+        stop_mgs
+}
+run_test 21d "start mgs then ost and then mds"
+
 test_22() {
        start_mds
 
@@ -1682,7 +1709,9 @@ test_40() { # bug 15759
 }
 run_test 40 "race during service thread startup"
 
-test_41() { #bug 14134
+test_41a() { #bug 14134
+        echo $MDS_MOUNT_OPTS | grep "loop" && skip " loop devices does not work with nosvc option" && return
+
         local rc
         local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
 
@@ -1703,8 +1732,33 @@ test_41() { #bug 14134
         unload_modules_conf || return 204
         return $rc
 }
-run_test 41 "mount mds with --nosvc and --nomgs"
+run_test 41a "mount mds with --nosvc and --nomgs"
+
+test_41b() {
+        echo $MDS_MOUNT_OPTS | grep "loop" && skip " loop devices does not work with nosvc option" && return
+
+        stopall
+        reformat
+        local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
+
+        start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
+        start_ost
+        start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs,force
+        mkdir -p $MOUNT
+        mount_client $MOUNT || return 1
+        sleep 5
+
+        echo "blah blah" > $MOUNT/$tfile
+        cat $MOUNT/$tfile || return 200
+
+        umount_client $MOUNT
+        stop_ost || return 201
+        stop_mds -f || return 202
+        stop_mds -f || return 203
+
+}
 
+run_test 41b "mount mds with --nosvc and --nomgs on first mount"
 test_42() { #bug 14693
         setup
         check_mount || return 2