[PATCH 72/80] qemuDomainValidateStorageSource: Remove QEMU_CAPS_BLOCKDEV validation

Peter Krempa pkrempa at redhat.com
Tue Jul 26 14:37:50 UTC 2022


While we assume that -blockdev is supported the validator had also some
corner cases for -drive. Since we use '-drive' exclusively for the
extremely rarely used SD cards it makes no sense to have the validation.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_domain.c | 60 +++---------------------------------------
 1 file changed, 3 insertions(+), 57 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 8997041b34..0839744660 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4811,13 +4811,9 @@ qemuDomainValidateActualNetDef(const virDomainNetDef *net,
 int
 qemuDomainValidateStorageSource(virStorageSource *src,
                                 virQEMUCaps *qemuCaps,
-                                bool maskBlockdev)
+                                bool maskBlockdev G_GNUC_UNUSED)
 {
     virStorageType actualType = virStorageSourceGetActualType(src);
-    bool blockdev = virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV);
-
-    if (maskBlockdev)
-        blockdev = false;

     if (src->format == VIR_STORAGE_FILE_COW) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -4870,17 +4866,6 @@ qemuDomainValidateStorageSource(virStorageSource *src,
         return -1;
     }

-    if (src->sliceStorage) {
-        /* In pre-blockdev era we can't configure the slice so we can allow them
-         * only for detected backing store entries as they are populated
-         * from a place that qemu would be able to read */
-        if (!src->detected && !blockdev) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("storage slice is not supported by this QEMU binary"));
-            return -1;
-        }
-    }
-
     if (src->sslverify != VIR_TRISTATE_BOOL_ABSENT) {
         if (actualType != VIR_STORAGE_TYPE_NETWORK ||
             (src->protocol != VIR_STORAGE_NET_PROTOCOL_HTTPS &&
@@ -4889,12 +4874,6 @@ qemuDomainValidateStorageSource(virStorageSource *src,
                            _("ssl verification is supported only with HTTPS/FTPS protocol"));
             return -1;
         }
-
-        if (!src->detected && !blockdev) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("ssl verification setting is not supported by this QEMU binary"));
-            return -1;
-        }
     }

     if (src->ncookies > 0) {
@@ -4906,12 +4885,6 @@ qemuDomainValidateStorageSource(virStorageSource *src,
             return -1;
         }

-        if (!src->detected && !blockdev) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("http cookies are not supported by this QEMU binary"));
-            return -1;
-        }
-
         if (virStorageSourceNetCookiesValidate(src) < 0)
             return -1;
     }
@@ -4926,12 +4899,6 @@ qemuDomainValidateStorageSource(virStorageSource *src,
                            _("readahead is supported only with HTTP(S)/FTP(s) protocols"));
             return -1;
         }
-
-        if (!src->detected && !blockdev) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("readahead setting is not supported with this QEMU binary"));
-            return -1;
-        }
     }

     if (src->timeout > 0) {
@@ -4944,12 +4911,6 @@ qemuDomainValidateStorageSource(virStorageSource *src,
                            _("timeout is supported only with HTTP(S)/FTP(s) protocols"));
             return -1;
         }
-
-        if (!src->detected && !blockdev) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("timeout setting is not supported with this QEMU binary"));
-            return -1;
-        }
     }

     if (src->query &&
@@ -4961,11 +4922,9 @@ qemuDomainValidateStorageSource(virStorageSource *src,
         return -1;
     }

-    /* TFTP protocol was not supported for some time, lock it out at least with
-     * -blockdev */
+    /* TFTP protocol was not supported */
     if (actualType == VIR_STORAGE_TYPE_NETWORK &&
-        src->protocol == VIR_STORAGE_NET_PROTOCOL_TFTP &&
-        blockdev) {
+        src->protocol == VIR_STORAGE_NET_PROTOCOL_TFTP) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("'tftp' protocol is not supported with this QEMU binary"));
         return -1;
@@ -4973,13 +4932,6 @@ qemuDomainValidateStorageSource(virStorageSource *src,

     if (actualType == VIR_STORAGE_TYPE_NETWORK &&
         src->protocol == VIR_STORAGE_NET_PROTOCOL_NFS) {
-        /* NFS protocol may only be used if current QEMU supports blockdev */
-        if (!blockdev) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("'nfs' protocol is not supported with this QEMU binary"));
-            return -1;
-        }
-
         /* NFS protocol must have exactly one host */
         if (src->nhosts != 1) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -5009,12 +4961,6 @@ qemuDomainValidateStorageSource(virStorageSource *src,
                            _("metadata cache max size control is supported only with qcow2 images"));
             return -1;
         }
-
-        if (!blockdev) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("metadata cache max size control is not supported with this QEMU binary"));
-            return -1;
-        }
     }

     if (src->encryption) {
-- 
2.36.1



More information about the libvir-list mailing list