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

Li Zhang zhlcindy at linux.vnet.ibm.com
Tue Feb 28 07:23:28 UTC 2012


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 at linux.vnet.ibm.com>
---
 src/virtManager/details.py |   23 ++++++++++++++++++++---
 src/virtManager/domain.py  |    6 ++++--
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/src/virtManager/details.py b/src/virtManager/details.py
index 55ea957..ad9bead 100644
--- a/src/virtManager/details.py
+++ b/src/virtManager/details.py
@@ -2205,7 +2205,10 @@ 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)
+            if bus == "spapr-vscsi":
+                add_define(self.vm.define_disk_bus, dev_id_info, "scsi", "spapr-vio")
+            else:
+                add_define(self.vm.define_disk_bus, dev_id_info, bus, None)
 
         return self._change_config_helper(df, da, hf, ha)
 
@@ -2791,6 +2794,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,7 +2818,10 @@ class vmmDetails(vmmGObjectUI):
         is_cdrom = (devtype == virtinst.VirtualDisk.DEVICE_CDROM)
         is_floppy = (devtype == virtinst.VirtualDisk.DEVICE_FLOPPY)
 
-        pretty_name = prettyify_disk(devtype, bus, idx)
+        if addr == "spapr-vio":
+            pretty_name = "vSCSI %s" % idx
+        else:
+            pretty_name = prettyify_disk(devtype, bus, idx)
 
         self.widget("disk-source-path").set_text(path or "-")
         self.widget("disk-target-type").set_text(pretty_name)
@@ -2832,6 +2839,10 @@ class vmmDetails(vmmGObjectUI):
         no_default = not self.is_customize_dialog
 
         self.populate_disk_bus_combo(devtype, no_default)
+
+        if addr == "spapr-vio":
+            bus = "spapr-vscsi"
+
         self.set_combo_label("disk-bus", bus)
         self.widget("disk-serial").set_text(serial 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,7 +3378,10 @@ class vmmDetails(vmmGObjectUI):
             elif devtype == "floppy":
                 icon = "media-floppy"
 
-            label = prettyify_disk(devtype, bus, idx)
+            if disk.address.type == "spapr-vio":
+                label = "vSCSI %s" % idx
+            else:
+                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..0116421 100644
--- a/src/virtManager/domain.py
+++ b/src/virtManager/domain.py
@@ -577,16 +577,18 @@ 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
-            editdev.bus = newval
 
             if oldbus == newval:
                 return
 
             editdev.address.clear()
+            editdev.bus = newval
+            if addr is not None:
+                editdev.set_address(addr)
 
             if oldprefix == editdev.get_target_prefix()[0]:
                 return
-- 
1.7.5.4




More information about the virt-tools-list mailing list