]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: don't assign a PCI address to 'none' USB controller
authorJán Tomko <jtomko@redhat.com>
Fri, 26 Apr 2013 17:52:43 +0000 (19:52 +0200)
committerJán Tomko <jtomko@redhat.com>
Fri, 26 Apr 2013 18:06:01 +0000 (20:06 +0200)
Adjust the usb-none test, since it gives the memballoon a lower PCI slot now.
Add a test for 'none' controller on s390, which doesn't have PCI buses.

src/qemu/qemu_command.c
tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.xml [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-usb-none.args
tests/qemuxml2argvtest.c

index 2ce06725bf42f8ca5e483613a57fd67dad04839c..2d2fe40e7fba0b78d7041b15468f96817ad9222a 100644 (file)
@@ -1917,6 +1917,11 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
         if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI)
             continue;
 
+        /* USB controller model 'none' doesn't need a PCI address */
+        if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
+            def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE)
+            continue;
+
         /* FDC lives behind the ISA bridge; CCID is a usb device */
         if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_FDC ||
             def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_CCID)
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.args b/tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.args
new file mode 100644 (file)
index 0000000..753d84f
--- /dev/null
@@ -0,0 +1,11 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
+/usr/bin/qemu-system-s390x -S -M s390-virtio -m 214 -smp 1 \
+-nographic -nodefconfig -nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline -no-acpi \
+-device virtio-serial-s390,id=virtio-serial0 \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-s390,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
+-chardev pty,id=charconsole0 \
+-device virtconsole,chardev=charconsole0,id=console0 \
+-object rng-random,id=rng0,filename=/dev/hwrng -device virtio-rng-s390,rng=rng0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.xml b/tests/qemuxml2argvdata/qemuxml2argv-s390-usb-none.xml
new file mode 100644 (file)
index 0000000..f2977b5
--- /dev/null
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>test</name>
+  <memory>219100</memory>
+  <currentMemory>219100</currentMemory>
+  <os>
+    <type arch='s390x' machine='s390-virtio'>hvm</type>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+      <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='virtio'/>
+      <boot order='1'/>
+    </disk>
+    <console type='pty'>
+      <target type='virtio'/>
+    </console>
+    <controller type='usb' index='0' model='none'/>
+    <memballoon model='virtio'>
+    </memballoon>
+    <rng model='virtio'>
+      <backend model='random'>/dev/hwrng</backend>
+    </rng>
+  </devices>
+</domain>
index 085b66f3f8fd2950c1b4f6d171c61fbda42ac97a..09b66b899e90464bbc5870f47de3b1f8471f08b1 100644 (file)
@@ -2,4 +2,4 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S \
 -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults \
 -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
 -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c \
--device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
index 7c4d1ce686bd9ae28f0c4f1d2acb590449393484..88d786ef9a98318b2cb86b6f5730ba1c924755cc 100644 (file)
@@ -955,6 +955,11 @@ mymain(void)
             QEMU_CAPS_VIRTIO_S390, QEMU_CAPS_DEVICE_VIRTIO_RNG,
             QEMU_CAPS_OBJECT_RNG_RANDOM);
 
+    DO_TEST("s390-usb-none",
+            QEMU_CAPS_DEVICE, QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_DRIVE, QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_S390,
+            QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
+
     DO_TEST("ppc-dtb", QEMU_CAPS_KVM, QEMU_CAPS_DTB);
 
     DO_TEST("tpm-passthrough", QEMU_CAPS_DEVICE,