]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-print-stdout: Do not show non reachable ns in namespace topology
authorDaniel Wagner <dwagner@suse.de>
Wed, 26 Jul 2023 13:46:55 +0000 (15:46 +0200)
committerDaniel Wagner <wagi@monom.org>
Thu, 27 Jul 2023 08:20:01 +0000 (10:20 +0200)
If the host is connected to the target with two different hostnqn we can
have the situation where a namespace is only reachable via one ctrl and
a second namespace only by a different controller. Thus we should only
show a namespace in the topology if there is a path.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
nvme-print-stdout.c

index 566571df0293a5b841f7da8964b97d6b210ae231..975ac628411fe0583cb066eeb6e9fe2303b25d0c 100644 (file)
@@ -4764,6 +4764,9 @@ static void stdout_subsystem_topology_multipath(nvme_subsystem_t s,
 
        if (ranking == NVME_CLI_TOPO_NAMESPACE) {
                nvme_subsystem_for_each_ns(s, n) {
+                       if (!nvme_namespace_first_path(n))
+                               continue;
+
                        printf(" +- ns %d\n", nvme_ns_get_nsid(n));
                        printf(" \\\n");