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

[virt-tools-list] [PATCH v2] virtinst:Add spapr-vio address type for pseries kvm guest



For pseries kvm guest, scsi controller can use 
spapr-vio address type, not only pci address type. 
So it's necessary to provide such an option to 
device to configure it.

This patch provides spapr-vio address type option for
scsi controller. And scsi controller and address type 
tags are generated in xml file. It is like the following:

<controller type='scsi' index='0'>
    <address type='spapr-vio'/>
</controller>

Signed-off-by: Li Zhang <zhlcindy linux vnet ibm com>
---
 virtinst/Guest.py         |    8 ++++++++
 virtinst/VirtualDevice.py |    6 +++++-
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/virtinst/Guest.py b/virtinst/Guest.py
index b180770..5c61f36 100644
--- a/virtinst/Guest.py
+++ b/virtinst/Guest.py
@@ -870,11 +870,19 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
             finally:
                 if origpath:
                     dev.path = origpath
+        def get_vscsi_ctrl_xml():
+            vscsi_class = virtinst.VirtualController.get_class_for_type(
+                          virtinst.VirtualController.CONTROLLER_TYPE_SCSI)
+            ctrl = vscsi_class(self.conn)
+            ctrl.set_address("spapr-vio")
+            return ctrl._get_xml_config()
 
         xml = self._get_emulator_xml()
         # Build XML
         for dev in devs:
             xml = _util.xml_append(xml, get_dev_xml(dev))
+            if dev.address.type == "spapr-vio":
+                xml = _util.xml_append(xml, get_vscsi_ctrl_xml())
 
         return xml
 
diff --git a/virtinst/VirtualDevice.py b/virtinst/VirtualDevice.py
index 2234979..660643d 100644
--- a/virtinst/VirtualDevice.py
+++ b/virtinst/VirtualDevice.py
@@ -143,9 +143,11 @@ class VirtualDeviceAddress(XMLBuilderDomain):
     ADDRESS_TYPE_DRIVE         = "drive"
     ADDRESS_TYPE_VIRTIO_SERIAL = "virtio-serial"
     ADDRESS_TYPE_CCID          = "ccid"
+    ADDRESS_TYPE_SPAPR_VIO     = "spapr-vio"
 
     TYPES = [ADDRESS_TYPE_PCI, ADDRESS_TYPE_DRIVE,
-             ADDRESS_TYPE_VIRTIO_SERIAL, ADDRESS_TYPE_CCID]
+             ADDRESS_TYPE_VIRTIO_SERIAL, ADDRESS_TYPE_CCID,
+             ADDRESS_TYPE_SPAPR_VIO]
 
     def __init__(self, conn, parsexml=None, parsexmlnode=None, caps=None, addrstr=None):
         XMLBuilderDomain.__init__(self, conn, parsexml, parsexmlnode,
@@ -185,6 +187,8 @@ class VirtualDeviceAddress(XMLBuilderDomain):
                 self.domain = "0"
                 if addrstr.count(":"):
                     self.domain, self.bus = addrstr.split(":", 1)
+            elif addrstr == "spapr-vio":
+                self.type = self.ADDRESS_TYPE_SPAPR_VIO
             else:
                 raise ValueError(_("Could not determine or unsupported format of '%s'") % addrstr)
         except:
-- 
1.7.5.4


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