[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xc_domain_save: Do not poll-wait for guest to shutdown -- it should
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1220970807 -3600 # Node ID 59904b1800784e65ff6a5f43227b46fc67ad2928 # Parent 5f3bb7f1a4cb355c2a88e4d5d53de7032d6fc8ba 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@xxxxxxxxxx> --- tools/libxc/xc_domain_save.c | 59 +++---------------------------------------- 1 files changed, 5 insertions(+), 54 deletions(-) diff -r 5f3bb7f1a4cb -r 59904b180078 tools/libxc/xc_domain_save.c --- a/tools/libxc/xc_domain_save.c Tue Sep 09 15:08:57 2008 +0100 +++ b/tools/libxc/xc_domain_save.c Tue Sep 09 15:33:27 2008 +0100 @@ -341,69 +341,20 @@ static int suspend_and_state(int (*suspe static int suspend_and_state(int (*suspend)(void), int xc_handle, int io_fd, int dom, xc_dominfo_t *info) { - int i = 0; - if ( !(*suspend)() ) { ERROR("Suspend request failed"); return -1; } - retry: - - if ( xc_domain_getinfo(xc_handle, dom, 1, info) != 1 ) - { - ERROR("Could not get domain info"); + if ( (xc_domain_getinfo(xc_handle, dom, 1, info) != 1) || + !info->shutdown || (info->shutdown_reason != SHUTDOWN_suspend) ) + { + ERROR("Domain not in suspended state"); return -1; } - 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. */ - xc_domain_unpause( xc_handle, dom ); - ERROR("Domain was paused. Wait and re-test."); - usleep(10000); /* 10ms */ - goto retry; - } - - if ( ++i < 100 ) - { - ERROR("Retry suspend domain"); - usleep(10000); /* 10ms */ - goto retry; - } - - ERROR("Unable to suspend domain."); - - return -1; + return 0; } /* _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |