]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: Make sure rom.file='' for PCI devices keeps working
authorAndrea Bolognani <abologna@redhat.com>
Mon, 23 Apr 2018 11:45:59 +0000 (13:45 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 23 Apr 2018 13:20:54 +0000 (15:20 +0200)
Even though we just introduced the rom.enabled attribute to
properly cover the use case, there might be guests out there
that use the only previously available way of disabling PCI
ROM loading by not opting in to schema validation.

To make sure such guests will keep working going forward,
introduce a test case covering the legacy workaround.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
tests/qemuxml2argvdata/pci-rom-disabled-invalid.args [new symlink]
tests/qemuxml2argvdata/pci-rom-disabled-invalid.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c
tests/qemuxml2xmloutdata/pci-rom-disabled-invalid.xml [new file with mode: 0644]
tests/qemuxml2xmltest.c

diff --git a/tests/qemuxml2argvdata/pci-rom-disabled-invalid.args b/tests/qemuxml2argvdata/pci-rom-disabled-invalid.args
new file mode 120000 (symlink)
index 0000000..0dffe3c
--- /dev/null
@@ -0,0 +1 @@
+pci-rom-disabled.args
\ No newline at end of file
diff --git a/tests/qemuxml2argvdata/pci-rom-disabled-invalid.xml b/tests/qemuxml2argvdata/pci-rom-disabled-invalid.xml
new file mode 100644 (file)
index 0000000..5ef58d0
--- /dev/null
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+  <name>guest</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='pci' model='pci-root'/>
+    <controller type='usb' model='none'/>
+    <interface type='user'>
+      <mac address='52:54:00:24:a5:9f'/>
+      <model type='virtio'/>
+      <!--
+      This method of disabling PCI ROM loading is still supported
+      for backwards compatibility reasons, but <rom enabled='no'/>
+      should be used instead.
+      -->
+      <rom file=''/>
+    </interface>
+    <memballoon model='none'/>
+  </devices>
+</domain>
index ae9893a84ea8374aa6835459f8bf105e4078ca74..5b3bd4a99649108aebaa350e8f00e975811ed5f8 100644 (file)
@@ -1555,6 +1555,7 @@ mymain(void)
             QEMU_CAPS_DEVICE_VFIO_PCI);
     DO_TEST("pci-rom", NONE);
     DO_TEST("pci-rom-disabled", NONE);
+    DO_TEST("pci-rom-disabled-invalid", NONE);
 
     DO_TEST_FULL("restore-v2", "exec:cat", 7, 0, 0, GIC_NONE, NONE);
     DO_TEST_FULL("restore-v2-fd", "stdio", 7, 0, 0, GIC_NONE, NONE);
diff --git a/tests/qemuxml2xmloutdata/pci-rom-disabled-invalid.xml b/tests/qemuxml2xmloutdata/pci-rom-disabled-invalid.xml
new file mode 100644 (file)
index 0000000..745d19d
--- /dev/null
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>guest</name>
+  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </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-x86_64</emulator>
+    <controller type='pci' index='0' model='pci-root'/>
+    <controller type='usb' index='0' model='none'/>
+    <interface type='user'>
+      <mac address='52:54:00:24:a5:9f'/>
+      <model type='virtio'/>
+      <rom file=''/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
index 6c1f0b0fa62f1fe8a8504997c37e69619b9c1bfd..4b5aa2315e5d61d46f8a2840aba09f7470ce4bbd 100644 (file)
@@ -475,6 +475,7 @@ mymain(void)
     DO_TEST("hostdev-mdev-precreated", NONE);
     DO_TEST("pci-rom", NONE);
     DO_TEST("pci-rom-disabled", NONE);
+    DO_TEST("pci-rom-disabled-invalid", NONE);
     DO_TEST("pci-serial-dev-chardev", NONE);
 
     DO_TEST("encrypted-disk", NONE);