Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Connect.xml | 6 ++++++
src/connect.c | 27 +++++++++++++++++++++++++++
test/test_connect.py | 4 ++++
3 files changed, 37 insertions(+)
diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
index 8416339..c58d3ce 100644
--- a/data/org.libvirt.Connect.xml
+++ b/data/org.libvirt.Connect.xml
@@ -64,6 +64,12 @@
<arg name="uuid" type="s" direction="in"/>
<arg name="domain" type="o" direction="out"/>
</method>
+ <method name="GetSysinfo">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetSysinfo&q...
+ <arg name="flags" type="u" direction="in"/>
+ <arg name="sysinfo" type="s" direction="out"/>
+ </method>
<method name="ListNetworks">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-network.html#virConnectListAllNe...
diff --git a/src/connect.c b/src/connect.c
index 9bf08c8..7f9344e 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -384,6 +384,32 @@ virtDBusDomainLookupByUUID(GVariant *inArgs,
*outArgs = g_variant_new("(o)", path);
}
+static void
+virtDBusConnectGetSysinfo(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;
+ guint flags;
+ g_autofree gchar *sysinfo = NULL;
+
+ g_variant_get(inArgs, "(u)", &flags);
+
+ if (!virtDBusConnectOpen(connect, error))
+ return;
+
+ sysinfo = virConnectGetSysinfo(connect->connection, flags);
+ if (!sysinfo)
+ return virtDBusUtilSetLastVirtError(error);
+
+ *outArgs = g_variant_new("(s)", sysinfo);
+}
+
static void
virtDBusConnectListNetworks(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -553,6 +579,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
{ "DomainLookupByID", virtDBusDomainLookupByID },
{ "DomainLookupByName", virtDBusDomainLookupByName },
{ "DomainLookupByUUID", virtDBusDomainLookupByUUID },
+ { "GetSysinfo", virtDBusConnectGetSysinfo },
{ "ListNetworks", virtDBusConnectListNetworks },
{ "NetworkCreateXML", virtDBusConnectNetworkCreateXML },
{ "NetworkDefineXML", virtDBusConnectNetworkDefineXML },
diff --git a/test/test_connect.py b/test/test_connect.py
index d698a53..aa30971 100755
--- a/test/test_connect.py
+++ b/test/test_connect.py
@@ -93,6 +93,10 @@ class TestConnect(libvirttest.BaseTestClass):
props = obj.GetAll('org.libvirt.Connect',
dbus_interface=dbus.PROPERTIES_IFACE)
assert isinstance(props[property_name], expected_type)
+ def test_connect_get_sysinfo(self):
+ sysinfo = self.connect.GetSysinfo(0)
+ assert isinstance(sysinfo, dbus.String)
+
def test_list_networks(self):
networks = self.connect.ListNetworks(0)
assert isinstance(networks, dbus.Array)
--
2.15.0