Signed-off-by: Katerina Koukiou <kkouk...@redhat.com> --- data/org.libvirt.Network.xml | 4 ++++ src/network.c | 22 ++++++++++++++++++++++ test/test_network.py | 1 + 3 files changed, 27 insertions(+)
diff --git a/data/org.libvirt.Network.xml b/data/org.libvirt.Network.xml index cadf0a8..863f4d2 100644 --- a/data/org.libvirt.Network.xml +++ b/data/org.libvirt.Network.xml @@ -19,6 +19,10 @@ <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetName"/> </property> + <property name="Persistent" type="b" access="read"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkIsPersistent"/> + </property> <property name="UUID" type="s" access="read"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetUUIDString"/> diff --git a/src/network.c b/src/network.c index 7f0091a..5ca1379 100644 --- a/src/network.c +++ b/src/network.c @@ -108,6 +108,27 @@ virtDBusNetworkGetName(const gchar *objectPath, *value = g_variant_new("s", name); } +static void +virtDBusNetworkGetPersistent(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect = userData; + g_autoptr(virNetwork) network = NULL; + gint persistent; + + network = virtDBusNetworkGetVirNetwork(connect, objectPath, error); + if (!network) + return; + + persistent = virNetworkIsPersistent(network); + if (persistent < 0) + return virtDBusUtilSetLastVirtError(error); + + *value = g_variant_new("b", !!persistent); +} + static void virtDBusNetworkGetUUID(const gchar *objectPath, gpointer userData, @@ -220,6 +241,7 @@ static virtDBusGDBusPropertyTable virtDBusNetworkPropertyTable[] = { { "Autostart", virtDBusNetworkGetAutostart, NULL }, { "BridgeName", virtDBusNetworkGetBridgeName, NULL }, { "Name", virtDBusNetworkGetName, NULL }, + { "Persistent", virtDBusNetworkGetPersistent, NULL }, { "UUID", virtDBusNetworkGetUUID, NULL }, { 0 } }; diff --git a/test/test_network.py b/test/test_network.py index 4180cc8..a5987e5 100755 --- a/test/test_network.py +++ b/test/test_network.py @@ -16,6 +16,7 @@ class TestNetwork(libvirttest.BaseTestClass): assert isinstance(props['Autostart'], dbus.Boolean) assert isinstance(props['BridgeName'], dbus.String) assert isinstance(props['Name'], dbus.String) + assert isinstance(props['Persistent'], dbus.Boolean) assert isinstance(props['UUID'], dbus.String) def test_network_create(self): -- 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list