Whamcloud - gitweb
LU-18799 utils: mount with maximum NIDs 75/58375/7
authorMikhail Pershin <mpershin@whamcloud.com>
Wed, 5 Mar 2025 11:26:08 +0000 (14:26 +0300)
committerOleg Drokin <green@whamcloud.com>
Wed, 26 Mar 2025 04:03:10 +0000 (04:03 +0000)
Patch allows mount with maxumum NIDs in parameters.
- reserve space for mandatory mount options: 'device', etc.
- remove duplicate mgsnode list as parameter in mount options
- update 73b test to check mount is working too

Fixes: f9d346f0c1 ("LU-18587 utils: allow large NID lists in mount tools")
Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Change-Id: I46c296694a053c710310bced94ec95afae76b800
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58375
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/conf-sanity.sh
lustre/utils/mount_lustre.c
lustre/utils/mount_utils.c

index eaa5837..2dfa2a5 100755 (executable)
@@ -6755,28 +6755,40 @@ test_73b() {
 
        local ostdev=$(ostdevname 1)
        local nids="111.222.173._@$NETTYPE,111.222.142._@$NETTYPE"
-       local min=160
-       local iter=$((min * 14 / 20))
+       local iter=60
+       local cmd
 
        do_facet ost1 "$TUNEFS --comment='just a comment for tail' $ostdev" ||
                error "1st tunefs failed"
 
-       # 4K can fit ~180 IPv4 NIDs, try more for checking failure case too
-       # add in pairs just to reduce test time
+       # 4K can fit ~200 IPv4 NIDs, try more for checking failure case too
+       # add in pairs in both mgsnode and failnode to reduce test time
        for ((i = 1; i <= $iter; i++)); do
-               do_facet ost1 "$TUNEFS --failnode=${nids//_/$i} $ostdev" >/dev/null ||
+               local cmd="--failnode=${nids//_/$i} --mgsnode=${nids//_/$i}"
+               do_facet ost1 "$TUNEFS $cmd $ostdev" >/dev/null ||
                        break
        done
-       echo "added $i/$iter NID failover pairs"
+
+       start_mgsmds || error "Fail to start mds"
+       start_ost || error "Fail to mount ost"
+
+       local zkeeper=${KEEP_ZPOOL}
+       stack_trap "KEEP_ZPOOL=$zkeeper" EXIT
+       KEEP_ZPOOL="true"
+       stop_ost
+       stop_mds
+
        # count the actual number of failover NIDs configured in failover.node
        # there may be some previously configured, so they should also count
-       local count=$(do_facet ost1 $TUNEFS --dryrun $ostdev | grep "^Param" |
-                     sed -e "s/.*failover.node=//" -e "s/[:,]/\n/g" |
-                     grep -c $NETTYPE)
-       do_facet ost1 "$TUNEFS --erase-param failover.node $ostdev"
+       local count=$(do_facet ost1 "$TUNEFS --erase-params $ostdev" |
+                     grep "^Param" | grep -Fo '@' | wc -l)
+       echo "Found total $count NIDs in parameters"
+
+       KEEP_ZPOOL="${zkeeper}"
+       reformat
 
-       # expect to fit more that 160 NIDs at least
-       ((count >= min)) || error "Only $count NIDs configured, need >= $min"
+       # expect to fit more that 32 mgsnode and 4*32 failover NIDs at least
+       ((count >= 160)) || error "Only $count NIDs found, need >= (128+32)"
 }
 run_test 73b "Large failnode NID list in mountdata"
 
index d440644..a6cbb56 100644 (file)
@@ -500,6 +500,7 @@ static int parse_ldd(char *source, struct mount_opts *mop,
        struct lustre_disk_data *ldd = &mop->mo_ldd;
        char *cur, *start;
        char *temp_options;
+       bool skip_mgsnode_param = false;
        int rc = 0;
 
        rc = osd_is_lustre(source, &ldd->ldd_mount_type);
@@ -584,6 +585,7 @@ static int parse_ldd(char *source, struct mount_opts *mop,
                        if (add_mgsnids(mop, options, ldd->ldd_params,
                                        options_len))
                                return E2BIG;
+                       skip_mgsnode_param = true;
                }
        }
        /* Better have an mgsnid by now */
@@ -635,6 +637,10 @@ static int parse_ldd(char *source, struct mount_opts *mop,
                        *start = '\0';
                        start++;
                }
+
+               if (skip_mgsnode_param && !strncmp(cur, "mgsnode", 7))
+                       continue;
+
                rc = append_option(options, options_len, "param=", cur);
                if (rc != 0)
                        return rc;
index 8d59e29..3239d1d 100644 (file)
@@ -120,7 +120,7 @@ int run_command(char *cmd, int cmdsz)
        return rc;
 }
 
-#define MAXNIDSTR LDD_PARAM_LEN
+#define MAXNIDSTR (LDD_PARAM_LEN - 256)
 
 #ifdef HAVE_SERVER_SUPPORT
 int add_param(char *buf, char *key, char *val)