[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [PATCHv4] virt-manager: Add spapr-vscsi disk type for pseries guest.



This patch adds spapr-vscsi disk type on disk GUI page.
It provides an options to user to select the scsi disk
which is based on spapr-vio address type for pseries guest.

Signed-off-by: Li Zhang <zhlcindy linux vnet ibm com>
---
 src/virtManager/details.py |   19 ++++++++++++++++++-
 src/virtManager/domain.py  |    3 ++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/virtManager/details.py b/src/virtManager/details.py
index 55ea957..0a1e9a4 100644
--- a/src/virtManager/details.py
+++ b/src/virtManager/details.py
@@ -157,6 +157,9 @@ def prettyify_disk_bus(bus):
     if bus == "virtio":
         return "VirtIO"
 
+    if bus == "spapr-vscsi":
+        return "vSCSI"
+
     return bus
 
 def prettyify_disk(devtype, bus, idx):
@@ -2205,7 +2208,11 @@ class vmmDetails(vmmGObjectUI):
         # Do this last since it can change uniqueness info of the dev
         if self.editted(EDIT_DISK_BUS):
             bus = self.get_combo_label_value("disk-bus")
-            add_define(self.vm.define_disk_bus, dev_id_info, bus)
+            addr = None
+            if bus == "spapr-vscsi":
+                bus = "scsi"
+                addr = "spapr-vio"
+            add_define(self.vm.define_disk_bus, dev_id_info, bus, addr)
 
         return self._change_config_helper(df, da, hf, ha)
 
@@ -2791,6 +2798,7 @@ class vmmDetails(vmmGObjectUI):
         ro = disk.read_only
         share = disk.shareable
         bus = disk.bus
+        addr = disk.address.type
         idx = disk.disk_bus_index
         cache = disk.driver_cache
         io = disk.driver_io
@@ -2814,6 +2822,9 @@ class vmmDetails(vmmGObjectUI):
         is_cdrom = (devtype == virtinst.VirtualDisk.DEVICE_CDROM)
         is_floppy = (devtype == virtinst.VirtualDisk.DEVICE_FLOPPY)
 
+        if addr == "spapr-vio":
+            bus = "spapr-vscsi"
+
         pretty_name = prettyify_disk(devtype, bus, idx)
 
         self.widget("disk-source-path").set_text(path or "-")
@@ -3279,6 +3290,9 @@ class vmmDetails(vmmGObjectUI):
             if self.vm.get_hv_type() in ["kvm", "test"]:
                 buses.append(["sata", "SATA"])
                 buses.append(["virtio", "Virtio"])
+            if (self.vm.get_hv_type() == "kvm" and
+                    self.vm.get_machtype() == "pseries"):
+                buses.append(["spapr-vscsi", "sPAPR-vSCSI"])
             if self.vm.conn.is_xen() or self.vm.get_hv_type() == "test":
                 buses.append(["xen", "Xen"])
 
@@ -3364,6 +3378,9 @@ class vmmDetails(vmmGObjectUI):
             elif devtype == "floppy":
                 icon = "media-floppy"
 
+            if disk.address.type == "spapr-vio":
+                bus = "spapr-vscsi"
+
             label = prettyify_disk(devtype, bus, idx)
 
             update_hwlist(HW_LIST_TYPE_DISK, disk, label, icon)
diff --git a/src/virtManager/domain.py b/src/virtManager/domain.py
index 7f382e0..7bcebec 100644
--- a/src/virtManager/domain.py
+++ b/src/virtManager/domain.py
@@ -577,7 +577,7 @@ class vmmDomain(vmmLibvirtObject):
         def change(editdev):
             editdev.driver_type = new_driver_type or None
         return self._redefine_device(change, devobj)
-    def define_disk_bus(self, devobj, newval):
+    def define_disk_bus(self, devobj, newval, addr):
         def change(editdev):
             oldprefix = editdev.get_target_prefix()[0]
             oldbus = editdev.bus
@@ -587,6 +587,7 @@ class vmmDomain(vmmLibvirtObject):
                 return
 
             editdev.address.clear()
+            editdev.set_address(addr)
 
             if oldprefix == editdev.get_target_prefix()[0]:
                 return
-- 
1.7.5.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]