|   | 
      | 
  
  
      | 
      | 
  
 
     | 
    | 
  
  
     | 
    | 
  
  
    |   | 
      | 
  
  
    | 
         
xen-devel
[Xen-devel] [PATCH] During suspend,	return immediately with a failure if
 
# HG changeset patch
# User john.levon@xxxxxxx
# Date 1169670529 28800
# Node ID 14fb98867856742513b4241612889209925d2bd0
# Parent  f546aae09c9e5ebc5b496642a86a2d2a5fd0f108
During suspend, return immediately with a failure if the domain will never
suspend, instead of pointlessly retrying.
Signed-off-by: John Levon <john.levon@xxxxxxx>
diff --git a/tools/libxc/xc_linux_save.c b/tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c
+++ b/tools/libxc/xc_linux_save.c
@@ -378,8 +378,29 @@ static int suspend_and_state(int (*suspe
         ERROR("Could not get vcpu context");
 
 
-    if (info->shutdown && info->shutdown_reason == SHUTDOWN_suspend)
-        return 0; // success
+    if (info->dying) {
+        ERROR("domain is dying");
+        return -1;
+    }
+
+    if (info->crashed) {
+        ERROR("domain has crashed");
+        return -1;
+    }
+
+    if (info->shutdown) {
+        switch (info->shutdown_reason) {
+        case SHUTDOWN_poweroff:
+        case SHUTDOWN_reboot:
+            ERROR("domain has shut down");
+            return -1;
+        case SHUTDOWN_suspend:
+            return 0;
+        case SHUTDOWN_crash:
+            ERROR("domain has crashed");
+            return -1;
+        }
+    }
 
     if (info->paused) {
         // try unpausing domain, wait, and retest
@@ -393,7 +414,7 @@ static int suspend_and_state(int (*suspe
 
 
     if( ++i < 100 ) {
-        ERROR("Retry suspend domain.");
+        ERROR("Retry suspend domain");
         usleep(10000);  // 10ms
         goto retry;
     }
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
 |   
 
| <Prev in Thread] | 
Current Thread | 
[Next in Thread>
 |  
- [Xen-devel] [PATCH] During suspend,	return immediately with a failure if the domain will never,
john . levon <=
 
 
 |  
  
 | 
    | 
  
  
    |   | 
    |