Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 8 ++++----
src/domain.c | 44 ++++++++++++++++++++++----------------------
test/test_domain.py | 2 +-
3 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index fd7b085..edf7491 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -11,6 +11,10 @@
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetAutostar...
</property>
+ <property name="Id" type="u" access="read">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetID"...
+ </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&quo...
@@ -19,10 +23,6 @@
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetUUIDStri...
</property>
- <property name="Id" type="u" access="read">
- <annotation name="org.gtk.GDBus.DocString"
- value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetID"...
- </property>
<property name="OSType" type="s" access="read">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetOSType&q...
diff --git a/src/domain.c b/src/domain.c
index 5109392..87c205f 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -45,6 +45,27 @@ virtDBusDomainGetActive(const gchar *objectPath,
*value = g_variant_new("b", !!active);
}
+static void
+virtDBusDomainGetId(const gchar *objectPath,
+ gpointer userData,
+ GVariant **value,
+ GError **error)
+{
+ virtDBusConnect *connect = userData;
+ g_autoptr(virDomain) domain = NULL;
+ guint id;
+
+ domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+ if (!domain)
+ return;
+
+ id = virDomainGetID(domain);
+ if (id == (guint)-1)
+ id = 0;
+
+ *value = g_variant_new("u", id);
+}
+
static void
virtDBusDomainGetAutostart(const gchar *objectPath,
gpointer userData,
@@ -106,27 +127,6 @@ virtDBusDomainGetUUID(const gchar *objectPath,
*value = g_variant_new("s", uuid);
}
-static void
-virtDBusDomainGetId(const gchar *objectPath,
- gpointer userData,
- GVariant **value,
- GError **error)
-{
- virtDBusConnect *connect = userData;
- g_autoptr(virDomain) domain = NULL;
- guint id;
-
- domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
- if (!domain)
- return;
-
- id = virDomainGetID(domain);
- if (id == (guint)-1)
- id = 0;
-
- *value = g_variant_new("u", id);
-}
-
static void
virtDBusDomainGetOsType(const gchar *objectPath,
gpointer userData,
@@ -493,9 +493,9 @@ virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED,
static virtDBusGDBusPropertyTable virtDBusDomainPropertyTable[] = {
{ "Active", virtDBusDomainGetActive, NULL },
{ "Autostart", virtDBusDomainGetAutostart, NULL },
+ { "Id", virtDBusDomainGetId, NULL },
{ "Name", virtDBusDomainGetName, NULL },
{ "UUID", virtDBusDomainGetUUID, NULL },
- { "Id", virtDBusDomainGetId, NULL },
{ "OSType", virtDBusDomainGetOsType, NULL },
{ "Persistent", virtDBusDomainGetPersistent, NULL },
{ "State", virtDBusDomainGetState, NULL },
diff --git a/test/test_domain.py b/test/test_domain.py
index 9a33758..c3ffebf 100755
--- a/test/test_domain.py
+++ b/test/test_domain.py
@@ -12,9 +12,9 @@ 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['Id'], dbus.UInt32)
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)
--
2.15.0