Whamcloud - gitweb
LU-18680 ptlrpc: Improve yaml output for nodemap offset 85/58085/2
authorMarc Vef <mvef@whamcloud.com>
Fri, 14 Feb 2025 11:14:22 +0000 (12:14 +0100)
committerOleg Drokin <green@whamcloud.com>
Fri, 28 Feb 2025 08:14:54 +0000 (08:14 +0000)
Nodemap offset presents loose values on lctl get_param:
$ lctl get_param -n nodemap.t0.offset
start_uid: 100000
limit_uid: 200000
start_gid: 100000
limit_gid: 200000
start_projid: 100000
limit_projid: 200000

This is technically valid YAML syntax, but not contextually bound as a
unit or to its key "offset". In the future, we want to save/restore
entire nodemap configurations. This means that the key "offset" is
necessary to relate the values to. This can be done via indenting or
more explicitly with {}, as done in this patch to be consistent with
other nodemap properties like ranges or idmap and to not necessarily
rely on indentation:
$ lctl get_param -n nodemap.t0.offset
{
 start_uid: 100000,
 limit_uid: 200000,
 start_gid: 100000,
 limit_gid: 200000,
 start_projid: 100000,
 limit_projid: 200000
}

Note, offsets are always shown even for zero, thus {} is not
shown when no offsets are defined.

Test-Parameters: trivial testlist=sanity-sec env=ONLY=27ab
Signed-off-by: Marc Vef <mvef@whamcloud.com>
Change-Id: I9b9a5411c3adcd39d45f29c8fc1d8c51163ba9b5
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58085
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Aurelien Degremont <adegremont@nvidia.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/ptlrpc/nodemap_lproc.c

index 4f5aeb8..c705277 100644 (file)
@@ -125,12 +125,16 @@ static int nodemap_offset_seq_show(struct seq_file *m, void *data)
                return rc;
        }
 
-       seq_printf(m, "start_uid: %u\n", nodemap->nm_offset_start_uid);
-       seq_printf(m, "limit_uid: %u\n", nodemap->nm_offset_limit_uid);
-       seq_printf(m, "start_gid: %u\n", nodemap->nm_offset_start_gid);
-       seq_printf(m, "limit_gid: %u\n", nodemap->nm_offset_limit_gid);
-       seq_printf(m, "start_projid: %u\n", nodemap->nm_offset_start_projid);
-       seq_printf(m, "limit_projid: %u\n", nodemap->nm_offset_limit_projid);
+       seq_puts(m, "{\n");
+
+       seq_printf(m, " start_uid: %u,\n", nodemap->nm_offset_start_uid);
+       seq_printf(m, " limit_uid: %u,\n", nodemap->nm_offset_limit_uid);
+       seq_printf(m, " start_gid: %u,\n", nodemap->nm_offset_start_gid);
+       seq_printf(m, " limit_gid: %u,\n", nodemap->nm_offset_limit_gid);
+       seq_printf(m, " start_projid: %u,\n", nodemap->nm_offset_start_projid);
+       seq_printf(m, " limit_projid: %u\n", nodemap->nm_offset_limit_projid);
+
+       seq_puts(m, "}\n");
 
        nodemap_putref(nodemap);
        return 0;