[virt-tools-list] [virt-manager PATCH 1/2] addhardware: Use consistent combo init for disk io mode option

Lin Ma lma at suse.com
Thu Sep 6 07:49:29 UTC 2018


Signed-off-by: Lin Ma <lma at suse.com>
---
 virtManager/addhardware.py |  7 +++++++
 virtManager/details.py     | 11 ++---------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index d8146bf3..9a517b74 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -450,6 +450,13 @@ class vmmAddHardware(vmmGObjectUI):
             values.append([m, m])
         _build_combo(combo, values, sort=False)
 
+    @staticmethod
+    def build_disk_io_combo(_vm, combo):
+        values = [[None, _("Hypervisor default")]]
+        for m in DeviceDisk.io_modes:
+            values.append([m, m])
+        _build_combo(combo, values, sort=False)
+
     @staticmethod
     def build_disk_discard_combo(_vm, combo):
         values = [[None, _("Hypervisor default")]]
diff --git a/virtManager/details.py b/virtManager/details.py
index 1e619e78..58a325a7 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -1009,15 +1009,8 @@ class vmmDetails(vmmGObjectUI):
         vmmAddHardware.build_disk_cache_combo(self.vm, disk_cache)
 
         # Disk io combo
-        combo = self.widget("disk-io")
-        model = Gtk.ListStore(str, str)
-        combo.set_model(model)
-        uiutil.init_combo_text_column(combo, 1)
-        model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
-        model.append([None, _("Hypervisor default")])
-        for m in virtinst.DeviceDisk.io_modes:
-            model.append([m, m])
-        combo.set_active(0)
+        disk_io = self.widget("disk-io")
+        vmmAddHardware.build_disk_io_combo(self.vm, disk_io)
 
         # Discard combo
         combo = self.widget("disk-discard")
-- 
2.15.1




More information about the virt-tools-list mailing list