[PATCH 13/20] qemuDomainValidateStorageSource: Extract check for BLOCKDEV capability

Peter Krempa pkrempa at redhat.com
Wed May 6 12:08:28 UTC 2020


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

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 9c629c31a3..e76a76021e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5140,6 +5140,7 @@ qemuDomainValidateStorageSource(virStorageSourcePtr src,
                                 virQEMUCapsPtr qemuCaps)
 {
     int actualType = virStorageSourceGetActualType(src);
+    bool blockdev = virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV);

     if (src->format == VIR_STORAGE_FILE_COW) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -5224,8 +5225,7 @@ qemuDomainValidateStorageSource(virStorageSourcePtr src,
         /* 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 &&
-            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
+        if (!src->detected && !blockdev) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("storage slice is not supported by this QEMU binary"));
             return -1;
@@ -5241,8 +5241,7 @@ qemuDomainValidateStorageSource(virStorageSourcePtr src,
             return -1;
         }

-        if (!src->detected &&
-            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
+        if (!src->detected && !blockdev) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("ssl verification setting is not supported by this QEMU binary"));
             return -1;
@@ -5258,8 +5257,7 @@ qemuDomainValidateStorageSource(virStorageSourcePtr src,
             return -1;
         }

-        if (!src->detected &&
-            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
+        if (!src->detected && !blockdev) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("http cookies are not supported by this QEMU binary"));
             return -1;
@@ -5280,8 +5278,7 @@ qemuDomainValidateStorageSource(virStorageSourcePtr src,
             return -1;
         }

-        if (!src->detected &&
-            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
+        if (!src->detected && !blockdev) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("readahead setting is not supported with this QEMU binary"));
             return -1;
@@ -5299,8 +5296,7 @@ qemuDomainValidateStorageSource(virStorageSourcePtr src,
             return -1;
         }

-        if (!src->detected &&
-            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
+        if (!src->detected && !blockdev) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("timeout setting is not supported with this QEMU binary"));
             return -1;
-- 
2.26.2




More information about the libvir-list mailing list