[PATCH 06/30] qemu: Introduce another helper for creating alias for a 'secret' object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



qemuAliasForSecret is meant as a replacement qemuDomainGetSecretAESAlias
with saner API. The sub-type we are creating the alias for is passed in
as a string rather than the unflexible 'isLuks' boolean.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_alias.c | 17 +++++++++++++++++
 src/qemu/qemu_alias.h |  3 +++
 2 files changed, 20 insertions(+)

diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c
index 95086fc65a..2e466ff23f 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -793,6 +793,23 @@ qemuDomainGetSecretAESAlias(const char *srcalias,
 }


+/* qemuAliasForSecret:
+ * @parentalias: alias of the parent object
+ * @obj: optional sub-object of the parent device the secret is for
+ *
+ * Generate alias for a secret object used by @parentalias device or one of
+ * the dependencies of the device described by @obj.
+ */
+char *
+qemuAliasForSecret(const char *parentalias,
+                   const char *obj)
+{
+    if (obj)
+        return g_strdup_printf("%s-%s-secret0", parentalias, obj);
+    else
+        return g_strdup_printf("%s-secret0", parentalias);
+}
+
 /* qemuAliasTLSObjFromSrcAlias
  * @srcAlias: Pointer to a source alias string
  *
diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h
index ae2fce16bc..645956d024 100644
--- a/src/qemu/qemu_alias.h
+++ b/src/qemu/qemu_alias.h
@@ -86,6 +86,9 @@ char *qemuDomainGetMasterKeyAlias(void);
 char *qemuDomainGetSecretAESAlias(const char *srcalias,
                                   bool isLuks);

+char *qemuAliasForSecret(const char *parentalias,
+                         const char *obj);
+
 char *qemuAliasTLSObjFromSrcAlias(const char *srcAlias)
     ATTRIBUTE_NONNULL(1);

-- 
2.24.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux