Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.Domain.xml | 8 ++++---- src/domain.c | 42 +++++++++++++++++++++--------------------- test/test_domain.py | 2 +- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index 1bbb383..fd7b085 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -7,6 +7,10 @@ <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIsActive"/> </property> + <property name="Autostart" type="b" access="read"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetAutostart"/> + </property> <property name="Name" type="s" access="read"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetName"/> @@ -31,10 +35,6 @@ <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetState"/> </property> - <property name="Autostart" type="b" access="read"> - <annotation name="org.gtk.GDBus.DocString" - value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetAutostart"/> - </property> <method name="GetVcpus"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetVcpusFlags"/> diff --git a/src/domain.c b/src/domain.c index 92cf21a..5109392 100644 --- a/src/domain.c +++ b/src/domain.c @@ -45,6 +45,26 @@ virtDBusDomainGetActive(const gchar *objectPath, *value = g_variant_new("b", !!active); } +static void +virtDBusDomainGetAutostart(const gchar *objectPath, + gpointer userData, + GVariant **value, + GError **error) +{ + virtDBusConnect *connect = userData; + g_autoptr(virDomain) domain = NULL; + gint autostart = 0; + + domain = virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + if (virDomainGetAutostart(domain, &autostart) < 0) + return virtDBusUtilSetLastVirtError(error); + + *value = g_variant_new("b", !!autostart); +} + static void virtDBusDomainGetName(const gchar *objectPath, gpointer userData, @@ -198,26 +218,6 @@ virtDBusDomainGetState(const gchar *objectPath, *value = g_variant_new("s", string); } -static void -virtDBusDomainGetAutostart(const gchar *objectPath, - gpointer userData, - GVariant **value, - GError **error) -{ - virtDBusConnect *connect = userData; - g_autoptr(virDomain) domain = NULL; - gint autostart = 0; - - domain = virtDBusDomainGetVirDomain(connect, objectPath, error); - if (!domain) - return; - - if (virDomainGetAutostart(domain, &autostart) < 0) - return virtDBusUtilSetLastVirtError(error); - - *value = g_variant_new("b", !!autostart); -} - static void virtDBusDomainGetVcpus(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -492,13 +492,13 @@ virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED, static virtDBusGDBusPropertyTable virtDBusDomainPropertyTable[] = { { "Active", virtDBusDomainGetActive, NULL }, + { "Autostart", virtDBusDomainGetAutostart, NULL }, { "Name", virtDBusDomainGetName, NULL }, { "UUID", virtDBusDomainGetUUID, NULL }, { "Id", virtDBusDomainGetId, NULL }, { "OSType", virtDBusDomainGetOsType, NULL }, { "Persistent", virtDBusDomainGetPersistent, NULL }, { "State", virtDBusDomainGetState, NULL }, - { "Autostart", virtDBusDomainGetAutostart, NULL }, { 0 } }; diff --git a/test/test_domain.py b/test/test_domain.py index 58d389e..9a33758 100755 --- a/test/test_domain.py +++ b/test/test_domain.py @@ -11,13 +11,13 @@ class TestDomain(libvirttest.BaseTestClass): props = obj.GetAll('org.libvirt.Domain', dbus_interface=dbus.PROPERTIES_IFACE) assert isinstance(props['Active'], dbus.Boolean) + assert isinstance(props['Autostart'], dbus.Boolean) assert isinstance(props['Name'], dbus.String) assert isinstance(props['UUID'], dbus.String) assert isinstance(props['Id'], dbus.UInt32) assert isinstance(props['OSType'], dbus.String) assert isinstance(props['Persistent'], dbus.Boolean) assert isinstance(props['State'], dbus.String) - assert isinstance(props['Autostart'], dbus.Boolean) # Call all methods except Reset and GetStats, because the test backend # doesn't support those -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list