Package: xen-utils-common
Version: 3.0.3-0-2
Severity: normal
Tags: patch

When shutting down xen domains with '/etc/init.d/xendomains stop' most
of the time not all domains are stopped when the script finishes.

As it turns out the xendomains-script queries running domains by
executing 'xm list', this command replies its usage info sometimes
instead of giving proper output. I suspect this happens when xen is
busy (e.g. with shutting down domains).

I have patched xendomains with a wrapper around 'xm list', in order to
retry when it returns 'Usage ...' instead of the normal list of running
domains.
The other thing included in the patch is to allow longer domain names
(up to 40 chars) to be handled properly (solves bug #395305).

--- xendomains.org      2006-11-28 11:45:39.000000000 +0100
+++ xendomains  2006-12-09 01:01:06.000000000 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash
 ### BEGIN INIT INFO
 # Provides:          xendomains
 # Required-Start:    $syslog $remote_fs xend
@@ -128,9 +128,9 @@

 parseln()
 {
-    name=`echo "$1" | cut -c0-17`
+    name=`echo "$1" | cut -c0-40`
     name=${name%% *}
-    rest=`echo "$1" | cut -c18- `
+    rest=`echo "$1" | cut -c41- `
     read id mem cpu vcpu state tm < <(echo "$rest")
 }

@@ -204,15 +204,31 @@
     fi
 }

+xm_list()
+{
+    OK=0
+    while [ $OK -eq 0 ]; do
+       OUT=`xm list`
+       echo "$OUT" | grep -q "^Usage"
+       if [ $? -eq 1 ]; then
+           OK=1
+       else
+           sleep 1s
+       fi
+    done
+    echo "$OUT"
+    return 0
+}
+
 all_zombies()
 {
     while read LN; do
        parseln "$LN"
        if test $id = 0; then continue; fi
        if test "$state" != "-b---d" -a "$state" != "-----d"; then
            return 1;
        fi
-    done < <(xm list | grep -v '^Name')
+    done < <(xm_list | grep -v '^Name')
     return 0
 }

@@ -316,14 +332,14 @@
            echo -n "(shut)"
            watchdog_xm shutdown &
            WDOG_PID=$!
-           xm shutdown $id $XENDOMAINS_SHUTDOWN
+           xm shutdown $id $XENDOMAINS_SHUTDOWN > /dev/null
            if test $? -ne 0; then
                rc_failed $?
                echo -n '!'
            fi
            kill $WDOG_PIG >/dev/null 2>&1
        fi
-    done < <(xm list | grep -v '^Name')
+    done < <(xm_list | grep -v '^Name')

     # NB. this shuts down ALL Xen domains (politely), not just the ones in
     # AUTODIR/*



-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-2-xen-k7
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages xen-utils-common depends on:
ii lsb-base 3.1-22 Linux Standard Base 3.1 init scrip ii udev 0.103-1 /dev/ and hotplug management daemo

xen-utils-common recommends no packages.

-- no debconf information


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to