Whamcloud - gitweb
b=20689
authornathan <nathan>
Wed, 23 Sep 2009 17:53:52 +0000 (17:53 +0000)
committernathan <nathan>
Wed, 23 Sep 2009 17:53:52 +0000 (17:53 +0000)
i=manoj
i=yujian
use the old 1.8 lov name for 1.8 config logs for 2.0 interop

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

index 7c9674f..739a385 100644 (file)
@@ -1466,7 +1466,7 @@ static int mgs_write_log_mdt0(struct obd_device *obd, struct fs_db *fsdb,
         char *log = mti->mti_svname;
         struct llog_handle *llh = NULL;
         char *uuid, *lovname;
-        char mdt_index[5];
+        char mdt_index[6];
         char *ptr = mti->mti_params;
         int rc = 0, failout = 0;
         ENTRY;
@@ -1483,7 +1483,7 @@ static int mgs_write_log_mdt0(struct obd_device *obd, struct fs_db *fsdb,
                 rc = mgs_write_log_lov(obd, fsdb, mti, log, lovname);
 
         sprintf(uuid, "%s_UUID", log);
-        sprintf(mdt_index,"%d",mti->mti_stripe_index);
+        sprintf(mdt_index, "%d", mti->mti_stripe_index);
 
         /* add MDT itself */
         rc = record_start_log(obd, &llh, log);
@@ -1504,6 +1504,25 @@ out:
         RETURN(rc);
 }
 
+static inline void name_create_mdt(char **logname, char *fsname, int i)
+{
+        char mdt_index[9];
+
+        sprintf(mdt_index, "-MDT%04x", i);
+        name_create(logname, fsname, mdt_index);
+}
+
+static void name_create_mdt_and_lov(char **logname, char **lovname,
+                                    struct fs_db *fsdb, int i)
+{
+        name_create_mdt(logname, fsdb->fsdb_name, i);
+        /* COMPAT_180 */
+        if (i == 0 && fsdb->fsdb_fl_oscname_18)
+                name_create(lovname, fsdb->fsdb_name, "-mdtlov");
+        else
+                name_create(lovname, *logname, "-mdtlov");
+}
+
 /* envelope method for all layers log */
 static int mgs_write_log_mdt(struct obd_device *obd, struct fs_db *fsdb,
                               struct mgs_target_info *mti)
@@ -1511,7 +1530,6 @@ static int mgs_write_log_mdt(struct obd_device *obd, struct fs_db *fsdb,
         struct llog_handle *llh = NULL;
         char *cliname;
         struct temp_comp comp = { 0 };
-        char mdt_index[9];
         int rc, i = 0;
         ENTRY;
 
@@ -1617,9 +1635,7 @@ out:
                 char *mdtname;
                 if (i !=  mti->mti_stripe_index &&
                     test_bit(i,  fsdb->fsdb_mdt_index_map)) {
-                        sprintf(mdt_index,"-MDT%04x",i);
-
-                        name_create(&mdtname, mti->mti_fsname, mdt_index);
+                        name_create_mdt(&mdtname, mti->mti_fsname, i);
                         rc = mgs_write_log_mdc_to_mdt(obd, fsdb, mti, mdtname);
                         name_destroy(&mdtname);
                 }
@@ -1699,7 +1715,6 @@ static int mgs_write_log_ost(struct obd_device *obd, struct fs_db *fsdb,
 {
         struct llog_handle *llh = NULL;
         char *logname, *lovname;
-        char mdt_index[9];
         char *ptr = mti->mti_params;
         int rc, flags = 0, failout = 0, i;
         ENTRY;
@@ -1760,12 +1775,13 @@ static int mgs_write_log_ost(struct obd_device *obd, struct fs_db *fsdb,
                               mti->mti_svname);
         }
 
-        // for_all_existing_mdt
+        /* Add ost to all MDT lov defs */
         for (i = 0; i < INDEX_MAP_SIZE * 8; i++){
-                 if (test_bit(i,  fsdb->fsdb_mdt_index_map)) {
-                        sprintf(mdt_index,"-MDT%04x",i);
-                        name_create(&logname, mti->mti_fsname, mdt_index);
-                        name_create(&lovname, logname, "-mdtlov");
+                if (test_bit(i, fsdb->fsdb_mdt_index_map)) {
+                        char mdt_index[9];
+
+                        name_create_mdt_and_lov(&logname, &lovname, fsdb, i);
+                        sprintf(mdt_index, "-MDT%04x", i);
                         mgs_write_log_osc_to_lov(obd, fsdb, mti, logname,
                                                  mdt_index, lovname,
                                                  LUSTRE_SP_MDT, flags);
@@ -2319,7 +2335,6 @@ static int mgs_write_log_param(struct obd_device *obd, struct fs_db *fsdb,
 
         if (class_match_param(ptr, PARAM_OSC""PARAM_ACTIVE, &tmp) == 0) {
                 /* active=0 means off, anything else means on */
-                char mdt_index[16];
                 int flag = (*tmp == '0') ? CM_EXCLUDE : 0;
                 int i;
 
@@ -2343,8 +2358,7 @@ static int mgs_write_log_param(struct obd_device *obd, struct fs_db *fsdb,
                 for (i = 0; i < INDEX_MAP_SIZE * 8; i++) {
                         if (!test_bit(i, fsdb->fsdb_mdt_index_map))
                                 continue;
-                        sprintf(mdt_index,"-MDT%04x", i);
-                        name_create(&logname, mti->mti_fsname, mdt_index);
+                        name_create_mdt(&logname, mti->mti_fsname, i);
                         rc = mgs_modify(obd, fsdb, mti, logname,
                                         mti->mti_svname, "add osc", flag);
                         name_destroy(&logname);
@@ -2374,7 +2388,6 @@ static int mgs_write_log_param(struct obd_device *obd, struct fs_db *fsdb,
 
         /* All lov. in proc */
         if (class_match_param(ptr, PARAM_LOV, NULL) == 0) {
-                char mdt_index[16];
                 char *mdtlovname;
 
                 CDEBUG(D_MGS, "lov param %s\n", ptr);
@@ -2390,9 +2403,8 @@ static int mgs_write_log_param(struct obd_device *obd, struct fs_db *fsdb,
                 if (mgs_log_is_empty(obd, mti->mti_svname))
                         GOTO(end, rc = -ENODEV);
 
-                sprintf(mdt_index,"-MDT%04x", mti->mti_stripe_index);
-                name_create(&logname, mti->mti_fsname, mdt_index);
-                name_create(&mdtlovname, logname, "-mdtlov");
+                name_create_mdt_and_lov(&logname, &mdtlovname, fsdb,
+                                        mti->mti_stripe_index);
                 rc = mgs_wlp_lcfg(obd, fsdb, mti, mti->mti_svname,
                                   &bufs, mdtlovname, ptr);
                 name_destroy(&logname);
@@ -2468,9 +2480,7 @@ static int mgs_write_log_param(struct obd_device *obd, struct fs_db *fsdb,
                                 name_create(&cname, mti->mti_svname, mdt_index);
 
                                 name_destroy(&logname);
-                                sprintf(mdt_index, "-MDT%04x", i);
-                                name_create(&logname, mti->mti_fsname,
-                                            mdt_index);
+                                name_create_mdt(&logname, mti->mti_fsname, i);
                                 if (!mgs_log_is_empty(obd, logname))
                                         rc = mgs_wlp_lcfg(obd, fsdb,
                                                           mti, logname,
@@ -2487,7 +2497,6 @@ static int mgs_write_log_param(struct obd_device *obd, struct fs_db *fsdb,
 
         /* All mdt. params in proc */
         if (class_match_param(ptr, PARAM_MDT, NULL) == 0) {
-                char mdt_index[16];
                 int i;
                 __u32 idx;
 
@@ -2507,9 +2516,7 @@ static int mgs_write_log_param(struct obd_device *obd, struct fs_db *fsdb,
                                 if (!test_bit(i,
                                               fsdb->fsdb_mdt_index_map))
                                         continue;
-                                sprintf(mdt_index,"-MDT%04x", i);
-                                name_create(&logname, mti->mti_fsname,
-                                            mdt_index);
+                                name_create_mdt(&logname, mti->mti_fsname, i);
                                 rc = mgs_wlp_lcfg(obd, fsdb, mti,
                                                   logname, &bufs,
                                                   logname, ptr);
@@ -2957,7 +2964,6 @@ int mgs_pool_cmd(struct obd_device *obd, enum lcfg_command_type cmd,
                  char *fsname, char *poolname, char *ostname)
 {
         struct fs_db *fsdb;
-        char mdt_index[16];
         char *lovname;
         char *logname;
         char *label = NULL, *canceled_label = NULL;
@@ -3038,12 +3044,10 @@ int mgs_pool_cmd(struct obd_device *obd, enum lcfg_command_type cmd,
                         GOTO(out, rc = -ENOMEM);
         }
 
-        /* loop on all potential MDT */
+        /* write pool def to all MDT logs */
         for (i = 0; i < INDEX_MAP_SIZE * 8; i++) {
                  if (test_bit(i,  fsdb->fsdb_mdt_index_map)) {
-                        sprintf(mdt_index, "-MDT%04x", i);
-                        name_create(&logname, fsname, mdt_index);
-                        name_create(&lovname, logname, "-mdtlov");
+                        name_create_mdt_and_lov(&logname, &lovname, fsdb, i);
 
                         if (canceled_label != NULL) {
                                 strcpy(mti->mti_svname, "lov pool");
index 3c233eb..2287f88 100644 (file)
@@ -972,7 +972,6 @@ cleanup_32() {
 }
 
 test_32a() {
-       # this test is totally useless on a client-only system
        client_only && skip "client only testing" && return 0
        [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; }
        [ -z "$TUNEFS" ] && skip_env "No tunefs" && return 0
@@ -1005,16 +1004,21 @@ test_32a() {
 
        local NID=$($LCTL list_nids | head -1)
 
-       echo "OSC changes should return err:"
+       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
        $LCTL conf_param lustre-MDT0000.failover.node=$NID || return 10
        echo "ok."
 
+       echo "LOV changes should succeed:"
+       $LCTL pool_new lustre.interop || return 11
+       $LCTL conf_param lustre-MDT0000.lov.stripesize=4M || return 12
+       echo "ok."
+
        cleanup_32
 
        # mount a second time to make sure we didnt leave upgrade flag on
@@ -1030,7 +1034,6 @@ test_32a() {
 run_test 32a "Upgrade from 1.8 (not live)"
 
 test_32b() {
-       # this test is totally useless on a client-only system
        client_only && skip "client only testing" && return 0
        [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; }
        [ -z "$TUNEFS" ] && skip_env "No tunefs" && return
@@ -1064,13 +1067,18 @@ test_32b() {
        local NID=$($LCTL list_nids | head -1)
 
        echo "OSC changes should succeed:"
-
        $LCTL conf_param ${NEWNAME}-OST0000.osc.max_dirty_mb=15 || return 7
        $LCTL conf_param ${NEWNAME}-OST0000.failover.node=$NID || return 8
-
        echo "ok."
+
        echo "MDC changes should succeed:"
        $LCTL conf_param ${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
+       $LCTL conf_param lustre-MDT0000.failover.node=$NID || return 10
+       echo "ok."
+
+       echo "LOV changes should succeed:"
+       $LCTL pool_new lustre.interop || return 11
+       $LCTL conf_param lustre-MDT0000.lov.stripesize=4M || return 12
        echo "ok."
 
        # MDT and OST should have registered with new nids, so we should have