d76c62
From 038231283c69bf7c9c9fadd2157f53f8b3f719d3 Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <038231283c69bf7c9c9fadd2157f53f8b3f719d3@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Wed, 19 Feb 2020 15:10:17 +0100
d76c62
Subject: [PATCH] qemuDomainValidateStorageSource: Reject unsupported slices
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
We support explicit storage slices only when using blockdev. Storage
d76c62
slices expressed via the backing store string are left to qemu to
d76c62
open correctly.
d76c62
d76c62
Reject storage slices configured via the XML for non-blockdev usage.
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
(cherry picked from commit a6eeda986e458e6746268069b1f610c27e89d6e2)
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1791788
d76c62
Message-Id: <10cfef14fcb49c7daef4f869d622ebdf3aa6a4d5.1582120424.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_domain.c | 12 ++++++++++++
d76c62
 1 file changed, 12 insertions(+)
d76c62
d76c62
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
d76c62
index cf069e2b79..7b414b79c7 100644
d76c62
--- a/src/qemu/qemu_domain.c
d76c62
+++ b/src/qemu/qemu_domain.c
d76c62
@@ -6936,6 +6936,18 @@ qemuDomainValidateStorageSource(virStorageSourcePtr src,
d76c62
         return -1;
d76c62
     }
d76c62
 
d76c62
+    if (src->sliceStorage) {
d76c62
+        /* In pre-blockdev era we can't configure the slice so we can allow them
d76c62
+         * only for detected backing store entries as they are populated
d76c62
+         * from a place that qemu would be able to read */
d76c62
+        if (!src->detected &&
d76c62
+            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
d76c62
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
d76c62
+                           _("storage slice is not supported by this QEMU binary"));
d76c62
+            return -1;
d76c62
+        }
d76c62
+    }
d76c62
+
d76c62
     return 0;
d76c62
 }
d76c62
 
d76c62
-- 
d76c62
2.25.0
d76c62