]> www.infradead.org Git - users/hch/nvmetcli.git/commitdiff
nvmetcli: port decoration coloring only if its enabled
authorSagi Grimberg <sagi@grimberg.me>
Tue, 5 Dec 2017 11:48:42 +0000 (13:48 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 6 Dec 2017 22:48:57 +0000 (14:48 -0800)
Only color the port if its enabled (has subsystems or
referrals symlinks).

Also, don't display none trsvcid (like in the fc case).

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
nvmetcli

index ead6429d5be5840771a99c2928a7b435ff761599..6b102a235450c41ce4a31521d5bede0618781d99 100755 (executable)
--- a/nvmetcli
+++ b/nvmetcli
@@ -382,10 +382,13 @@ class UIPortNode(UINode):
 
     def summary(self):
         info = []
-        info.append("traddr=" + self.cfnode.get_attr("addr", "traddr"))
-        info.append("trsvcid=" + self.cfnode.get_attr("addr", "trsvcid"))
         info.append("trtype=" + self.cfnode.get_attr("addr", "trtype"))
-        return (", ".join(info), True)
+        info.append("traddr=" + self.cfnode.get_attr("addr", "traddr"))
+        trsvcid = self.cfnode.get_attr("addr", "trsvcid")
+        if trsvcid != "none":
+            info.append("trsvcid=%s" % trsvcid)
+        enabled = not (not self.cfnode.subsystems and not list(self.cfnode.referrals))
+        return (", ".join(info), True if enabled else 0)
 
 class UIPortSubsystemsNode(UINode):
     def __init__(self, parent):