ia64/xen-unstable

changeset 18465:59904b180078

xc_domain_save: Do not poll-wait for guest to shutdown -- it should
already be suspended when the (*suspend)() function returns.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Sep 09 15:33:27 2008 +0100 (2008-09-09)
parents 5f3bb7f1a4cb
children 7f1c71c6d4c8
files tools/libxc/xc_domain_save.c
line diff
     1.1 --- a/tools/libxc/xc_domain_save.c	Tue Sep 09 15:08:57 2008 +0100
     1.2 +++ b/tools/libxc/xc_domain_save.c	Tue Sep 09 15:33:27 2008 +0100
     1.3 @@ -341,69 +341,20 @@ static int analysis_phase(int xc_handle,
     1.4  static int suspend_and_state(int (*suspend)(void), int xc_handle, int io_fd,
     1.5                               int dom, xc_dominfo_t *info)
     1.6  {
     1.7 -    int i = 0;
     1.8 -
     1.9      if ( !(*suspend)() )
    1.10      {
    1.11          ERROR("Suspend request failed");
    1.12          return -1;
    1.13      }
    1.14  
    1.15 - retry:
    1.16 -
    1.17 -    if ( xc_domain_getinfo(xc_handle, dom, 1, info) != 1 )
    1.18 +    if ( (xc_domain_getinfo(xc_handle, dom, 1, info) != 1) ||
    1.19 +         !info->shutdown || (info->shutdown_reason != SHUTDOWN_suspend) )
    1.20      {
    1.21 -        ERROR("Could not get domain info");
    1.22 -        return -1;
    1.23 -    }
    1.24 -
    1.25 -    if ( info->dying )
    1.26 -    {
    1.27 -        ERROR("domain is dying");
    1.28 -        return -1;
    1.29 -    }
    1.30 -
    1.31 -    if ( info->crashed )
    1.32 -    {
    1.33 -        ERROR("domain has crashed");
    1.34 +        ERROR("Domain not in suspended state");
    1.35          return -1;
    1.36      }
    1.37  
    1.38 -    if ( info->shutdown )
    1.39 -    {
    1.40 -        switch ( info->shutdown_reason )
    1.41 -        {
    1.42 -        case SHUTDOWN_poweroff:
    1.43 -        case SHUTDOWN_reboot:
    1.44 -            ERROR("domain has shut down");
    1.45 -            return -1;
    1.46 -        case SHUTDOWN_suspend:
    1.47 -            return 0;
    1.48 -        case SHUTDOWN_crash:
    1.49 -            ERROR("domain has crashed");
    1.50 -            return -1;
    1.51 -        }
    1.52 -    }
    1.53 -
    1.54 -    if ( info->paused )
    1.55 -    {
    1.56 -        /* Try unpausing domain, wait, and retest. */
    1.57 -        xc_domain_unpause( xc_handle, dom );
    1.58 -        ERROR("Domain was paused. Wait and re-test.");
    1.59 -        usleep(10000); /* 10ms */
    1.60 -        goto retry;
    1.61 -    }
    1.62 -
    1.63 -    if ( ++i < 100 )
    1.64 -    {
    1.65 -        ERROR("Retry suspend domain");
    1.66 -        usleep(10000); /* 10ms */
    1.67 -        goto retry;
    1.68 -    }
    1.69 -
    1.70 -    ERROR("Unable to suspend domain.");
    1.71 -
    1.72 -    return -1;
    1.73 +    return 0;
    1.74  }
    1.75  
    1.76  /*