render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
6ae9ed
From dbc094900f3de46bb9ef9250ae314c2b52e79297 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <dbc094900f3de46bb9ef9250ae314c2b52e79297@dist-git>
6ae9ed
From: John Ferlan <jferlan@redhat.com>
6ae9ed
Date: Mon, 25 Jul 2016 12:43:05 -0400
6ae9ed
Subject: [PATCH] storage: Add extra failure condition for luks volume creation
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1301021
6ae9ed
6ae9ed
Commit id '5e46d7d6' did not take into account that usage of a luks
6ae9ed
volume will require usage of the master key encrypted passphrase for
6ae9ed
a QEMU environment.  So rather than allow creation of something that
6ae9ed
won't be usable, just fail the creation.
6ae9ed
6ae9ed
(cherry picked from commit 30d27f24d8ab262ad93b663002a0e1d5edf95fa0)
6ae9ed
Signed-off-by: John Ferlan <jferlan@redhat.com>
6ae9ed
---
6ae9ed
 src/storage/storage_backend.c | 7 +++++++
6ae9ed
 1 file changed, 7 insertions(+)
6ae9ed
6ae9ed
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
6ae9ed
index d0eaaf9..8faafa4 100644
6ae9ed
--- a/src/storage/storage_backend.c
6ae9ed
+++ b/src/storage/storage_backend.c
6ae9ed
@@ -56,6 +56,7 @@
6ae9ed
 #include "internal.h"
6ae9ed
 #include "secret_conf.h"
6ae9ed
 #include "secret_util.h"
6ae9ed
+#include "vircrypto.h"
6ae9ed
 #include "viruuid.h"
6ae9ed
 #include "virstoragefile.h"
6ae9ed
 #include "storage_backend.h"
6ae9ed
@@ -1065,6 +1066,12 @@ virStorageBackendCreateQemuImgCheckEncryption(int format,
6ae9ed
                            _("no secret provided for luks encryption"));
6ae9ed
             return -1;
6ae9ed
         }
6ae9ed
+        if (!virCryptoHaveCipher(VIR_CRYPTO_CIPHER_AES256CBC)) {
6ae9ed
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
6ae9ed
+                           _("luks encryption usage requires encrypted "
6ae9ed
+                             "secret generation to be supported"));
6ae9ed
+            return -1;
6ae9ed
+        }
6ae9ed
     } else {
6ae9ed
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
6ae9ed
                        _("volume encryption unsupported with format %s"), type);
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed