[virt-tools-list] [PATCH v2 2/6] virtinst: Add pretty_desc function for device address printing

Lin Ma lma at suse.com
Thu Nov 23 09:32:46 UTC 2017


Signed-off-by: Lin Ma <lma at suse.com>
---
 virtinst/device.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/virtinst/device.py b/virtinst/device.py
index c160378b..7118a162 100644
--- a/virtinst/device.py
+++ b/virtinst/device.py
@@ -72,6 +72,13 @@ class VirtualDeviceAddress(XMLBuilder):
             raise ValueError(_("Could not determine or unsupported "
                                "format of '%s'") % addrstr)
 
+    def pretty_desc(self):
+        pretty_desc = None
+        if self.type == self.ADDRESS_TYPE_DRIVE:
+            pretty_desc = _("%s:%s:%s:%s" %
+                            (self.controller, self.bus, self.target, self.unit))
+        return pretty_desc
+
     def compare_controller(self, controller, dev_bus):
         if (controller.type == dev_bus and
             controller.index == self.controller):
-- 
2.14.0




More information about the virt-tools-list mailing list