render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
404507
From f0ec77f06f7f72d29748c2a04877ac97632ef63b Mon Sep 17 00:00:00 2001
404507
Message-Id: <f0ec77f06f7f72d29748c2a04877ac97632ef63b@dist-git>
404507
From: Peter Krempa <pkrempa@redhat.com>
404507
Date: Mon, 13 Nov 2017 13:43:22 +0100
404507
Subject: [PATCH] qemu: domain: Don't allocate storage source private data if
404507
 not needed
404507
404507
(cherry picked from commit 2c82fddca93ea83736260a5a90040fb5fa391e9a)
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1510323
404507
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
404507
---
404507
 src/qemu/qemu_domain.c | 9 +++++++--
404507
 1 file changed, 7 insertions(+), 2 deletions(-)
404507
404507
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
404507
index 27117d83ef..81f45516af 100644
404507
--- a/src/qemu/qemu_domain.c
404507
+++ b/src/qemu/qemu_domain.c
404507
@@ -1385,13 +1385,18 @@ qemuDomainSecretDiskPrepare(virConnectPtr conn,
404507
 {
404507
     virStorageSourcePtr src = disk->src;
404507
     qemuDomainStorageSourcePrivatePtr srcPriv;
404507
+    bool hasAuth = qemuDomainSecretDiskCapable(src);
404507
+    bool hasEnc = qemuDomainDiskHasEncryptionSecret(src);
404507
+
404507
+    if (!hasAuth && !hasEnc)
404507
+        return 0;
404507
 
404507
     if (!(disk->src->privateData = qemuDomainStorageSourcePrivateNew()))
404507
         return -1;
404507
 
404507
     srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(disk->src);
404507
 
404507
-    if (qemuDomainSecretDiskCapable(src)) {
404507
+    if (hasAuth) {
404507
         virSecretUsageType usageType = VIR_SECRET_USAGE_TYPE_ISCSI;
404507
 
404507
         if (src->protocol == VIR_STORAGE_NET_PROTOCOL_RBD)
404507
@@ -1404,7 +1409,7 @@ qemuDomainSecretDiskPrepare(virConnectPtr conn,
404507
               return -1;
404507
     }
404507
 
404507
-    if (qemuDomainDiskHasEncryptionSecret(src)) {
404507
+    if (hasEnc) {
404507
         if (!(srcPriv->encinfo =
404507
               qemuDomainSecretInfoNew(conn, priv, disk->info.alias,
404507
                                       VIR_SECRET_USAGE_TYPE_VOLUME, NULL,
404507
-- 
404507
2.15.0
404507