libvirt/SOURCES/libvirt-qemuDomainValidateStorageSource-Reject-unsupported-slices.patch
2021-10-08 13:11:20 +00:00

53 lines
1.8 KiB
Diff

From 038231283c69bf7c9c9fadd2157f53f8b3f719d3 Mon Sep 17 00:00:00 2001
Message-Id: <038231283c69bf7c9c9fadd2157f53f8b3f719d3@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 19 Feb 2020 15:10:17 +0100
Subject: [PATCH] qemuDomainValidateStorageSource: Reject unsupported slices
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
(cherry picked from commit a6eeda986e458e6746268069b1f610c27e89d6e2)
https://bugzilla.redhat.com/show_bug.cgi?id=1791788
Message-Id: <10cfef14fcb49c7daef4f869d622ebdf3aa6a4d5.1582120424.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_domain.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index cf069e2b79..7b414b79c7 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6936,6 +6936,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;
}
--
2.25.0