Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.Connect.xml | 7 +++++++ src/connect.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml index fc29165..8691762 100644 --- a/data/org.libvirt.Connect.xml +++ b/data/org.libvirt.Connect.xml @@ -223,6 +223,13 @@ <arg name="params" type="a{sv}" direction="in"/> <arg name="flags" type="u" direction="in"/> </method> + <method name="SecretDefineXML"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretDefineXML"/> + <arg name="xml" type="s" direction="in"/> + <arg name="flags" type="u" direction="in"/> + <arg name="secret" type="o" direction="out"/> + </method> <method name="SecretLookupByUUID"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretLookupByUUIDString"/> diff --git a/src/connect.c b/src/connect.c index 3ef068f..05381de 100644 --- a/src/connect.c +++ b/src/connect.c @@ -1151,6 +1151,35 @@ virtDBusConnectNodeSetMemoryParameters(GVariant *inArgs, } } +static void +virtDBusConnectSecretDefineXML(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath G_GNUC_UNUSED, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect = userData; + g_autoptr(virSecret) secret = NULL; + g_autofree gchar *path = NULL; + const gchar *xml; + guint flags; + + g_variant_get(inArgs, "(&su)", &xml, &flags); + + if (!virtDBusConnectOpen(connect, error)) + return; + + secret = virSecretDefineXML(connect->connection, xml, flags); + if (!secret) + return virtDBusUtilSetLastVirtError(error); + + path = virtDBusUtilBusPathForVirSecret(secret, connect->secretPath); + + *outArgs = g_variant_new("(o)", path); +} + static void virtDBusConnectSecretLookupByUUID(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1307,6 +1336,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = { { "NodeGetMemoryStats", virtDBusConnectNodeGetMemoryStats }, { "NodeGetSecurityModel", virtDBusConnectNodeGetSecurityModel }, { "NodeSetMemoryParameters", virtDBusConnectNodeSetMemoryParameters }, + { "SecretDefineXML", virtDBusConnectSecretDefineXML }, { "SecretLookupByUUID", virtDBusConnectSecretLookupByUUID }, { "SecretLookupByUsage", virtDBusConnectSecretLookupByUsage }, { "StoragePoolLookupByName", virtDBusConnectStoragePoolLookupByName }, -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list