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 10bd6d2..efbec8e 100644
--- a/data/org.libvirt.Connect.xml
+++ b/data/org.libvirt.Connect.xml
@@ -67,6 +67,12 @@
value="See
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetCapabilit...
<arg name="capabilities" 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...
+ <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 dab6f34..eb4c74d 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -387,6 +387,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,
@@ -556,6 +582,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
{ "DomainLookupByName", virtDBusDomainLookupByName },
{ "DomainLookupByUUID", virtDBusDomainLookupByUUID },
{ "GetCapabilities", virtDBusConnectGetCapabilities },
+ { "GetSysinfo", virtDBusConnectGetSysinfo },
{ "ListNetworks", virtDBusConnectListNetworks },
{ "NetworkCreateXML", virtDBusConnectNetworkCreateXML },
{ "NetworkDefineXML", virtDBusConnectNetworkDefineXML },
diff --git a/test/test_connect.py b/test/test_connect.py
index 6baa6df..8948947 100755
--- a/test/test_connect.py
+++ b/test/test_connect.py
@@ -92,6 +92,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