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