]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Move disk backend validation checks from qemuProcessStartValidateDisks to qemuD...
authorPeter Krempa <pkrempa@redhat.com>
Fri, 23 May 2025 14:05:34 +0000 (16:05 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 3 Jun 2025 11:11:02 +0000 (13:11 +0200)
Move the check forbidding VXHS disks and checking the NVME backend
capability to the validation code.

Remove the now unused qemuProcessStartValidateDisks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_process.c

index 11f08b8ded1532046252adee4f24a742676dd90d..230dc860380ce8780f18db269722e7d2a87f1db8 100644 (file)
@@ -4453,6 +4453,13 @@ qemuDomainValidateStorageSource(virStorageSource *src,
         }
     }
 
+    if (actualType == VIR_STORAGE_TYPE_NVME &&
+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_NVME)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("NVMe disks are not supported with this QEMU binary"));
+        return -1;
+    }
+
     if (src->pr &&
         !virQEMUCapsGet(qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -4528,7 +4535,6 @@ qemuDomainValidateStorageSource(virStorageSource *src,
     if (actualType == VIR_STORAGE_TYPE_NETWORK) {
         switch ((virStorageNetProtocol) src->protocol) {
         case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
-        case VIR_STORAGE_NET_PROTOCOL_VXHS:
         case VIR_STORAGE_NET_PROTOCOL_HTTP:
         case VIR_STORAGE_NET_PROTOCOL_HTTPS:
         case VIR_STORAGE_NET_PROTOCOL_FTP:
@@ -4564,6 +4570,7 @@ qemuDomainValidateStorageSource(virStorageSource *src,
             break;
 
         /* TFTP protocol is not supported since QEMU 2.8.0 */
+        case VIR_STORAGE_NET_PROTOCOL_VXHS:
         case VIR_STORAGE_NET_PROTOCOL_TFTP:
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("storage protocol '%1$s' is not supported by this QEMU"),
index 54b84922d6b9db82f88cfa2f955d9621e8a8eb26..c13a2844735cc0d079a809e7cdce293a95c0ef45 100644 (file)
@@ -5600,38 +5600,6 @@ qemuProcessStartValidateShmem(virDomainObj *vm)
 }
 
 
-static int
-qemuProcessStartValidateDisks(virDomainObj *vm,
-                              virQEMUCaps *qemuCaps)
-{
-    size_t i;
-
-    for (i = 0; i < vm->def->ndisks; i++) {
-        virDomainDiskDef *disk = vm->def->disks[i];
-        virStorageSource *src = disk->src;
-
-        /* This is a best effort check as we can only check if the command
-         * option exists, but we cannot determine whether the running QEMU
-         * was build with '--enable-vxhs'. */
-        if (src->type == VIR_STORAGE_TYPE_NETWORK &&
-            src->protocol == VIR_STORAGE_NET_PROTOCOL_VXHS) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("VxHS protocol is not supported with this QEMU binary"));
-            return -1;
-        }
-
-        if (src->type == VIR_STORAGE_TYPE_NVME &&
-            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_NVME)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("NVMe disks are not supported with this QEMU binary"));
-            return -1;
-        }
-    }
-
-    return 0;
-}
-
-
 /* 250 parts per million (ppm) is a half of NTP threshold */
 #define TSC_TOLERANCE 250
 
@@ -5768,9 +5736,6 @@ qemuProcessStartValidate(virQEMUDriver *driver,
         }
     }
 
-    if (qemuProcessStartValidateDisks(vm, qemuCaps) < 0)
-        return -1;
-
     if (qemuProcessStartValidateTSC(driver, vm) < 0)
         return -1;