[virt-tools-list] [virt-manager PATCH 8/9] guest: Enable USB for RISC-V virt guests
Andrea Bolognani
abologna at redhat.com
Thu Apr 4 10:49:49 UTC 2019
Unlike other features we have enabled earlier, this one requires
version checks because RISC-V guests have only started using PCI
by default very recently, and we can't have USB without PCI.
More specifically, we need QEMU commit d6c1bd4a2237 (included
in 4.0.0) and libvirt commit 7c48fb08e0cd (included in 5.3.0).
Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
.../compare/virt-install-riscv64-graphics.xml | 1 +
.../compare/virt-install-riscv64-headless.xml | 1 +
tests/clitest.py | 4 ++--
virtinst/guest.py | 8 ++++++++
virtinst/support.py | 1 +
5 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/tests/cli-test-xml/compare/virt-install-riscv64-graphics.xml b/tests/cli-test-xml/compare/virt-install-riscv64-graphics.xml
index 211c062e..2f5f0e7a 100644
--- a/tests/cli-test-xml/compare/virt-install-riscv64-graphics.xml
+++ b/tests/cli-test-xml/compare/virt-install-riscv64-graphics.xml
@@ -21,6 +21,7 @@
<source file="/dev/default-pool/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
+ <controller type="usb" index="0" model="qemu-xhci" ports="15"/>
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>
diff --git a/tests/cli-test-xml/compare/virt-install-riscv64-headless.xml b/tests/cli-test-xml/compare/virt-install-riscv64-headless.xml
index ba0a48b0..875a4214 100644
--- a/tests/cli-test-xml/compare/virt-install-riscv64-headless.xml
+++ b/tests/cli-test-xml/compare/virt-install-riscv64-headless.xml
@@ -21,6 +21,7 @@
<source file="/dev/default-pool/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
+ <controller type="usb" index="0" model="qemu-xhci" ports="15"/>
<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 a7fc12a6..693b6a6e 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -811,7 +811,7 @@ c.add_compare("--connect %(URI-KVM-AARCH64)s --disk size=1 --os-variant fedora22
c = vinst.add_category("kvm-headless", "--os-variant fedora29 --import --disk %(EXISTIMG1)s --network default --graphics none")
c.add_compare("--connect %(URI-KVM-AARCH64)s --arch aarch64", "aarch64-headless")
c.add_compare("--connect %(URI-KVM-PPC64LE)s --arch ppc64le", "ppc64-headless")
-c.add_compare("--connect %(URI-QEMU-RISCV64)s --arch riscv64", "riscv64-headless")
+c.add_compare("--connect %(URI-QEMU-RISCV64)s --arch riscv64", "riscv64-headless", check_version="5.3.0")
c.add_compare("--connect %(URI-KVM-S390X)s --arch s390x", "s390x-headless")
c.add_compare("--connect %(URI-KVM)s --arch x86_64", "x86_64-headless")
@@ -820,7 +820,7 @@ c.add_compare("--connect %(URI-KVM)s --arch x86_64", "x86_64-headless")
c = vinst.add_category("kvm-graphics", "--os-variant fedora29 --import --disk %(EXISTIMG1)s --network default --graphics vnc")
c.add_compare("--connect %(URI-KVM-AARCH64)s --arch aarch64", "aarch64-graphics")
c.add_compare("--connect %(URI-KVM-PPC64LE)s --arch ppc64le", "ppc64-graphics")
-c.add_compare("--connect %(URI-QEMU-RISCV64)s --arch riscv64", "riscv64-graphics")
+c.add_compare("--connect %(URI-QEMU-RISCV64)s --arch riscv64", "riscv64-graphics", check_version="5.3.0")
c.add_compare("--connect %(URI-KVM-S390X)s --arch s390x", "s390x-graphics")
c.add_compare("--connect %(URI-KVM)s --arch x86_64", "x86_64-graphics")
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 7249686e..9d38859c 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -784,6 +784,14 @@ class Guest(XMLBuilder):
self.conn.check_support(
self.conn.SUPPORT_CONN_MACHVIRT_PCI_DEFAULT)):
usb3 = True
+ elif self.os.is_riscv_virt():
+ # For RISC-V we can assume the guest OS supports USB3, but we
+ # have to make sure libvirt and QEMU are new enough to be using
+ # PCI by default
+ if (qemu_usb3 and
+ self.conn.check_support(
+ self.conn.SUPPORT_CONN_RISCV_VIRT_PCI_DEFAULT)):
+ usb3 = True
elif self.os.is_pseries():
# For pseries, we always assume OS supports usb3
if qemu_usb3:
diff --git a/virtinst/support.py b/virtinst/support.py
index 7ace3ef6..015a01b7 100644
--- a/virtinst/support.py
+++ b/virtinst/support.py
@@ -265,6 +265,7 @@ SUPPORT_CONN_MACHVIRT_PCI_DEFAULT = _make(version="3.0.0")
SUPPORT_CONN_QEMU_XHCI = _make(version="3.3.0", hv_version={"qemu": "2.9.0"})
SUPPORT_CONN_VNC_NONE_AUTH = _make(hv_version={"qemu": "2.9.0"})
SUPPORT_CONN_DEVICE_BOOT_ORDER = _make(hv_version={"qemu": 0, "test": 0})
+SUPPORT_CONN_RISCV_VIRT_PCI_DEFAULT = _make(version="5.3.0", hv_version={"qemu": "4.0.0"})
# We choose qemu 2.11.0 as the first version to target for q35 default.
# That's not really based on anything except reasonably modern at the
--
2.20.1
More information about the virt-tools-list
mailing list