ia64/xen-unstable

changeset 13619:a9165141e52d

During suspend, return immediately with a failure if the domain will
never suspend, instead of pointlessly retrying.

Signed-off-by: John Levon <john.levon@sun.com>
author kfraser@localhost.localdomain
date Thu Jan 25 12:30:25 2007 +0000 (2007-01-25)
parents d6d27c649fd6
children 348c2983ff02
files tools/libxc/xc_linux_save.c
line diff
     1.1 --- a/tools/libxc/xc_linux_save.c	Thu Jan 25 12:28:47 2007 +0000
     1.2 +++ b/tools/libxc/xc_linux_save.c	Thu Jan 25 12:30:25 2007 +0000
     1.3 @@ -379,8 +379,29 @@ static int suspend_and_state(int (*suspe
     1.4          ERROR("Could not get vcpu context");
     1.5  
     1.6  
     1.7 -    if (info->shutdown && info->shutdown_reason == SHUTDOWN_suspend)
     1.8 -        return 0; // success
     1.9 +    if (info->dying) {
    1.10 +        ERROR("domain is dying");
    1.11 +        return -1;
    1.12 +    }
    1.13 +
    1.14 +    if (info->crashed) {
    1.15 +        ERROR("domain has crashed");
    1.16 +        return -1;
    1.17 +    }
    1.18 +
    1.19 +    if (info->shutdown) {
    1.20 +        switch (info->shutdown_reason) {
    1.21 +        case SHUTDOWN_poweroff:
    1.22 +        case SHUTDOWN_reboot:
    1.23 +            ERROR("domain has shut down");
    1.24 +            return -1;
    1.25 +        case SHUTDOWN_suspend:
    1.26 +            return 0;
    1.27 +        case SHUTDOWN_crash:
    1.28 +            ERROR("domain has crashed");
    1.29 +            return -1;
    1.30 +        }
    1.31 +    }
    1.32  
    1.33      if (info->paused) {
    1.34          // try unpausing domain, wait, and retest
    1.35 @@ -394,7 +415,7 @@ static int suspend_and_state(int (*suspe
    1.36  
    1.37  
    1.38      if( ++i < 100 ) {
    1.39 -        ERROR("Retry suspend domain.");
    1.40 +        ERROR("Retry suspend domain");
    1.41          usleep(10000);  // 10ms
    1.42          goto retry;
    1.43      }