]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/commitdiff
tools: don't stop xenstore domain when stopping dom0
authorJuergen Gross <jgross@suse.com>
Mon, 18 Jan 2016 08:04:03 +0000 (09:04 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 18 Jan 2016 16:35:56 +0000 (16:35 +0000)
When restarting or shutting down dom0 the xendomains script tries to
stop all other domains. Don't do this for the xenstore domain, as it
might survive a dom0 reboot in the future.

The same applies to xl shutdown --all. Here the xenstore domain is
flagged as "never stop".

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/hotplug/Linux/xendomains.in
tools/libxl/xl_cmdimpl.c

index dfe0b333a354304936bd368eeef5945ceab881bc..9f88649c5d4904be6a8ffe53fb08019d7bc36933 100644 (file)
@@ -196,6 +196,15 @@ rdnames()
     done
 }
 
+# get xenstore domain id (or 0 if no xenstore domain)
+get_xsdomid()
+{
+    XS_DOMID=`${bindir}/xenstore-read /tool/xenstored/domid 2>/dev/null`
+    if test $? -ne 0; then
+        XS_DOMID=0
+    fi
+}
+
 LIST_GREP='(domain\|(domid\|(name\|^    {$\|"name":\|"domid":'
 parseln()
 {
@@ -216,12 +225,14 @@ parseln()
 
 is_running()
 {
+    get_xsdomid
     rdname $1
     RC=1
     name=;id=
     while read LN; do
        parseln "$LN" || continue
        if test $id = 0; then continue; fi
+       if test $id = $XS_DOMID; then continue; fi
        case $name in
            ($NM)
                RC=0
@@ -302,10 +313,12 @@ start()
 
 all_zombies()
 {
+    get_xsdomid
     name=;id=
     while read LN; do
        parseln "$LN" || continue
        if test $id = 0; then continue; fi
+       if test $id = $XS_DOMID; then continue; fi
        if test "$state" != "-b---d" -a "$state" != "-----d"; then
            return 1;
        fi
@@ -351,11 +364,13 @@ stop()
     if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
        rdnames
     fi
+    get_xsdomid
     echo -n "Shutting down Xen domains:"
     name=;id=
     while read LN; do
        parseln "$LN" || continue
        if test $id = 0; then continue; fi
+       if test $id = $XS_DOMID; then continue; fi
        echo -n " $name"
        if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
            eval "
index f9933cb83db746255e45015e8720e585ea8b3fe3..25507c77f8a136793769641877b31e7a5527e7e7 100644 (file)
@@ -4820,7 +4820,7 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv)
                libxl_evgen_domain_death **, libxl_ev_user, int) =
         do_reboot ? &reboot_domain : &shutdown_domain;
     int opt, i, nb_domain;
-    int wait_for_it = 0, all =0;
+    int wait_for_it = 0, all = 0, nrdeathws = 0;
     int fallback_trigger = 0;
     static struct option opts[] = {
         {"all", 0, 0, 'a'},
@@ -4857,14 +4857,15 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv)
             deathws = calloc(nb_domain, sizeof(*deathws));
 
         for (i = 0; i<nb_domain; i++) {
-            if (dominfo[i].domid == 0)
+            if (dominfo[i].domid == 0 || dominfo[i].never_stop)
                 continue;
             fn(dominfo[i].domid, deathws ? &deathws[i] : NULL, i,
                fallback_trigger);
+            nrdeathws++;
         }
 
-        if (wait_for_it) {
-            wait_for_domain_deaths(deathws, nb_domain - 1 /* not dom 0 */);
+        if (deathws) {
+            wait_for_domain_deaths(deathws, nrdeathws);
             free(deathws);
         }