xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Murray <murrayie@yahoo.co.uk>
To: xen-devel <xen-devel@lists.xen.org>, ian.jackson@eu.citrix.com
Subject: [Patch[ xl problems with xendomains
Date: Tue, 21 May 2013 22:12:09 +0100	[thread overview]
Message-ID: <519BE329.7060408@yahoo.co.uk> (raw)

Hi,

Ever since xl become the preferred toolstack, I have had problems using 
the xendomains startup/shutdown script.  Having retested today, it seems 
that the issues are now reduced down to xendomains being unable to 
restart previously saved domains.

Here is a typical session using xl running Xen 4.2.2 on Ubuntu 64 12.04 
bit server, using stock Dom0 kernel (3.2.0-43-generic)

root@xen6:/etc/init.d# service xendomains start
root@xen6:/etc/init.d# service xendomains stop
Shutting down Xen domains: *   [done]
root@xen6:/etc/init.d# xl create /etc/xen/vpn2
Parsing config from /etc/xen/vpn2
Daemon running with PID 3969
root@xen6:/etc/init.d# service xendomains start
root@xen6:/etc/init.d# service xendomains stop
Shutting down Xen domains: vpn2(save)....
  *   [done]
root@xen6:/etc/init.d# service xendomains start
Restoring Xen domains:/etc/init.d/xendomains: line 258: [: too many 
arguments

  *   [done]
root@xen6:/# rm /var/lib/xen/save/vpn2

Line 258 reads as:-

-                if [ $HEADER = "LinuxGuestRecord" ]; then

There were further issues of xendomains not suspending domains properly 
but this appear resolved now because I think the behaviour of xl list -l 
has changed. AFAIR an extra 'domain' identifier was thrown in which was 
causing issues with the regex parser.

Anyway, as far as I can tell, the two issues that I see are that the if 
statement at line 258 borks because there are no quotes around the 
$HEADER. I'll leave it to the Bash gurus to explain that; I am not one 
and I just hacked it to work.

Secondly, it would appear that when using xl to save a running domain, 
the header in the save file does not contain the text "LinuxGuestRecord" 
but in fact contains "Xen saved domain". This causes xendomains to miss 
the save files and will not try to restore them. Placing a simple 
variable that contains the correct header text appears to fix this.

So applying the following patch to xendomains appears to ease these 
issues. Please be aware that I haven't tested this on anything earlier 
than 4.2.2 and hasn't been tested at all using xm, although the issues 
with the regex would likely break xm rather than the change below. 
Looking back at my original submission (2 years ago), I reported the 
issues against 4.1.1. As previously stated this had more problems 
because of differing output of xl list -l, which appears to be employed 
by xendomains. I haven't thoroughly tested the patch against every 
combination of domains sysreq'd, etc, but it appears to work for auto 
start, save and restore.

Thanks for reading and I hope this makes sense,

Ian.


Signed-off-by: Ian MURRAY <murrayie@yahoo.co.uk>

--- xendomains.422.orig 2013-05-19 18:06:18.525195879 +0100
+++ xendomains  2013-05-21 21:27:57.253429073 +0100
@@ -28,10 +28,12 @@
  ### END INIT INFO

  CMD=xm
++HEADCOMP="LinuxGuestRecord"
  $CMD list &> /dev/null
  if test $? -ne 0
  then
         CMD=xl
+       HEADCOMP="Xen saved domain"
  fi

  $CMD list &> /dev/null
@@ -255,7 +257,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

             reply	other threads:[~2013-05-21 21:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-21 21:12 Ian Murray [this message]
2013-05-22  9:53 ` [Patch[ xl problems with xendomains Ian Campbell
2013-05-22 10:27   ` George Dunlap
2013-05-22 11:44   ` Ian Murray
2013-05-23 13:24   ` Ian Campbell
2013-05-23 19:23     ` Ian Murray
2013-05-22 10:35 ` George Dunlap
2013-05-23  9:58 ` Fabio Fantoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=519BE329.7060408@yahoo.co.uk \
    --to=murrayie@yahoo.co.uk \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).