[libvirt] [PATCH v3 06/10] storage: Clean up storageBackendCreateQemuImgCheckEncryption

John Ferlan jferlan at redhat.com
Wed Jun 20 23:01:15 UTC 2018


Remove the checks for qcow encryption since both callers (create
and resize) would have already disallowed usage.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/storage/storage_util.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 6b02bb2e9a..fe588df7dd 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -891,25 +891,7 @@ storageBackendCreateQemuImgCheckEncryption(int format,
 {
     virStorageEncryptionPtr enc = vol->target.encryption;
 
-    if (format == VIR_STORAGE_FILE_QCOW || format == VIR_STORAGE_FILE_QCOW2) {
-        if (enc->format != VIR_STORAGE_ENCRYPTION_FORMAT_QCOW &&
-            enc->format != VIR_STORAGE_ENCRYPTION_FORMAT_DEFAULT) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("unsupported volume encryption format %d"),
-                           vol->target.encryption->format);
-            return -1;
-        }
-        if (enc->nsecrets > 1) {
-            virReportError(VIR_ERR_XML_ERROR, "%s",
-                           _("too many secrets for qcow encryption"));
-            return -1;
-        }
-        if (enc->nsecrets == 0) {
-            virReportError(VIR_ERR_XML_ERROR, "%s",
-                           _("no secret provided for qcow encryption"));
-            return -1;
-        }
-    } else if (format == VIR_STORAGE_FILE_RAW) {
+    if (format == VIR_STORAGE_FILE_RAW) {
         if (enc->format != VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("unsupported volume encryption format %d"),
-- 
2.14.4




More information about the libvir-list mailing list