render / rpms / libvirt

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