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