Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Connect.xml | 4 ++++
src/connect.c | 20 ++++++++++++++++++++
test/test_connect.py | 1 +
3 files changed, 25 insertions(+)
diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
index 5548820..3791251 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#virConnectGetCapabilit...
</property>
+ <property name="Encrypted" type="b"
access="read">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectIsEncrypted&...
+ </property>
<property name="Hostname" type="s"
access="read">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetHostname&...
diff --git a/src/connect.c b/src/connect.c
index 3fbb770..4d90fc4 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -110,6 +110,25 @@ virtDBusConnectGetCapabilities(const gchar *objectPath
G_GNUC_UNUSED,
*value = g_variant_new("s", capabilities);
}
+static void
+virtDBusConnectGetEncrypted(const gchar *objectPath G_GNUC_UNUSED,
+ gpointer userData,
+ GVariant **value,
+ GError **error)
+{
+ virtDBusConnect *connect = userData;
+ gint encrypted;
+
+ if (!virtDBusConnectOpen(connect, error))
+ return;
+
+ encrypted = virConnectIsEncrypted(connect->connection);
+ if (encrypted < 0)
+ return virtDBusUtilSetLastVirtError(error);
+
+ *value = g_variant_new("b", !!encrypted);
+}
+
static void
virtDBusConnectGetHostname(const gchar *objectPath G_GNUC_UNUSED,
gpointer userData,
@@ -500,6 +519,7 @@ virtDBusNetworkLookupByUUID(GVariant *inArgs,
static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] = {
{ "Capabilities", virtDBusConnectGetCapabilities, NULL },
+ { "Encrypted", virtDBusConnectGetEncrypted, NULL },
{ "Hostname", virtDBusConnectGetHostname, NULL },
{ "LibVersion", virtDBusConnectGetLibVersion, NULL },
{ "Version", virtDBusConnectGetVersion, NULL },
diff --git a/test/test_connect.py b/test/test_connect.py
index f544f76..91c8bb6 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", [
("Capabilities", dbus.String),
+ ("Encrypted", dbus.Boolean),
("Hostname", dbus.String),
("LibVersion", dbus.UInt64),
("Version", dbus.UInt64),
--
2.15.0