[virt-tools-list] [PATCHv3] virtinst:Add spapr-vio address type for pseries kvm guest
Li Zhang
zhlcindy at linux.vnet.ibm.com
Tue Feb 28 07:23:05 UTC 2012
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 at linux.vnet.ibm.com>
---
tests/xmlconfig-xml/boot-many-devices.xml | 3 +++
tests/xmlconfig.py | 1 +
virtinst/Guest.py | 8 ++++++++
virtinst/VirtualDevice.py | 6 +++++-
4 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/tests/xmlconfig-xml/boot-many-devices.xml b/tests/xmlconfig-xml/boot-many-devices.xml
index b654889..c9c5632 100644
--- a/tests/xmlconfig-xml/boot-many-devices.xml
+++ b/tests/xmlconfig-xml/boot-many-devices.xml
@@ -39,6 +39,9 @@
<source file='/default-pool/testvol1.img'/>
<target dev='sdb' bus='scsi'/>
</disk>
+ <controller type='scsi' index='0'>
+ <address type='spapr-vio'/>
+ </controller>
<controller type='ide' index='3'/>
<controller type='virtio-serial' index='0' ports='32' vectors='17'/>
<interface type='network'>
diff --git a/tests/xmlconfig.py b/tests/xmlconfig.py
index 2001b85..3098f13 100644
--- a/tests/xmlconfig.py
+++ b/tests/xmlconfig.py
@@ -714,6 +714,7 @@ class TestXMLConfig(unittest.TestCase):
g.disks.append(VirtualDisk(conn=g.conn, path="/tmp", device="floppy"))
d3 = VirtualDisk(conn=g.conn, path="/default-pool/testvol1.img",
bus="scsi", driverName="qemu")
+ d3.address.type = "spapr-vio"
g.disks.append(d3)
# Controller devices
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
More information about the virt-tools-list
mailing list