From 672e182049e1a636d8591748764950f99c4b71d9 Mon Sep 17 00:00:00 2001 From: Vladimir Saveliev Date: Wed, 1 Feb 2017 23:29:56 +0800 Subject: [PATCH] LU-8397 mgc: add comma-separated nids for primary MGS 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 Signed-off-by: Jian Yu Seagate-bug-id: MRP-2930 Change-Id: I3e84786bfc08767c75a133affb4f86325d789d6e Reviewed-on: https://review.whamcloud.com/21308 Tested-by: Jenkins Reviewed-by: Bobi Jam Tested-by: Maloo Reviewed-by: Emoly Liu Reviewed-by: Oleg Drokin --- lustre/obdclass/obd_mount.c | 15 +++++++-------- lustre/tests/conf-sanity.sh | 6 ++++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index a0c6bbd..db8a225 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -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 */ diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 3683fa1..975d3e6 100755 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -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" -- 1.8.3.1