Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.Domain.xml | 4 ++++ src/domain.c | 22 ++++++++++++++++++++++ test/test_domain.py | 1 + 3 files changed, 27 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 243a978..21eb162 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -36,6 +36,10 @@ <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetState"/> </property> + <property name="Updated" type="b" access="read"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIsUpdated"/> + </property> <property name="UUID" type="s" access="read"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetUUIDString"/> diff --git a/src/domain.c b/src/domain.c index 9cf691a..5a2dbfb 100644 --- a/src/domain.c +++ b/src/domain.c @@ -266,6 +266,27 @@ virtDBusDomainGetState(const gchar *objectPath, *value = g_variant_new("s", string); } +static void +virtDBusDomainGetUpdated(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect = userData; + g_autoptr(virDomain) domain = NULL; + gint updated; + + domain = virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + updated = virDomainIsUpdated(domain); + if (updated < 0) + return virtDBusUtilSetLastVirtError(error); + + *value = g_variant_new("b", !!updated); +} + static void virtDBusDomainGetUUID(const gchar *objectPath, gpointer userData, @@ -951,6 +972,7 @@ static virtDBusGDBusPropertyTable virtDBusDomainPropertyTable[] = { { "Persistent", virtDBusDomainGetPersistent, NULL }, { "SchedulerType", virtDBusDomainGetSchedulerType, NULL}, { "State", virtDBusDomainGetState, NULL }, + { "Updated", virtDBusDomainGetUpdated, NULL }, { "UUID", virtDBusDomainGetUUID, NULL }, { 0 } }; diff --git a/test/test_domain.py b/test/test_domain.py index 31e09bf..f2ae215 100755 --- a/test/test_domain.py +++ b/test/test_domain.py @@ -20,6 +20,7 @@ class TestDomain(libvirttest.BaseTestClass): isinstance(props['SchedulerType'][0], dbus.String), isinstance(props['SchedulerType'][1], dbus.Int32)]) assert isinstance(props['State'], dbus.String) + assert isinstance(props['Updated'], dbus.Boolean) assert isinstance(props['UUID'], dbus.String) # Call all methods except Reset and GetStats, because the test backend -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list