From: Peter Krempa <pkre...@redhat.com>

Move the validation from qemuProcessStartValidateDisks to
qemuValidateDomainDeviceDefDiskFrontend and adjust the test case which
now fails a bit earlier, thus no output XML is needed.

Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
 src/qemu/qemu_process.c                       |  7 ---
 src/qemu/qemu_validate.c                      |  7 +++
 .../disk-floppy-pseries.ppc64-latest.xml      | 44 -------------------
 tests/qemuxmlconftest.c                       |  2 +-
 4 files changed, 8 insertions(+), 52 deletions(-)
 delete mode 100644 tests/qemuxmlconfdata/disk-floppy-pseries.ppc64-latest.xml

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 7e444bb8b4..54b84922d6 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5620,13 +5620,6 @@ qemuProcessStartValidateDisks(virDomainObj *vm,
             return -1;
         }

-        if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
-            !qemuDomainMachineSupportsFloppy(vm->def->os.machine, qemuCaps)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("this machine type do not support floppy 
devices"));
-            return -1;
-        }
-
         if (src->type == VIR_STORAGE_TYPE_NVME &&
             !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_NVME)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 87588024ce..e45f636418 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -3008,6 +3008,13 @@ qemuValidateDomainDeviceDefDiskFrontend(const 
virDomainDiskDef *disk,
         return -1;
     }

+    if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
+        !qemuDomainMachineSupportsFloppy(def->os.machine, qemuCaps)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("this machine type do not support floppy devices"));
+        return -1;
+    }
+
     if (disk->copy_on_read == VIR_TRISTATE_SWITCH_ON) {
         if (disk->src->readonly) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
diff --git a/tests/qemuxmlconfdata/disk-floppy-pseries.ppc64-latest.xml 
b/tests/qemuxmlconfdata/disk-floppy-pseries.ppc64-latest.xml
deleted file mode 100644
index 9a5490c9fe..0000000000
--- a/tests/qemuxmlconfdata/disk-floppy-pseries.ppc64-latest.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<domain type='qemu'>
-  <name>QEMUGuest1</name>
-  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
-  <memory unit='KiB'>219136</memory>
-  <currentMemory unit='KiB'>219136</currentMemory>
-  <vcpu placement='static'>1</vcpu>
-  <os>
-    <type arch='ppc64' machine='pseries'>hvm</type>
-    <boot dev='hd'/>
-  </os>
-  <cpu mode='custom' match='exact' check='none'>
-    <model fallback='forbid'>POWER10</model>
-  </cpu>
-  <clock offset='utc'/>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>destroy</on_crash>
-  <devices>
-    <emulator>/usr/bin/qemu-system-ppc64</emulator>
-    <disk type='block' device='floppy'>
-      <driver name='qemu' type='raw'/>
-      <source dev='/dev/fd0'/>
-      <target dev='fda' bus='fdc'/>
-      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
-    </disk>
-    <disk type='file' device='floppy'>
-      <driver name='qemu' type='raw'/>
-      <source file='/tmp/firmware.img'/>
-      <target dev='fdb' bus='fdc'/>
-      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
-    </disk>
-    <controller type='usb' index='0' model='pci-ohci'>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' 
function='0x0'/>
-    </controller>
-    <controller type='fdc' index='0'/>
-    <controller type='pci' index='0' model='pci-root'>
-      <model name='spapr-pci-host-bridge'/>
-      <target index='0'/>
-    </controller>
-    <audio id='1' type='none'/>
-    <memballoon model='none'/>
-    <panic model='pseries'/>
-  </devices>
-</domain>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 9ec3efdd88..9a29262d1b 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -1551,7 +1551,7 @@ mymain(void)
     DO_TEST_CAPS_LATEST("disk-cdrom-tray");
     DO_TEST_CAPS_LATEST("disk-floppy");
     DO_TEST_CAPS_LATEST("disk-floppy-q35");
-    DO_TEST_CAPS_ARCH_LATEST_FAILURE("disk-floppy-pseries", "ppc64");
+    DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("disk-floppy-pseries", "ppc64");
     DO_TEST_CAPS_LATEST("disk-floppy-tray");
     DO_TEST_CAPS_LATEST("disk-virtio");
     DO_TEST_CAPS_ARCH_LATEST("disk-virtio-ccw", "s390x");
-- 
2.49.0

Reply via email to