Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Connect.xml | 4 ++++
src/connect.c | 19 +++++++++++++++++++
test/test_connect.py | 1 +
3 files changed, 24 insertions(+)
diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
index d754235..0e5c7e2 100644
--- a/data/org.libvirt.Connect.xml
+++ b/data/org.libvirt.Connect.xml
@@ -7,6 +7,10 @@
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetHostname&...
</property>
+ <property name="LibVersion" type="t"
access="read">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetLibVersio...
+ </property>
<property name="Version" type="t" access="read">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetVersion&q...
diff --git a/src/connect.c b/src/connect.c
index 27de019..78ed971 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -110,6 +110,24 @@ virtDBusConnectGetHostname(const gchar *objectPath G_GNUC_UNUSED,
*value = g_variant_new("s", hostname);
}
+static void
+virtDBusConnectGetLibVersion(const gchar *objectPath G_GNUC_UNUSED,
+ gpointer userData,
+ GVariant **value,
+ GError **error)
+{
+ virtDBusConnect *connect = userData;
+ gulong libVer;
+
+ if (!virtDBusConnectOpen(connect, error))
+ return;
+
+ if (virConnectGetLibVersion(connect->connection, &libVer) < 0)
+ return virtDBusUtilSetLastVirtError(error);
+
+ *value = g_variant_new("t", libVer);
+}
+
static void
virtDBusConnectGetVersion(const gchar *objectPath G_GNUC_UNUSED,
gpointer userData,
@@ -485,6 +503,7 @@ virtDBusNetworkLookupByUUID(GVariant *inArgs,
static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] = {
{ "Hostname", virtDBusConnectGetHostname, NULL },
+ { "LibVersion", virtDBusConnectGetLibVersion, NULL },
{ "Version", virtDBusConnectGetVersion, NULL },
{ 0 }
};
diff --git a/test/test_connect.py b/test/test_connect.py
index 05d7bd8..d24cba5 100755
--- a/test/test_connect.py
+++ b/test/test_connect.py
@@ -82,6 +82,7 @@ class TestConnect(libvirttest.BaseTestClass):
@pytest.mark.parametrize("property_name,expected_type", [
("Hostname", dbus.String),
+ ("LibVersion", dbus.UInt64),
("Version", dbus.UInt64),
])
def test_connect_properties_return_type(self, property_name, expected_type):
--
2.15.0