]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuDomainValidateStorageSource: Extract check for BLOCKDEV capability
authorPeter Krempa <pkrempa@redhat.com>
Tue, 5 May 2020 14:51:51 +0000 (16:51 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 12 May 2020 04:55:00 +0000 (06:55 +0200)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_domain.c

index 7c71b797bc9e9ff5a467578c29a84536376a6b7d..5cd516c6615ba15625b64a7b1e3c19e578edf8c0 100644 (file)
@@ -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;