Author: waldi Date: Sun Apr 22 22:47:49 2012 New Revision: 1002 Log: debian/xen-utils-common.xendomains.init: Always shut down each domain. Modified: trunk/xen/debian/xen-utils-common.xendomains.init Modified: trunk/xen/debian/xen-utils-common.xendomains.init =============================================================================--- trunk/xen/debian/xen-utils-common.xendomains.init Sun Apr 22 22:47:00 2012 (r1001) +++ trunk/xen/debian/xen-utils-common.xendomains.init Sun Apr 22 22:47:49 2012 (r1002) @@ -57,7 +57,7 @@ return $? } -coproc_timeout() +timeout_coproc() { TIMEOUT="$1" for no in $(seq 0 $TIMEOUT); do @@ -70,6 +70,18 @@ return 1 } +timeout_domain() +{ + name="$1" + TIMEOUT="$2" + for no in $(seq 0 $TIMEOUT); do + if ! check_running "$name"; then return 0; fi + sleep 1 + log_action_cont_msg + done + return 1 +} + do_start_restore() { for file in $XENDOMAINS_SAVE/*; do @@ -136,7 +148,7 @@ while read id name rest; do log_action_begin_msg "Migrating Xen domain $name ($id)" coproc xen migrate $id $XENDOMAINS_MIGRATE 2>&1 1>/dev/null - coproc_timeout "$XENDOMAINS_STOP_MAXWAIT" + timeout_coproc "$XENDOMAINS_STOP_MAXWAIT" log_action_end_msg $? done < <(/usr/lib/xen-common/bin/xen-init-list) } @@ -147,24 +159,26 @@ log_action_begin_msg "Saving Xen domain $name ($id)" mkdir -p "$XENDOMAINS_SAVE" coproc xen save $id $XENDOMAINS_SAVE/$name 2>&1 1>/dev/null - coproc_timeout "$XENDOMAINS_STOP_MAXWAIT" + timeout_coproc "$XENDOMAINS_STOP_MAXWAIT" log_action_end_msg $? done < <(/usr/lib/xen-common/bin/xen-init-list) } -do_stop_shutdown_all() +do_stop_shutdown() { - log_action_begin_msg "Shutting down all Xen domains" - coproc xen shutdown --all $XENDOMAINS_SHUTDOWN_ALL 2>&1 1>/dev/null - coproc_timeout "$XENDOMAINS_STOP_MAXWAIT" - log_action_end_msg $? + while read id name rest; do + log_action_begin_msg "Shutting down Xen domain $name ($id)" + xen shutdown $id 2>&1 1>/dev/null + timeout_domain "$name" "$XENDOMAINS_STOP_MAXWAIT" + log_action_end_msg $? + done < <(/usr/lib/xen-common/bin/xen-init-list) } do_stop() { if test -n "$XENDOMAINS_MIGRATE"; then do_stop_migrate; fi if test -n "$XENDOMAINS_SAVE"; then do_stop_save; fi - do_stop_shutdown_all + do_stop_shutdown } check_domain_up()