On 02/15/2018 11:50 AM, Daniel P. Berrangé wrote:
During domain startup there are many places where we need to acquire
secrets. Currently code passes around a virConnectPtr, except in the
places where we pass in NULL. So there are a few codepaths where ability
to start guests using secrets will fail. Change to acquire a handle to
the secret driver when needed.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/qemu/qemu_domain.c | 111 ++++++++++++++++++++++------------------------
src/qemu/qemu_domain.h | 15 +++----
src/qemu/qemu_driver.c | 18 ++++----
src/qemu/qemu_hotplug.c | 64 +++++++++++---------------
src/qemu/qemu_hotplug.h | 15 +++----
src/qemu/qemu_migration.c | 10 ++---
src/qemu/qemu_process.c | 40 +++++------------
tests/qemuhotplugtest.c | 4 +-
8 files changed, 114 insertions(+), 163 deletions(-)
[...]
I tried a Coverity build...
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index f3ec5d8042..62d84a7364 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -836,24 +836,21 @@ bool qemuDomainDiskHasEncryptionSecret(virStorageSourcePtr src)
ATTRIBUTE_NONNULL(1);
qemuDomainSecretInfoPtr
-qemuDomainSecretInfoTLSNew(virConnectPtr conn,
- qemuDomainObjPrivatePtr priv,
+qemuDomainSecretInfoTLSNew(qemuDomainObjPrivatePtr priv,
const char *srcAlias,
const char *secretUUID);
void qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr disk)
ATTRIBUTE_NONNULL(1);
-int qemuDomainSecretHostdevPrepare(virConnectPtr conn,
- qemuDomainObjPrivatePtr priv,
+int qemuDomainSecretHostdevPrepare(qemuDomainObjPrivatePtr priv,
virDomainHostdevDefPtr hostdev)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
Need to adjust ATTRIBUTE_NONNULL
void qemuDomainSecretChardevDestroy(virDomainChrSourceDefPtr dev)
ATTRIBUTE_NONNULL(1);
-int qemuDomainSecretChardevPrepare(virConnectPtr conn,
- virQEMUDriverConfigPtr cfg,
+int qemuDomainSecretChardevPrepare(virQEMUDriverConfigPtr cfg,
qemuDomainObjPrivatePtr priv,
const char *chrAlias,
virDomainChrSourceDefPtr dev)
ATTRIBUTE_NONNULL
@@ -863,8 +860,7 @@ int qemuDomainSecretChardevPrepare(virConnectPtr
conn,
void qemuDomainSecretDestroy(virDomainObjPtr vm)
ATTRIBUTE_NONNULL(1);
-int qemuDomainSecretPrepare(virConnectPtr conn,
- virQEMUDriverPtr driver,
+int qemuDomainSecretPrepare(virQEMUDriverPtr driver,
virDomainObjPtr vm)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
ATTRIBUTE_NONNULL
@@ -1000,8 +996,7 @@ qemuDomainCheckMigrationCapabilities(virQEMUDriverPtr driver,
qemuDomainAsyncJob asyncJob);
int
-qemuDomainPrepareDiskSource(virConnectPtr conn,
- virDomainDiskDefPtr disk,
+qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
qemuDomainObjPrivatePtr priv,
virQEMUDriverConfigPtr cfg);
[...]
Reviewed-by: John Ferlan <jferlan(a)redhat.com>
John