[PATCH 05/30] qemu: domain: Split out encryption of secret object data

Ján Tomko jtomko at redhat.com
Wed Mar 11 15:40:22 UTC 2020


On a Monday in 2020, Peter Krempa wrote:
>Previously qemuDomainSecretAESSetup was looking up the secret in the
>secret diver as well as encrypting it for use with qemu. Split out the
>the lookup into a wrapper for this function so that we can reuse the
>original internals when we don't need to look up a secret with the
>secret driver. The new wrapper is called
>qemuDomainSecretAESSetupFromSecret.
>

>This refactor also changes the functions to return qemuDomainSecretInfoPtr

> also

Please split the split from refactors.

>directly rather than filling it via an argument. This rendered
>qemuDomainSecretInfoNew obsolete and thus it was deleted.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/qemu/qemu_domain.c | 180 ++++++++++++++++++-----------------------
> src/qemu/qemu_domain.h |   2 +
> 2 files changed, 81 insertions(+), 101 deletions(-)
>
>diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
>index 10d6264e46..202b85e39a 100644
>--- a/src/qemu/qemu_domain.h
>+++ b/src/qemu/qemu_domain.h
>@@ -1035,6 +1035,8 @@ bool qemuDomainSupportsEncryptedSecret(qemuDomainObjPrivatePtr priv);
> void qemuDomainSecretInfoFree(qemuDomainSecretInfoPtr secinfo)
>     ATTRIBUTE_NONNULL(1);
>
>+G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuDomainSecretInfo, qemuDomainSecretInfoFree);
>+

You really should not need to declare a new cleanup function when
splitting code.

Jano

> void qemuDomainSecretInfoDestroy(qemuDomainSecretInfoPtr secinfo);
>
> void qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk)
>-- 
>2.24.1
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200311/effdfc2e/attachment-0001.sig>


More information about the libvir-list mailing list