WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] tools: Allow xendomains to handle domain

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] tools: Allow xendomains to handle domain names >16 characters
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 19 Jun 2007 14:41:56 -0700
Delivery-date: Tue, 19 Jun 2007 14:40:20 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1182266962 -3600
# Node ID 865c4ae59be3b0aa7e375b929414244d1e5bdf74
# Parent  896b536d66c9952fac4bd1c9a6e3f562debec19d
tools: Allow xendomains to handle domain names >16 characters

The xendomains init script parses the output of "xm list", and
since xm list restricts the length of domains to 16 characters the
xendomain script cannot handle long domain names.

This patch makesit parse the output of "xm list -l" instead.

Signed-off-by: Mark McLoughlin <markmc@xxxxxxxxxx>
---
 tools/examples/init.d/xendomains |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff -r 896b536d66c9 -r 865c4ae59be3 tools/examples/init.d/xendomains
--- a/tools/examples/init.d/xendomains  Tue Jun 19 16:08:15 2007 +0100
+++ b/tools/examples/init.d/xendomains  Tue Jun 19 16:29:22 2007 +0100
@@ -182,25 +182,31 @@ rdnames()
 
 parseln()
 {
-    name=`echo "$1" | cut -c0-17`
-    name=${name%% *}
-    rest=`echo "$1" | cut -c18- `
-    read id mem cpu vcpu state tm < <(echo "$rest")
+    if [[ "$1" =~ "\(domain" ]]; then
+        name=;id=
+    else if [[ "$1" =~ "\(name" ]]; then
+        name=$(echo $1 | sed -e 's/^.*(name \(.*\))$/\1/')
+    else if [[ "$1" =~ "\(domid" ]]; then
+        id=$(echo $1 | sed -e 's/^.*(domid \(.*\))$/\1/')
+    fi; fi; fi
+
+    [ -n "$name" -a -n "$id" ] && return 0 || return 1
 }
 
 is_running()
 {
     rdname $1
     RC=1
+    name=;id=
     while read LN; do
-       parseln "$LN"
+       parseln "$LN" || continue
        if test $id = 0; then continue; fi
        case $name in 
            ($NM)
                RC=0
                ;;
        esac
-    done < <(xm list | grep -v '^Name')
+    done < <(xm list -l | grep '(\(domain\|domid\|name\)')
     return $RC
 }
 
@@ -267,13 +273,14 @@ start()
 
 all_zombies()
 {
+    name=;id=
     while read LN; do
-       parseln "$LN"
+       parseln "$LN" || continue
        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 -l | grep '(\(domain\|domid\|name\)')
     return 0
 }
 
@@ -309,8 +316,9 @@ stop()
        rdnames
     fi
     echo -n "Shutting down Xen domains:"
+    name=;id=
     while read LN; do
-       parseln "$LN"
+       parseln "$LN" || continue
        if test $id = 0; then continue; fi
        echo -n " $name"
        if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
@@ -384,7 +392,7 @@ stop()
            fi
            kill $WDOG_PID >/dev/null 2>&1
        fi
-    done < <(xm list | grep -v '^Name')
+    done < <(xm list -l | grep '(\(domain\|domid\|name\)')
 
     # NB. this shuts down ALL Xen domains (politely), not just the ones in
     # AUTODIR/*
@@ -409,15 +417,16 @@ stop()
 
 check_domain_up()
 {
+    name=;id=
     while read LN; do
-       parseln "$LN"
+       parseln "$LN" || continue
        if test $id = 0; then continue; fi
        case $name in 
            ($1)
                return 0
                ;;
        esac
-    done < <(xm list | grep -v "^Name")
+    done < <(xm list -l | grep '(\(domain\|domid\|name\)')
     return 1
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] tools: Allow xendomains to handle domain names >16 characters, Xen patchbot-unstable <=