Re: [PATCH] Fix USB model defaults for ppc64

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

 



On Fri, Jan 08, 2016 at 01:53:59PM +0100, Martin Kletzander wrote:
The condition was checking for UHCI (and OHCI for ppc64) availability so
that it can specify the proper device instead of legacy usb.  However,
for ppc64, we don't need to check both OHCI and UHCI, but only OHCI as
that is the legacy default.  The condition is so big that it was just a
matter of time when someone will make a mistake there, so let's use more
lines so that it is visible what the condition checks for.

This fixes usage of -device instead of -usb for ppc64 that supports
pci-usb-ohci and does not support piix3-usb-uhci.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
src/qemu/qemu_command.c                            | 34 +++++++++++++++-------
.../qemuxml2argv-ppc64-usb-controller-legacy.args  | 20 +++++++++++++
.../qemuxml2argv-ppc64-usb-controller-legacy.xml   |  1 +
.../qemuxml2argv-ppc64-usb-controller.args         | 20 +++++++++++++
.../qemuxml2argv-ppc64-usb-controller.xml          | 28 ++++++++++++++++++
tests/qemuxml2argvtest.c                           |  3 ++
6 files changed, 95 insertions(+), 11 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-legacy.args
create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-legacy.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.xml


This is perfect example of how to do things wrong if you forget
something.  As you can see, I created the *.args files to be the same
and wanted to change the non-legacy one after everything compiles and
the test fails.  But I forgot about that and after I've done some
additional changes to the code, I forgot that I need to tune one of the
files and because none of the tests failed.  And of course it did not,
because I forgot to add the QEMU_CAPS_DEVICE capability.

So whenever someone will be reviewing this, the following diff needs to
be considered part of the patch.  It is already squashed into my local
commit.

diff --git i/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-legacy.args w/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-legacy.args
index 3dee41e86481..7d301f32bec7 100644
--- i/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-legacy.args
+++ w/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-legacy.args
@@ -12,9 +12,8 @@ QEMU_AUDIO_DRV=none \
-smp 1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-nographic \
+-nodefaults \
-monitor unix:/tmp/test-monitor,server,nowait \
-boot c \
-usb \
--net none \
--serial none \
--parallel none
+-device virtio-balloon-pci,id=balloon0,bus=pci,addr=0x6
diff --git i/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.args w/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.args
index 3dee41e86481..f17a377dfd6f 100644
--- i/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.args
+++ w/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.args
@@ -12,9 +12,8 @@ QEMU_AUDIO_DRV=none \
-smp 1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-nographic \
+-nodefaults \
-monitor unix:/tmp/test-monitor,server,nowait \
-boot c \
--usb \
--net none \
--serial none \
--parallel none
+-device pci-ohci,id=usb,bus=pci,addr=0x1 \
+-device virtio-balloon-pci,id=balloon0,bus=pci,addr=0x6
diff --git i/tests/qemuxml2argvtest.c w/tests/qemuxml2argvtest.c
index 1476def2f57d..e17dcc765870 100644
--- i/tests/qemuxml2argvtest.c
+++ w/tests/qemuxml2argvtest.c
@@ -1764,8 +1764,10 @@ mymain(void)
            QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_TABLET);
    DO_TEST("virtio-input-passthrough", QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_INPUT_HOST);

-    DO_TEST("ppc64-usb-controller", QEMU_CAPS_PCI_OHCI);
-    DO_TEST("ppc64-usb-controller-legacy", QEMU_CAPS_PIIX3_USB_UHCI);
+    DO_TEST("ppc64-usb-controller",
+            QEMU_CAPS_DEVICE, QEMU_CAPS_PCI_OHCI);
+    DO_TEST("ppc64-usb-controller-legacy",
+            QEMU_CAPS_DEVICE, QEMU_CAPS_PIIX3_USB_UHCI);

    qemuTestDriverFree(&driver);

--

Martin

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]