Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Connect.xml | 10 ++++++++++
src/connect.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
index 43a6241..6f90822 100644
--- a/data/org.libvirt.Connect.xml
+++ b/data/org.libvirt.Connect.xml
@@ -113,6 +113,16 @@
<arg name="flags" type="u" direction="in"/>
<arg name="models" type="as" direction="out"/>
</method>
+ <method name="GetDomainCapabilities">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectGetDomainC...
+ <arg name="emulatorbin" type="s"
direction="in"/>
+ <arg name="arch" type="s" direction="in"/>
+ <arg name="machine" type="s" direction="in"/>
+ <arg name="virttype" type="s" direction="in"/>
+ <arg name="flags" type="u" direction="in"/>
+ <arg name="domCapabilities" type="s"
direction="out"/>
+ </method>
<method name="GetSysinfo">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetSysinfo&q...
diff --git a/src/connect.c b/src/connect.c
index 169a070..1ce6b86 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -576,6 +576,39 @@ virtDBusConnectGetCPUModelNames(GVariant *inArgs,
*outArgs = g_variant_new_tuple(&gret, 1);
}
+static void
+virtDBusConnectGetDomainCapabilities(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;
+ const gchar *emulatorbin;
+ const gchar *arch;
+ const gchar *machine;
+ const gchar *virttype;
+ guint flags;
+ g_autofree gchar* domCapabilities = NULL;
+
+ g_variant_get(inArgs, "(&s&s&s&su)", &emulatorbin,
&arch, &machine,
+ &virttype, &flags);
+
+ if (!virtDBusConnectOpen(connect, error))
+ return;
+
+ domCapabilities = virConnectGetDomainCapabilities(connect->connection,
+ emulatorbin, arch,
+ machine, virttype,
+ flags);
+ if (!domCapabilities)
+ return virtDBusUtilSetLastVirtError(error);
+
+ *outArgs = g_variant_new("(s)", domCapabilities);
+}
+
static void
virtDBusConnectGetSysinfo(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -817,6 +850,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
{ "GetAllDomainStats", virtDBusConnectGetAllDomainStats },
{ "GetCapabilities", virtDBusConnectGetCapabilities },
{ "GetCPUModelNames", virtDBusConnectGetCPUModelNames },
+ { "GetDomainCapabilities", virtDBusConnectGetDomainCapabilities },
{ "GetSysinfo", virtDBusConnectGetSysinfo },
{ "ListDomains", virtDBusConnectListDomains },
{ "ListNetworks", virtDBusConnectListNetworks },
--
2.15.0