[virt-tools-list] [virt-install] virt-install: Add support for xenbus controller

Jim Fehlig jfehlig at suse.com
Wed Mar 20 20:24:41 UTC 2019


libvirt commit 09eb1ae0 added support for a new 'xenbus' controller
type. Add support for the controller in virtinst, including support
for the maxGrantFrames attribute.

Signed-off-by: Jim Fehlig <jfehlig at suse.com>
---
 tests/cli-test-xml/compare/virt-install-many-devices.xml | 1 +
 tests/cli-test-xml/compare/virt-install-xen-pv.xml       | 2 ++
 tests/clitest.py                                         | 3 ++-
 virtinst/cli.py                                          | 1 +
 virtinst/devices/controller.py                           | 5 ++++-
 5 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/cli-test-xml/compare/virt-install-many-devices.xml b/tests/cli-test-xml/compare/virt-install-many-devices.xml
index 89c31019..61c7df07 100644
--- a/tests/cli-test-xml/compare/virt-install-many-devices.xml
+++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml
@@ -187,6 +187,7 @@
     <controller type="scsi" index="0" model="virtio-scsi">
       <driver queues="4"/>
     </controller>
+    <controller type="xenbus" index="0" maxGrantFrames="64"/>
     <filesystem type="mount" accessmode="mapped">
       <source dir="/source"/>
       <target dir="/target"/>
diff --git a/tests/cli-test-xml/compare/virt-install-xen-pv.xml b/tests/cli-test-xml/compare/virt-install-xen-pv.xml
index cc2ff7c6..7da7466d 100644
--- a/tests/cli-test-xml/compare/virt-install-xen-pv.xml
+++ b/tests/cli-test-xml/compare/virt-install-xen-pv.xml
@@ -22,6 +22,7 @@
       <source file="/dev/default-pool/testvol1.img"/>
       <target dev="xvda" bus="xen"/>
     </disk>
+    <controller type="xenbus" index="0" maxGrantFrames="64"/>
     <interface type="bridge">
       <source bridge="eth0"/>
       <mac address="00:11:22:33:44:55"/>
@@ -51,6 +52,7 @@
       <source file="/dev/default-pool/testvol1.img"/>
       <target dev="xvda" bus="xen"/>
     </disk>
+    <controller type="xenbus" index="0" maxGrantFrames="64"/>
     <interface type="bridge">
       <source bridge="eth0"/>
       <mac address="00:11:22:33:44:55"/>
diff --git a/tests/clitest.py b/tests/clitest.py
index 5b9aba67..c0badbdc 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -510,6 +510,7 @@ c.add_compare(""" \
 --controller usb,model=ich9-uhci2,address=0:0:4.1,index=0,master=2 \
 --controller usb,model=ich9-uhci3,address=0:0:4.2,index=0,master=4 \
 --controller scsi,model=virtio-scsi,driver_queues=4 \
+--controller xenbus,maxGrantFrames=64 \
 \
 --input type=keyboard,bus=usb \
 --input tablet \
@@ -825,7 +826,7 @@ c.add_compare("--init /usr/bin/httpd", "manual-init")
 c = vinst.add_category("xen", "--noautoconsole --connect " + utils.URIs.xen)
 c.add_valid("--disk %(EXISTIMG1)s --location %(TREEDIR)s --paravirt --graphics none")  # Xen PV install headless
 c.add_compare("--disk %(EXISTIMG1)s --import", "xen-default")  # Xen default
-c.add_compare("--disk %(EXISTIMG1)s --location %(TREEDIR)s --paravirt", "xen-pv")  # Xen PV
+c.add_compare("--disk %(EXISTIMG1)s --location %(TREEDIR)s --paravirt --controller xenbus,maxGrantFrames=64", "xen-pv")  # Xen PV
 c.add_compare("--disk  /iscsi-pool/diskvol1 --cdrom %(EXISTIMG1)s --livecd --hvm", "xen-hvm")  # Xen HVM
 
 
diff --git a/virtinst/cli.py b/virtinst/cli.py
index dcf47cfc..c5d5e064 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2647,6 +2647,7 @@ class ParserController(VirtCLIParser):
         cls.add_arg("index", "index")
         cls.add_arg("master_startport", "master")
         cls.add_arg("driver_queues", "driver_queues")
+        cls.add_arg("maxGrantFrames", "maxGrantFrames")
 
         cls.add_arg(None, "address", cb=cls.set_server_cb)
 
diff --git a/virtinst/devices/controller.py b/virtinst/devices/controller.py
index c9d8b3e1..9d95f42b 100644
--- a/virtinst/devices/controller.py
+++ b/virtinst/devices/controller.py
@@ -19,6 +19,7 @@ class DeviceController(Device):
     TYPE_USB             = "usb"
     TYPE_PCI             = "pci"
     TYPE_CCID            = "ccid"
+    TYPE_XENBUS          = "xenbus"
 
     @staticmethod
     def get_recommended_types(_guest):
@@ -38,6 +39,7 @@ class DeviceController(Device):
             DeviceController.TYPE_USB:             "USB",
             DeviceController.TYPE_PCI:             "PCI",
             DeviceController.TYPE_CCID:            "CCID",
+            DeviceController.TYPE_XENBUS:          "xenbus",
        }
 
         if ctype not in pretty_mappings:
@@ -86,7 +88,7 @@ class DeviceController(Device):
         return ctrl
 
 
-    _XML_PROP_ORDER = ["type", "index", "model", "master_startport", "driver_queues"]
+    _XML_PROP_ORDER = ["type", "index", "model", "master_startport", "driver_queues", "maxGrantFrames"]
 
     type = XMLProperty("./@type")
     model = XMLProperty("./@model")
@@ -94,6 +96,7 @@ class DeviceController(Device):
     ports = XMLProperty("./@ports", is_int=True)
     master_startport = XMLProperty("./master/@startport", is_int=True)
     driver_queues = XMLProperty("./driver/@queues", is_int=True)
+    maxGrantFrames = XMLProperty("./@maxGrantFrames", is_int=True)
 
     index = XMLProperty("./@index", is_int=True)
 
-- 
2.21.0




More information about the virt-tools-list mailing list