On 02/22/2012 06:13 PM, Li Zhang wrote:
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@xxxxxxxxxxxxxxxxxx> --- src/virtManager/details.py | 18 ++++++++++++++++-- src/virtManager/domain.py | 7 ++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/virtManager/details.py b/src/virtManager/details.py index 55ea957..b24c2db 100644 --- a/src/virtManager/details.py +++ b/src/virtManager/details.py @@ -2791,6 +2791,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 +2815,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 +2836,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 +3287,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 +3375,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..911a210 100644 --- a/src/virtManager/domain.py +++ b/src/virtManager/domain.py @@ -581,13 +581,18 @@ class vmmDomain(vmmLibvirtObject): def change(editdev): oldprefix = editdev.get_target_prefix()[0] oldbus = editdev.bus - editdev.bus = newval if oldbus == newval: return editdev.address.clear() + if newval == "spapr-vscsi": + editdev.bus = "scsi" + editdev.set_address("spapr-vio") + else: + editdev.bus = newval + if oldprefix == editdev.get_target_prefix()[0]: return
Hi Cole, Any comment about this patch? This is only supported on pseries machine type. Until now, spapr-vscsi is always used on powerKVM. ctually, the device's bus should be scsi,just the address type is changed. So it is called vSCSI.I didn't provide another combo to user to select address type, because I think it's not necessary for user to care about the bus address. I just provide such a sPAPR-vSCSI disk type in the disk page. It's much easier to understand for users, I think:)