Whamcloud - gitweb
LU-8397 mgc: add comma-separated nids for primary MGS 08/21308/4
authorVladimir Saveliev <vladimir.saveliev@seagate.com>
Wed, 1 Feb 2017 15:29:56 +0000 (23:29 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 26 Apr 2017 03:38:35 +0000 (03:38 +0000)
In lustre_start_mgc(), if the primary MGS has multiple nids separated by
commas, then only the first nid is added, and the other nids are not added.
This patch fixes the above issue by adding the nids until the end of the
primary MGS nid list or hitting the first failover MGS nid.

Test-Parameters: combinedmdsmgs=false envdefinitions=ONLY=77 testlist=conf-sanity
Test-Parameters: envdefinitions=ONLY=77 testlist=conf-sanity

Signed-off-by: Vladimir Saveliev <vladimir.saveliev@seagate.com>
Signed-off-by: Jian Yu <jian.yu@intel.com>
Seagate-bug-id: MRP-2930
Change-Id: I3e84786bfc08767c75a133affb4f86325d789d6e
Reviewed-on: https://review.whamcloud.com/21308
Tested-by: Jenkins
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/obdclass/obd_mount.c
lustre/tests/conf-sanity.sh

index a0c6bbd..db8a225 100644 (file)
@@ -360,19 +360,18 @@ int lustre_start_mgc(struct super_block *sb)
                                GOTO(out_free, rc = -EINVAL);
                        }
                        /*
-                        * LU-3829.
-                        * Here we only take the first mgsnid as its primary
-                        * serving mgs node, the rest mgsnid will be taken as
-                        * failover mgs node, otherwise they would be takens
-                        * as multiple nids of a single mgs node.
+                        * Add primary MGS nid(s).
+                        * Multiple nids on one MGS node are separated
+                        * by commas.
                         */
                        while (class_parse_nid(ptr, &nid, &ptr) == 0) {
                                rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID,
                                             niduuid, NULL, NULL, NULL);
-                               if (rc == 0) {
-                                       i = 1;
+                               if (rc == 0)
+                                       ++i;
+                               /* Stop at the first failover nid */
+                               if (*ptr == ':')
                                        break;
-                               }
                        }
                }
         } else { /* client */
index 3683fa1..975d3e6 100755 (executable)
@@ -5360,15 +5360,17 @@ test_77() { # LU-3445
        local mgsnid
        local failnid="$(h2$NETTYPE 1.2.3.4),$(h2$NETTYPE 4.3.2.1)"
 
+       combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
+
        add fs2mds $(mkfs_opts mds1 $fs2mdsdev) --mgs --fsname=$fsname \
                --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
        start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT ||
                error "start fs2mds failed"
 
        mgsnid=$(do_facet fs2mds $LCTL list_nids | xargs | tr ' ' ,)
-       mgsnid="$mgsnid,$mgsnid:$mgsnid"
+       mgsnid="0.0.0.0@tcp,$mgsnid,$mgsnid:$mgsnid"
 
-       add fs2ost $(mkfs_opts ost1 $fs2ostdev) --mgsnode=$mgsnid \
+       add fs2ost --mgsnode=$mgsnid $(mkfs_opts ost1 $fs2ostdev) \
                --failnode=$failnid --fsname=$fsname \
                --reformat $fs2ostdev $fs2ostvdev ||
                        error "add fs2ost failed"