[dbus PATCH v2 08/11] APIs should appear in alphabetical order: Move Resume method

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
 data/org.libvirt.Domain.xml |  8 ++++----
 src/domain.c                | 42 +++++++++++++++++++++---------------------
 test/test_domain.py         | 32 ++++++++++++++++----------------
 3 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index 651e517..673260c 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -79,6 +79,10 @@
         value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainReset"/>
       <arg name="flags" type="u" direction="in"/>
     </method>
+    <method name="Resume">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainResume"/>
+    </method>
     <method name="Undefine">
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainUndefineFlags"/>
@@ -88,10 +92,6 @@
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSuspend"/>
     </method>
-    <method name="Resume">
-      <annotation name="org.gtk.GDBus.DocString"
-        value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainResume"/>
-    </method>
     <signal name="DeviceAdded">
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainEventDeviceAddedCallback"/>
diff --git a/src/domain.c b/src/domain.c
index 2178352..a16e49f 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -427,6 +427,26 @@ virtDBusDomainReset(GVariant *inArgs,
         virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusDomainResume(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;
+
+    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+    if (!domain)
+        return;
+
+    if (virDomainResume(domain) < 0)
+        virtDBusUtilSetLastVirtError(error);
+}
+
 static void
 virtDBusDomainUndefine(GVariant *inArgs,
                        GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -470,26 +490,6 @@ virtDBusDomainSuspend(GVariant *inArgs G_GNUC_UNUSED,
         virtDBusUtilSetLastVirtError(error);
 }
 
-static void
-virtDBusDomainResume(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;
-
-    domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
-    if (!domain)
-        return;
-
-    if (virDomainResume(domain) < 0)
-        virtDBusUtilSetLastVirtError(error);
-}
-
 static virtDBusGDBusPropertyTable virtDBusDomainPropertyTable[] = {
     { "Active", virtDBusDomainGetActive, NULL },
     { "Autostart", virtDBusDomainGetAutostart, NULL },
@@ -511,9 +511,9 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = {
     { "Shutdown", virtDBusDomainShutdown },
     { "Reboot", virtDBusDomainReboot },
     { "Reset", virtDBusDomainReset },
+    { "Resume", virtDBusDomainResume },
     { "Undefine", virtDBusDomainUndefine },
     { "Suspend", virtDBusDomainSuspend },
-    { "Resume", virtDBusDomainResume },
     { 0 }
 };
 
diff --git a/test/test_domain.py b/test/test_domain.py
index edcf106..ceda19e 100755
--- a/test/test_domain.py
+++ b/test/test_domain.py
@@ -37,6 +37,22 @@ class TestDomain(libvirttest.BaseTestClass):
                 raise e
         domain.Undefine(0)
 
+    def test_resume(self):
+        def domain_resumed(path, _event):
+            assert isinstance(path, dbus.ObjectPath)
+            self.loop.quit()
+
+        self.connect.connect_to_signal('DomainEvent', domain_resumed, arg1='Resumed')
+
+        obj, domain = self.domain()
+        domain.Suspend()
+        domain.Resume()
+
+        state = obj.Get('org.libvirt.Domain', 'State', dbus_interface=dbus.PROPERTIES_IFACE)
+        assert state == 'running'
+
+        self.main_loop()
+
     def test_shutdown(self):
         def domain_stopped(path, _event):
             assert isinstance(path, dbus.ObjectPath)
@@ -80,21 +96,5 @@ class TestDomain(libvirttest.BaseTestClass):
 
         self.main_loop()
 
-    def test_resume(self):
-        def domain_resumed(path, _event):
-            assert isinstance(path, dbus.ObjectPath)
-            self.loop.quit()
-
-        self.connect.connect_to_signal('DomainEvent', domain_resumed, arg1='Resumed')
-
-        obj, domain = self.domain()
-        domain.Suspend()
-        domain.Resume()
-
-        state = obj.Get('org.libvirt.Domain', 'State', dbus_interface=dbus.PROPERTIES_IFACE)
-        assert state == 'running'
-
-        self.main_loop()
-
 if __name__ == '__main__':
     libvirttest.run()
-- 
2.15.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux