Whamcloud - gitweb
LU-13364 utils: fix bad output for lnetctl import --show 22/43922/2
authorCyril Bordage <cbordage@whamcloud.com>
Fri, 4 Jun 2021 03:40:07 +0000 (05:40 +0200)
committerOleg Drokin <green@whamcloud.com>
Sat, 15 Oct 2022 05:55:40 +0000 (05:55 +0000)
Read the right node from the yaml input ("net type" instead of "net")
to compare to what we find from ioctl when we filter results.

Signed-off-by: Cyril Bordage <cbordage@whamcloud.com>
Change-Id: I9fbbac882f26fd93299f37cca00fcbd4cb7e95d2
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/43922
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/utils/lnetconfig/liblnetconfig.c

index 9b44a76..bbb412a 100644 (file)
@@ -2209,10 +2209,13 @@ int lustre_lnet_show_net(char *nw, int detail, int seq_no,
                }
 
                if (new_net) {
-                       if (!cYAML_create_string(net_node, "net type",
-                                                libcfs_net2str(rc_net)))
+                       tmp = cYAML_create_string(net_node, "net type", libcfs_net2str(rc_net));
+                       if (tmp == NULL)
                                goto out;
 
+                       if (first_seq == NULL)
+                               first_seq = tmp;
+
                        tmp = cYAML_create_seq(net_node, "local NI(s)");
                        if (tmp == NULL)
                                goto out;
@@ -2224,9 +2227,6 @@ int lustre_lnet_show_net(char *nw, int detail, int seq_no,
                if (item == NULL)
                        goto out;
 
-               if (first_seq == NULL)
-                       first_seq = item;
-
                if (!backup &&
                    cYAML_create_string(item, "nid",
                                        libcfs_nid2str(ni_data->lic_nid)) == NULL)
@@ -5013,7 +5013,7 @@ static int handle_yaml_show_net(struct cYAML *tree, struct cYAML **show_rc,
 {
        struct cYAML *net, *detail, *seq_no;
 
-       net = cYAML_get_object_item(tree, "net");
+       net = cYAML_get_object_item(tree, "net type");
        detail = cYAML_get_object_item(tree, "detail");
        seq_no = cYAML_get_object_item(tree, "seq_no");