Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 8 ++++----
src/domain.c | 40 ++++++++++++++++++++--------------------
test/test_domain.py | 26 +++++++++++++-------------
3 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 673260c..1be94ec 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -83,15 +83,15 @@
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainResume"...
</method>
+ <method name="Suspend">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSuspend&quo...
+ </method>
<method name="Undefine">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainUndefineFla...
<arg name="flags" type="u" direction="in"/>
</method>
- <method name="Suspend">
- <annotation name="org.gtk.GDBus.DocString"
- value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSuspend&quo...
- </method>
<signal name="DeviceAdded">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEven...
diff --git a/src/domain.c b/src/domain.c
index a16e49f..4deef26 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -448,45 +448,45 @@ virtDBusDomainResume(GVariant *inArgs G_GNUC_UNUSED,
}
static void
-virtDBusDomainUndefine(GVariant *inArgs,
- GUnixFDList *inFDs G_GNUC_UNUSED,
- const gchar *objectPath,
- gpointer userData,
- GVariant **outArgs G_GNUC_UNUSED,
- GUnixFDList **outFDs G_GNUC_UNUSED,
- GError **error)
+virtDBusDomainSuspend(GVariant *inArgs G_GNUC_UNUSED,
+ GUnixFDList *inFDs G_GNUC_UNUSED,
+ const gchar *objectPath,
+ gpointer userData,
+ GVariant **outArgs G_GNUC_UNUSED,
+ GUnixFDList **outFDs G_GNUC_UNUSED,
+ GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virDomain) domain = NULL;
- guint flags;
-
- g_variant_get(inArgs, "(u)", &flags);
domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
if (!domain)
return;
- if (virDomainUndefineFlags(domain, flags) < 0)
+ if (virDomainSuspend(domain) < 0)
virtDBusUtilSetLastVirtError(error);
}
static void
-virtDBusDomainSuspend(GVariant *inArgs G_GNUC_UNUSED,
- GUnixFDList *inFDs G_GNUC_UNUSED,
- const gchar *objectPath,
- gpointer userData,
- GVariant **outArgs G_GNUC_UNUSED,
- GUnixFDList **outFDs G_GNUC_UNUSED,
- GError **error)
+virtDBusDomainUndefine(GVariant *inArgs,
+ GUnixFDList *inFDs G_GNUC_UNUSED,
+ const gchar *objectPath,
+ gpointer userData,
+ GVariant **outArgs G_GNUC_UNUSED,
+ GUnixFDList **outFDs G_GNUC_UNUSED,
+ GError **error)
{
virtDBusConnect *connect = userData;
g_autoptr(virDomain) domain = NULL;
+ guint flags;
+
+ g_variant_get(inArgs, "(u)", &flags);
domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
if (!domain)
return;
- if (virDomainSuspend(domain) < 0)
+ if (virDomainUndefineFlags(domain, flags) < 0)
virtDBusUtilSetLastVirtError(error);
}
@@ -512,8 +512,8 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
{ "Reboot", virtDBusDomainReboot },
{ "Reset", virtDBusDomainReset },
{ "Resume", virtDBusDomainResume },
- { "Undefine", virtDBusDomainUndefine },
{ "Suspend", virtDBusDomainSuspend },
+ { "Undefine", virtDBusDomainUndefine },
{ 0 }
};
diff --git a/test/test_domain.py b/test/test_domain.py
index ceda19e..952bf59 100755
--- a/test/test_domain.py
+++ b/test/test_domain.py
@@ -68,19 +68,6 @@ class TestDomain(libvirttest.BaseTestClass):
self.main_loop()
- def test_undefine(self):
- def domain_undefined(path, _event):
- assert isinstance(path, dbus.ObjectPath)
- self.loop.quit()
-
- self.connect.connect_to_signal('DomainEvent', domain_undefined,
arg1='Undefined')
-
- _, domain = self.domain()
- domain.Shutdown(0)
- domain.Undefine(0)
-
- self.main_loop()
-
def test_suspend(self):
def domain_suspended(path, _event):
assert isinstance(path, dbus.ObjectPath)
@@ -96,5 +83,18 @@ class TestDomain(libvirttest.BaseTestClass):
self.main_loop()
+ def test_undefine(self):
+ def domain_undefined(path, _event):
+ assert isinstance(path, dbus.ObjectPath)
+ self.loop.quit()
+
+ self.connect.connect_to_signal('DomainEvent', domain_undefined,
arg1='Undefined')
+
+ _, domain = self.domain()
+ domain.Shutdown(0)
+ domain.Undefine(0)
+
+ self.main_loop()
+
if __name__ == '__main__':
libvirttest.run()
--
2.15.0