summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLee Duncan <lduncan@suse.com>2019-03-12 12:14:55 -0700
committerLee Duncan <lduncan@suse.com>2019-03-12 12:19:41 -0700
commitec2afb8a1c997bac706de4f70a3a59fdd82b5741 (patch)
treebd4af2ac73a52f923e5668f4f4829670023a48b4
parente74612a3246d0f00dbaed53670c0baa6ad0d031a (diff)
downloadopen-iscsi-ec2afb8a1c997bac706de4f70a3a59fdd82b5741.tar.gz
Fix node print return value when no nodes.
When we switched to using libopeniscsiusr, the behavior of iscsiadm when running "iscsiadm -m node" diverged with that seen when running "iscsiadm -m node --op show", whereas before that time (version 2.0.873) was the same for these two cases. Note that iscsiadm return value used to be the same in both cases, i.e. returning 21, meaning "no targets found", but now returns 21 for the "--op show" case and zero for the other. The fix is simple: rip out the code in iscsiadm that treats "iscsiadm -m node" as a special case, allowing the code to fall through to its previous behavior.
-rw-r--r--usr/iscsiadm.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 7cb4b97..ef9ea84 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -681,14 +681,6 @@ static int login_portals(struct node_rec *pattern_rec)
return rc;
}
-static void print_node_flat(struct iscsi_node *node)
-{
- printf("%s,%" PRIu16 " %s\n",
- iscsi_node_portal_get(node),
- iscsi_node_tpgt_get(node),
- iscsi_node_target_name_get(node));
-}
-
// The 'iface_mode' argument is only used for command
// `iscsiadm -m iface -P 1`
static void print_nodes_tree(struct iscsi_node **nodes, uint32_t node_count,
@@ -718,34 +710,6 @@ static void print_nodes_tree(struct iscsi_node **nodes, uint32_t node_count,
}
}
-static int print_nodes(struct iscsi_context *ctx, int info_level)
-{
- struct iscsi_node **nodes = NULL;
- uint32_t node_count = 0;
- uint32_t i = 0;
- int rc = 0;
-
- if ((info_level != 0) && (info_level != -1) && (info_level != 1)) {
- log_error("Invalid info level %d. Try 0 or 1.", info_level);
- rc = ISCSI_ERR_INVAL;
- goto out;
- }
-
- rc = iscsi_nodes_get(ctx, &nodes, &node_count);
- if (rc != LIBISCSI_OK)
- goto out;
-
- if (info_level == 1)
- print_nodes_tree(nodes, node_count, _PRINT_MODE_NODE);
- else
- for (i = 0; i < node_count; ++i)
- print_node_flat(nodes[i]);
-
-out:
- iscsi_nodes_free(nodes, node_count);
- return rc;
-}
-
static int print_nodes_config(struct iscsi_context *ctx, bool show_secret,
const char *target_name, const char *address,
int32_t port, const char *iface_name)
@@ -2816,14 +2780,6 @@ static int exec_node_op(struct iscsi_context *ctx, int op, int do_login,
goto out;
}
- if ((!do_login && !do_logout && op == OP_NOOP) &&
- ((rec == NULL) ||
- (!strlen(rec->name) && !strlen(rec->conn[0].address) &&
- !strlen(rec->iface.name)))) {
- rc = print_nodes(ctx, info_level);
- goto out;
- }
-
if (do_login) {
rc = login_portals(rec);
goto out;