Whamcloud - gitweb
LU-17431 utils: adapt dynamic use in nodemap_cmd 00/55000/2
authorSebastien Buisson <sbuisson@ddn.com>
Tue, 30 Apr 2024 16:08:22 +0000 (18:08 +0200)
committerOleg Drokin <green@whamcloud.com>
Wed, 29 May 2024 04:46:36 +0000 (04:46 +0000)
In nodemap_cmd(), try to detect if we are running on an MGS
before using the dynamic parameter.

Test-Parameters: trivial
Fixes: fecc3bd4e2 ("LU-17431 utils: add 'dynamic' parameter to nodemap_cmd")
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I63a727491c839e457e44eaf1f4b4d11b164fd8b4
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55000
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/obd.c

index 07c4ed3..c871ea9 100644 (file)
@@ -796,12 +796,26 @@ int jt_opt_net(int argc, char **argv)
 #define OBD_IOC_NO_TRANSNO     _IOW('f', 140, OBD_IOC_DATA_TYPE)
 #endif
 
+static bool is_mgs(void)
+{
+       glob_t path;
+       int rc;
+
+       rc = cfs_get_param_paths(&path, "mgs/MGS/exports");
+       if (!rc) {
+               cfs_free_param_data(&path);
+               return true;
+       }
+
+       return false;
+}
+
 static bool is_mds(void)
 {
        glob_t path;
        int rc;
 
-       rc = cfs_get_param_paths(&path, "mdt/*-MDT0000");
+       rc = cfs_get_param_paths(&path, "mdt/*-MDT*/exports");
        if (!rc) {
                cfs_free_param_data(&path);
                return true;
@@ -815,7 +829,7 @@ static bool is_oss(void)
        glob_t path;
        int rc;
 
-       rc = cfs_get_param_paths(&path, "obdfilter/*-OST0000");
+       rc = cfs_get_param_paths(&path, "obdfilter/*-OST*/exports");
        if (!rc) {
                cfs_free_param_data(&path);
                return true;
@@ -3907,6 +3921,7 @@ static int nodemap_cmd(enum lcfg_command_type cmd, bool dynamic,
        lustre_cfg_init(lcfg, cmd, &bufs);
 
        memset(&data, 0, sizeof(data));
+getdev:
        if (dynamic) {
                if (is_mds()) {
                        rc = data.ioc_dev = get_mds_device();
@@ -3917,6 +3932,10 @@ static int nodemap_cmd(enum lcfg_command_type cmd, bool dynamic,
                        rc = -errno;
                }
        } else {
+               if (!is_mgs()) {
+                       dynamic = true;
+                       goto getdev;
+               }
                rc = data.ioc_dev = get_mgs_device();
        }
        if (rc < 0)