From 81e3cc4a56a29d480ac421e64b45f46b6214b73a Mon Sep 17 00:00:00 2001 From: Cyril Bordage Date: Fri, 4 Jun 2021 05:40:07 +0200 Subject: [PATCH] LU-13364 utils: fix bad output for lnetctl import --show 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 Change-Id: I9fbbac882f26fd93299f37cca00fcbd4cb7e95d2 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/43922 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Frank Sehr Reviewed-by: Serguei Smirnov Reviewed-by: Oleg Drokin --- lnet/utils/lnetconfig/liblnetconfig.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lnet/utils/lnetconfig/liblnetconfig.c b/lnet/utils/lnetconfig/liblnetconfig.c index 9b44a76..bbb412a 100644 --- a/lnet/utils/lnetconfig/liblnetconfig.c +++ b/lnet/utils/lnetconfig/liblnetconfig.c @@ -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"); -- 1.8.3.1