guest: Use usb3 qemu-xhci for machvirt

This is what libvirt will default to nowadays for those configs,
so let's match it.
This commit is contained in:
Cole Robinson 2017-07-10 19:40:19 -04:00
parent a51929fcd3
commit f41844f3f2
13 changed files with 26 additions and 21 deletions

View File

@ -28,7 +28,7 @@
<target dev="sdb" bus="scsi"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="nec-xhci" ports="8"/>
<controller type="usb" index="0" model="qemu-xhci" ports="8"/>
<controller type="scsi" index="0" model="virtio-scsi"/>
<interface type="bridge">
<source bridge="eth0"/>
@ -65,7 +65,7 @@
<target dev="sdb" bus="scsi"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="nec-xhci" ports="8"/>
<controller type="usb" index="0" model="qemu-xhci" ports="8"/>
<controller type="scsi" index="0" model="virtio-scsi"/>
<interface type="bridge">
<source bridge="eth0"/>

View File

@ -13,7 +13,7 @@
<clock offset="utc"/>
<devices>
<emulator>/usr/bin/qemu-system-aarch64</emulator>
<controller type="usb" index="0" model="nec-xhci" ports="8"/>
<controller type="usb" index="0" model="qemu-xhci" ports="8"/>
<input type="tablet" bus="usb"/>
<input type="keyboard" bus="usb"/>
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">

View File

@ -24,7 +24,7 @@
<controller type="scsi" index="0" model="virtio-scsi">
<address type="pci"/>
</controller>
<controller type="usb" index="0" model="nec-xhci" ports="8"/>
<controller type="usb" index="0" model="qemu-xhci" ports="8"/>
<interface type="network">
<source network="default"/>
<mac address="00:11:22:33:44:55"/>

View File

@ -18,7 +18,7 @@
<source file="/dev/default-pool/testvol1.img"/>
<target dev="sda" bus="scsi"/>
</disk>
<controller type="usb" index="0" model="nec-xhci" ports="8"/>
<controller type="usb" index="0" model="qemu-xhci" ports="8"/>
<controller type="scsi" index="0" model="virtio-scsi"/>
<interface type="bridge">
<source bridge="eth0"/>

View File

@ -21,7 +21,7 @@
<source file="/dev/default-pool/testvol1.img"/>
<target dev="sda" bus="scsi"/>
</disk>
<controller type="usb" index="0" model="nec-xhci" ports="8"/>
<controller type="usb" index="0" model="qemu-xhci" ports="8"/>
<controller type="scsi" index="0" model="virtio-scsi"/>
<interface type="bridge">
<source bridge="eth0"/>

View File

@ -21,7 +21,7 @@
<source file="/dev/default-pool/testvol1.img"/>
<target dev="sda" bus="scsi"/>
</disk>
<controller type="usb" index="0" model="nec-xhci" ports="8"/>
<controller type="usb" index="0" model="qemu-xhci" ports="8"/>
<controller type="scsi" index="0" model="virtio-scsi"/>
<interface type="bridge">
<source bridge="eth0"/>

View File

@ -18,7 +18,7 @@
<source file="/dev/default-pool/testvol1.img"/>
<target dev="sda" bus="scsi"/>
</disk>
<controller type="usb" index="0" model="nec-xhci" ports="8"/>
<controller type="usb" index="0" model="qemu-xhci" ports="8"/>
<controller type="scsi" index="0" model="virtio-scsi"/>
<interface type="bridge">
<source bridge="eth0"/>

View File

@ -17,7 +17,7 @@
<source file="/dev/default-pool/testvol1.img"/>
<target dev="sda" bus="scsi"/>
</disk>
<controller type="usb" index="0" model="nec-xhci" ports="8"/>
<controller type="usb" index="0" model="qemu-xhci" ports="8"/>
<controller type="scsi" index="0" model="virtio-scsi"/>
<interface type="bridge">
<source bridge="eth0"/>

View File

@ -18,7 +18,7 @@
<source file="/dev/default-pool/testvol1.img"/>
<target dev="sda" bus="scsi"/>
</disk>
<controller type="usb" index="0" model="nec-xhci" ports="8"/>
<controller type="usb" index="0" model="qemu-xhci" ports="8"/>
<controller type="scsi" index="0" model="virtio-scsi"/>
<interface type="bridge">
<source bridge="eth0"/>

View File

@ -745,17 +745,17 @@ c.add_compare("--os-variant fedora20 --nodisks --boot network --nographics --arc
# armv7l tests
c.add_compare("--arch armv7l --machine vexpress-a9 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,dtb=/f19-arm.dtb,extra_args=\"console=ttyAMA0 rw root=/dev/mmcblk0p3\" --disk %(EXISTIMG1)s --nographics", "arm-vexpress-plain")
c.add_compare("--arch armv7l --machine vexpress-a15 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,dtb=/f19-arm.dtb,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\" --disk %(EXISTIMG1)s --nographics --os-variant fedora19", "arm-vexpress-f19")
c.add_compare("--arch armv7l --machine virt --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\" --disk %(EXISTIMG1)s --nographics --os-variant fedora20", "arm-virt-f20")
c.add_compare("--arch armv7l --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s --os-variant fedora20", "arm-defaultmach-f20")
c.add_compare("--connect %(URI-KVM-ARMV7L)s --disk %(EXISTIMG1)s --import --os-variant fedora20", "arm-kvm-import")
c.add_compare("--arch armv7l --machine virt --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\" --disk %(EXISTIMG1)s --nographics --os-variant fedora20", "arm-virt-f20", compare_check=support.SUPPORT_CONN_QEMU_XHCI)
c.add_compare("--arch armv7l --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s --os-variant fedora20", "arm-defaultmach-f20", compare_check=support.SUPPORT_CONN_QEMU_XHCI)
c.add_compare("--connect %(URI-KVM-ARMV7L)s --disk %(EXISTIMG1)s --import --os-variant fedora20", "arm-kvm-import", compare_check=support.SUPPORT_CONN_QEMU_XHCI)
# aarch64 tests
c.add_compare("--arch aarch64 --machine virt --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\" --disk %(EXISTIMG1)s", "aarch64-machvirt")
c.add_compare("--arch aarch64 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\" --disk %(EXISTIMG1)s", "aarch64-machdefault")
c.add_compare("--arch aarch64 --cdrom %(EXISTIMG2)s --boot loader=CODE.fd,nvram_template=VARS.fd --disk %(EXISTIMG1)s --cpu none --events on_crash=preserve,on_reboot=destroy,on_poweroff=restart", "aarch64-cdrom")
c.add_compare("--connect %(URI-KVM-AARCH64)s --disk %(EXISTIMG1)s --import --os-variant fedora21", "aarch64-kvm-import")
c.add_compare("--connect %(URI-KVM-AARCH64)s --disk size=1 --os-variant fedora22 --features gic_version=host --network network=default,address.type=pci --controller type=scsi,model=virtio-scsi,address.type=pci", "aarch64-kvm-gic")
c.add_compare("--connect %(URI-KVM-AARCH64)s --disk none --network none --os-variant fedora25 --graphics spice", "aarch64-graphics")
c.add_compare("--arch aarch64 --machine virt --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\" --disk %(EXISTIMG1)s", "aarch64-machvirt", compare_check=support.SUPPORT_CONN_QEMU_XHCI)
c.add_compare("--arch aarch64 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\" --disk %(EXISTIMG1)s", "aarch64-machdefault", compare_check=support.SUPPORT_CONN_QEMU_XHCI)
c.add_compare("--arch aarch64 --cdrom %(EXISTIMG2)s --boot loader=CODE.fd,nvram_template=VARS.fd --disk %(EXISTIMG1)s --cpu none --events on_crash=preserve,on_reboot=destroy,on_poweroff=restart", "aarch64-cdrom", compare_check=support.SUPPORT_CONN_QEMU_XHCI)
c.add_compare("--connect %(URI-KVM-AARCH64)s --disk %(EXISTIMG1)s --import --os-variant fedora21", "aarch64-kvm-import", compare_check=support.SUPPORT_CONN_QEMU_XHCI)
c.add_compare("--connect %(URI-KVM-AARCH64)s --disk size=1 --os-variant fedora22 --features gic_version=host --network network=default,address.type=pci --controller type=scsi,model=virtio-scsi,address.type=pci", "aarch64-kvm-gic", compare_check=support.SUPPORT_CONN_QEMU_XHCI)
c.add_compare("--connect %(URI-KVM-AARCH64)s --disk none --network none --os-variant fedora25 --graphics spice", "aarch64-graphics", compare_check=support.SUPPORT_CONN_QEMU_XHCI)
# ppc64 tests
c.add_compare("--arch ppc64 --machine pseries --boot network --disk %(EXISTIMG1)s --disk device=cdrom --os-variant fedora20 --network none", "ppc64-pseries-f20")

View File

@ -82,10 +82,13 @@ class VirtualController(VirtualDevice):
return ret
@staticmethod
def get_usb3_controller(conn):
def get_usb3_controller(conn, guest):
ctrl = VirtualController(conn)
ctrl.type = "usb"
ctrl.model = "nec-xhci"
if ((guest.os.is_arm_machvirt() or guest.os.is_pseries()) and
conn.check_support(conn.SUPPORT_CONN_QEMU_XHCI)):
ctrl.model = "qemu-xhci"
if conn.check_support(conn.SUPPORT_CONN_USB3_PORTS):
ctrl.ports = 8
return ctrl

View File

@ -695,7 +695,8 @@ class Guest(XMLBuilder):
self.add_device(dev)
if usb3:
self.add_device(VirtualController.get_usb3_controller(self.conn))
self.add_device(
VirtualController.get_usb3_controller(self.conn, self))
def add_default_channels(self):
if self.skip_default_channel:

View File

@ -323,6 +323,7 @@ SUPPORT_CONN_GRAPHICS_LISTEN_NONE = _make(version="2.0.0")
SUPPORT_CONN_RNG_URANDOM = _make(version="1.3.4")
SUPPORT_CONN_USB3_PORTS = _make(version="1.3.5")
SUPPORT_CONN_MACHVIRT_PCI_DEFAULT = _make(version="3.0.0")
SUPPORT_CONN_QEMU_XHCI = _make(version="3.3.0")
# This is for disk <driver name=qemu>. xen supports this, but it's