[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [Patch] Fixes for xl support in xendomains start-up/shutdown script


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Ian Murray <murrayie@xxxxxxxxxxx>
  • Date: Thu, 16 Jun 2011 01:03:49 +0100 (BST)
  • Delivery-date: Wed, 15 Jun 2011 17:04:53 -0700
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=nSFXfyPPAbZCgxEJ2UXCgZEH+bMAqqwU1EThQDBphOsU5YJRZh427YnlMFojC+D3hdYinSakO8Uh866y++XI6DDKvMzfftctJmwFuHnM32Z5qLZOgsnppjtmz8JY2gYvbKvhsgIqgd+iijuL2p0vGEG1N1vfNrDrff2wAMIXdY4=;
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Hi,

First time posting on the devel list so please accept my apologies for lack of 
etiquette or any faux pas I make.

Since using Xen 4.1 compiled from source, I noticed that the xendomains 
start-up 
script was not behaving properly. A bit of a google revealed that an attempt 
had 
been made patch it to use xl if available or fallback to xm, but this wasn't 
enough to make the script work at the this point in time. Observations are that 
'xl list -l' has introduced extra response information that threw the script 
because of false hits on some regex stuff. Also the header of the save/restore 
file seems to have changed. I tweaked the regex and edded an extra variable to 
compare against the new header text if using xl.

I haven't thoroughly tested the patch against every combination of domains 
sysreq'd nor have a I tested for its backward compatibility with xm. However, 
for xl, it appears to work for auto starts, saves and restores. Tested against 
Xen 4.1.1 (thank-you and please keep up the good work) on Scientific Linux 6.0 
Dom0.

I also ought to state that I am not an expert in bash/regex/Xen so the patch 
may 
not be the most elegant, etc.

Thanks for reading,

Signed-off-by: Ian MURRAY <murrayie@xxxxxxxxxxx>

--- xendomains.4.1.1    2011-06-16 01:31:44.929812576 +0100
+++ xendomains.4.1.1.xlpatch    2011-06-16 01:32:22.077817600 +0100
@@ -27,11 +27,13 @@
 #                    boots / shuts down.
 ### END INIT INFO
 
+HEADCOMP="LinuxGuestRecord"
 CMD=xm
 $CMD list &> /dev/null
 if test $? -ne 0
 then
     CMD=xl
+    HEADCOMP="Xen saved domain"
 fi
 
 $CMD list &> /dev/null
@@ -204,7 +206,7 @@
 
 parseln()
 {
-    if [[ "$1" =~ '(domain' ]]; then
+    if [[ "$1" = '(domain' ]]; then
         name=;id=
     else if [[ "$1" =~ '(name' ]]; then
         name=$(echo $1 | sed -e 's/^.*(name \(.*\))$/\1/')
@@ -228,7 +230,7 @@
         RC=0
         ;;
     esac
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep '(\(domain$\|domid\|name\)')
     return $RC
 }
 
@@ -250,7 +252,7 @@
         for dom in $XENDOMAINS_SAVE/*; do
             if [ -f $dom ] ; then
                 HEADER=`head -c 16 $dom | head -n 1 2> /dev/null`
-                if [ $HEADER = "LinuxGuestRecord" ]; then
+                if [ "$HEADER" = "$HEADCOMP" ]; then
                     echo -n " ${dom##*/}"
                     XMR=`$CMD restore $dom 2>&1 1>/dev/null`
                     #$CMD restore $dom
@@ -310,7 +312,7 @@
     if test "$state" != "-b---d" -a "$state" != "-----d"; then
         return 1;
     fi
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep '(\(domain$\|domid\|name\)')
     return 0
 }
 
@@ -441,7 +443,7 @@
         fi
         kill $WDOG_PID >/dev/null 2>&1
     fi
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep '(\(domain$\|domid\|name\)')
 
     # NB. this shuts down ALL Xen domains (politely), not just the ones in
     # AUTODIR/*
@@ -478,7 +480,7 @@
         return 0
         ;;
     esac
-    done < <($CMD list -l | grep '(\(domain\|domid\|name\)')
+    done < <($CMD list -l | grep '(\(domain$\|domid\|name\)')
     return 1
 }

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.