On Thu, Mar 29, 2018 at 01:51:07PM +0200, Peter Krempa wrote:
Reject configurations when qemu would not support the image.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_domain.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index e02da9e608..cbad7d0f4c 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4109,7 +4109,8 @@ qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video)
static int
-qemuDomainValidateStorageSource(virStorageSourcePtr src)
+qemuDomainValidateStorageSource(virStorageSourcePtr src,
+ virQEMUCapsPtr qemuCaps)
{
if (src->format == VIR_STORAGE_FILE_COW) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -4131,12 +4132,22 @@ qemuDomainValidateStorageSource(virStorageSourcePtr src)
return -1;
}
+ if (src->format == VIR_STORAGE_FILE_QCOW2 &&
+ src->encryption &&
+ src->encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_QCOW2_LUKS)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("LUKS encrypted QCOW2 images are not suppored by this
qemu"));
s/qemu/QEMU/
ACK
Jano