[Pkg-xen-devel] Bug#695041: "service xendomains stop" sleeps XENDOMAINS_STOP_MAXWAIT seconds for every domain

Robert Hofer robert.hofer at ifi.lmu.de
Mon Dec 3 14:35:05 UTC 2012


Package: xen-utils-common
Version: 4.1.3-4

Function check_running in /etc/init.d/xendomains incorrectly detects a 
not running domain as running. As a consequence thereof 
"/etc/init.d/xendomains stop" needs more than
XENDOMAINS_STOP_MAXWAIT * "number of xen domains known to xend" seconds 
to run.

Here is a pseudo call trace:

do_stop_shutdown()
{
...
   while read id name rest; do
     log_action_begin_msg "Waiting for Xen domain $name ($id) to shut down"
     timeout_domain "$name" "$XENDOMAINS_STOP_MAXWAIT"
     log_action_end_msg $?
   done < <(/usr/lib/xen-common/bin/xen-init-list)
}

so timeout_domain is called with the name of the domain.

timeout_domain()
{
   name="$1"
   TIMEOUT="$2"
   for no in $(seq 0 $TIMEOUT); do
     if ! check_running "$name"; then return 0; fi
...

so check_running is also called with the name

check_running()
{
   xen domid "$1" > /dev/null 2>&1
   return $?
}

The output of "xm domid <name>" for a running domain is the ID of the 
domain and "None" for a known, but not runing domain. The return code 
for both cases is 0. So the function always returns 0. With xen 3 and no 
xend, this code was correct.

I suggest to parse the output of "xm list -l <name> " for  "(status 0)".

I am using Debian wheezy/sid with kernel 3.2.0-4-amd64.
xen-tool-stack is /usr/lib/xen-4.1/bin/xm



More information about the Pkg-xen-devel mailing list