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-devel

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

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [Patch] Fixes for xl support in xendomains start-up/shutdown script
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
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1308182629; bh=yzKYESLpAGyJrrloUnqnljUOoHVULQReN2sUzGtnVzQ=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=2Y3K0RPOYKqhvKx/4N7X1Q819/2Mm0gk3Bjd2mZu0dmwBStKE6B63wSEwuFsUA0tq1cSE48SH5I0ZtQFpnkdZ9/LDlamjjXzR3UMMy3QU0pDOQPyETG9pRSXQ6195qvGxkCUf2djXFQXl8sz0/GFM+HxmFBQ2lCycfn1maKdvI0=
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=;
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [Patch] Fixes for xl support in xendomains start-up/shutdown script, Ian Murray <=