]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuDomainValidateStorageSource: Reject unsupported slices
authorPeter Krempa <pkrempa@redhat.com>
Wed, 5 Feb 2020 13:51:12 +0000 (14:51 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 14 Feb 2020 15:32:21 +0000 (16:32 +0100)
We support explicit storage slices only when using blockdev. Storage
slices expressed via the backing store string are left to qemu to
open correctly.

Reject storage slices configured via the XML for non-blockdev usage.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_domain.c

index 14e8c38c7bab3f281c2ec3b1fcf1ac1d2ae4e720..69f15d2078bc17410f530a6903195153e04c05bb 100644 (file)
@@ -6862,6 +6862,18 @@ qemuDomainValidateStorageSource(virStorageSourcePtr 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 &&
+            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("storage slice is not supported by this QEMU binary"));
+            return -1;
+        }
+    }
+
     return 0;
 }