[PATCH 20/22] qemuValidateDomainDeviceDefAddress: Add validation of CCW address

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

 



Base the check on the logic from qemuDomainCheckCCWS390AddressSupport,
which will be removed later.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_validate.c | 20 ++++++++++++++++++--
 tests/qemuxml2argvtest.c |  2 +-
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 16f77611c8..b4f012253b 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -1276,6 +1276,7 @@ qemuValidateDomainDeviceDefZPCIAddress(virDomainDeviceInfo *info,

 static int
 qemuValidateDomainDeviceDefAddress(const virDomainDeviceDef *dev,
+                                   const virDomainDef *def,
                                    virQEMUCaps *qemuCaps)
 {
     virDomainDeviceInfo *info;
@@ -1314,11 +1315,26 @@ qemuValidateDomainDeviceDefAddress(const virDomainDeviceDef *dev,
                        _("'virtio-s390' addresses are no longer supported"));
         return -1;

+    case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW:
+        if (!qemuDomainIsS390CCW(def)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("cannot use CCW address type for device '%s' using machine type '%s'"),
+                           NULLSTR(info->alias), def->os.machine);
+            return -1;
+        }
+
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCW)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("CCW address type is not supported by this QEMU"));
+            return -1;
+        }
+
+        break;
+
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE:
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL:
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID:
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB:
-    case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW:
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO:
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA:
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM:
@@ -5006,7 +5022,7 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev,
         qemuCaps = qemuCapsLocal;
     }

-    if ((ret = qemuValidateDomainDeviceDefAddress(dev, qemuCaps)) < 0)
+    if ((ret = qemuValidateDomainDeviceDefAddress(dev, def, qemuCaps)) < 0)
         return ret;

     switch ((virDomainDeviceType)dev->type) {
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1345c42b72..7a6ddc632c 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1893,7 +1893,7 @@ mymain(void)
     DO_TEST("balloon-device-deflate",
             QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
     DO_TEST("balloon-ccw-deflate",
-            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
+            QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE, QEMU_CAPS_CCW);
     DO_TEST("balloon-mmio-deflate",
             QEMU_CAPS_DEVICE_VIRTIO_MMIO,
             QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE);
-- 
2.31.1




[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]

  Powered by Linux