From: Sagi Grimberg Date: Tue, 5 Dec 2017 11:48:42 +0000 (+0200) Subject: nvmetcli: port decoration coloring only if its enabled X-Git-Tag: v0.6~1 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=12b24d905b5915984e2832798bc94a72b7149d33;p=users%2Fhch%2Fnvmetcli.git nvmetcli: port decoration coloring only if its enabled 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 Reviewed-by: Johannes Thumshirn Signed-off-by: Christoph Hellwig --- diff --git a/nvmetcli b/nvmetcli index ead6429..6b102a2 100755 --- 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):