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

Re: [Xen-users] Xen 4.2.2 /etc/init.d/xendomains save and restore of domains does not work

first sorry that I explained it bad but my English is not very well:

second I realize why you could not reproduce my problems under xl JSON format: short: my symlink names in $XENDOMAINS_AUTO differ from the "real" domain name. Later more about that

Problem description detail:

File: /etc/init.d/xendomains (from 4.3 git commit543a2657182dbb9237d1feeb1d3193096ab2cb2d )

The sed "expression in function rdname()

    NM=$($CMD create --quiet --dryrun --defconfig "$1" |
         sed -n 's/^.*(name \(.*\))$/\1/p')

    called by

is_running $dom

   called from


   in the if block

if contains_something "$XENDOMAINS_AUTO"
if [ $? -eq 0 ] || is_running $dom; then

works only for the SXP format and not for the JSON format. For JSON fromat the funktion is_running $dom will nearly always return false

Example to show that:

root@srv01:~# xl create --quiet --dryrun --defconfig /etc/xen/auto/03_gnomedag | head -10
    "domid": null,
    "config": {
        "c_info": {
            "type": "pv",
            "hap": "<default>",
            "oos": "<default>",
            "ssidref": 0,
            "name": "gnomedag",
            "uuid": "2d33d9c8-7efe-4060-8e61-b47af2796a5c",

root@srv01:~# xl create --quiet --dryrun --defconfig /etc/xen/auto/03_gnomedag \
| sed -n 's/^.*(name \(.*\))$/\1/p'

So $NM will always be empty and is_running() will nearly always return false;

    rdname $1
    while read LN; do
        parseln "$LN" || continue
        if test $id = 0; then continue; fi
        case $name in
    done < <($CMD list -l | grep "$LIST_GREP")
    return $RC

In contrast my sed "expression" will work for JSON format but not for SXP (Yes with that you are right. Sorry ! Up to now I did not know or have forgotten that xl supports both formats).

root@srv01:~# xl create --quiet --dryrun --defconfig /etc/xen/auto/03_gnomedag \
| sed -n 's/^.*"name": "\(.*\)",$/\1/p'

That is what I expected for JSON format.

I found why our both test have different results for the JSON fromat:

On my System (historical reason) the name of the symlinks in $XENDOMAINS_AUTO/* differ from the "real" domain name (example: domain name: gnomedag symlink name: /etc/xen/auto/03_gnomedag -> /etc/xen/gnomedag.cfg).

        shortdom=$(echo $dom | sed -n 's/^.*\/\(.*\)$/\1/p')
        echo $saved_domains | grep -w $shortdom > /dev/null
        if [ $? -eq 0 ] || is_running $dom; then
              echo -n "(skip)"

In your configuration the restored domain names are filtered by the echo ... | grep -w ... instruction. So is_running $dom is never called for them. So you will never see the semantical error produced by rdname().

In my system the "real" domain name stored in saved_domains differ from the value in $dom. So is_running $dom is always called and always returns false. Which leads to a "second start" of the already restored domain.

In the moment I have no good idea how to combine the two needed sed expressions for the rdname() function

sed -n 's/^.*(name \(.*\))$/\1/p'     #SXP

sed -n 's/^.*"name": "\(.*\)",$/\1/p' #JSON

On 07/01/13 02:06, Ian Murray wrote:

I download the file by from git and give him a chance. It works nearly perfect.
On xendomains stop there was all ok.

On xendomains start it restores the saved domains but after that it tries to start them again and produce some error messages like domain is already running.

It appears to be working fine for me. I am running 4.3 rc 6 + next commit. Rather than saying the output has changed for xl, I think you may be referring to the fact that xl now can output JSON as well as xm's SXP. Having said this, xendomains works both properly for me both using JSON and SXP although I am not sure why the skipping of the autostart domains is working when I select JSON in xl.conf. Certainly the xl ... sed line fails when I execute it manually when using JSON.

I think your solution is not the right approach because xl can produce JSON and SXP format and that is defined in xl.conf. Your solution will have a problem when setting xl to produce SXP, I think.

root@xen6:/etc/xen/auto# service xendomains stop
Shutting down Xen domains: ubuntu-email(save)................................
 *   [done]
root@xen6:/etc/xen/auto# service xendomains start
Restoring Xen domains: ubuntu-email vpn2
Starting auto Xen domains: ubuntu-email(skip) vpn2(skip) *   [done]

Not tested against xm as I have no means to do so.

The reason is  the sed script in rdname() does not work with xl output.
I'll changed it in the way as you have done with HEADCOMP (see the diff below).
After that all was nice for me

root@srv01:/etc/init.d# diff -u .xendomains.4.3.original xendomains
--- .xendomains.4.3.original    2013-06-30 20:54:14.000000000 +0200
+++ xendomains  2013-06-30 23:27:44.000000000 +0200
@@ -31,11 +31,13 @@

+RDNAMESED='s/^.*(name \(.*\))$/\1/p'
 $CMD list &> /dev/null
 if test $? -ne 0
        HEADCOMP="Xen saved domain"
+        RDNAMESED='s/^.*"name": "\(.*\)",$/\1/p'

 $CMD list &> /dev/null
@@ -185,8 +187,8 @@
 # read name from xen config file
-    NM=$($CMD create --quiet --dryrun --defconfig "$1" |
-         sed -n 's/^.*(name \(.*\))$/\1/p')
+    NM=$( $CMD create --quiet --dryrun --defconfig "$1" |
+         sed -n "${RDNAMESED}" )


I am surprised you did not have issue with 4.2.1 because the header issues have been present ever since xl became the default/preferred toolstack, unless your Xen 4.2.1 came from a third-party.
Your are right I remember that there were some problems with 4.2.1 too. As I switched from 4.1 to 4.2.1.

Sorry at that time I had not much time. If I remember right, I fixed that in any way for me, but forget to report.

Thanks for your help. I learned a lot about bash (bla) seams to be equal to bla) in case instructions. That was new for me.

Best wishes


Xen-users mailing list

Xen-users mailing list



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