]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Don't mark suspend as active until we know it is running
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 29 Nov 2011 15:31:19 +0000 (15:31 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 30 Nov 2011 10:12:30 +0000 (10:12 +0000)
If suspend failed for some reason (e.g. too short duration) then
subsequent attempts to trigger suspend were rejected because we
had already marked a suspend as being in progress

* src/util/virnodesuspend.c: Don't mark suspend as active
  until we've successfully triggered it

src/util/virnodesuspend.c

index 6eb91bc80f96023c11a0b7c6b36d90444d9e24d7..7e37118b49b3566929ebde71cdba32e9d529ea19 100644 (file)
@@ -202,7 +202,6 @@ int nodeSuspendForDuration(virConnectPtr conn ATTRIBUTE_UNUSED,
                             _("Suspend operation already in progress"));
         goto cleanup;
     }
-    aboutToSuspend = true;
 
     /* Check if the host supports the requested suspend target */
     switch (target) {
@@ -245,6 +244,7 @@ int nodeSuspendForDuration(virConnectPtr conn ATTRIBUTE_UNUSED,
         goto cleanup;
     }
 
+    aboutToSuspend = true;
     ret = 0;
 cleanup:
     virNodeSuspendUnlock();