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. Signed-off-by: Juergen Gross <jgr...@suse.com> --- tools/hotplug/Linux/xendomains.in | 17 +++++++++++++++++ tools/libxl/xl_cmdimpl.c | 19 +++++++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/tools/hotplug/Linux/xendomains.in b/tools/hotplug/Linux/xendomains.in index dfe0b33..70b7f16 100644 --- a/tools/hotplug/Linux/xendomains.in +++ b/tools/hotplug/Linux/xendomains.in @@ -196,6 +196,17 @@ rdnames() done } +# set xenstore domain id (or 0 if no xenstore domain) +get_xsdomid() +{ + ${bindir}/xenstore-exists /tool/xenstored/domid + if test $? -ne 0; then + XS_DOMID=0 + else + XS_DOMID=`${bindir}/xenstore-read /tool/xenstored/domid` + fi +} + LIST_GREP='(domain\|(domid\|(name\|^ {$\|"name":\|"domid":' parseln() { @@ -216,12 +227,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 +315,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 +366,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 " diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index f9933cb..bf30030 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -4822,6 +4822,7 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv) int opt, i, nb_domain; int wait_for_it = 0, all =0; int fallback_trigger = 0; + uint32_t domid; static struct option opts[] = { {"all", 0, 0, 'a'}, {"wait", 0, 0, 'w'}, @@ -4846,32 +4847,42 @@ static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv) } if (all) { + int ret; libxl_dominfo *dominfo; libxl_evgen_domain_death **deathws = NULL; if (!(dominfo = libxl_list_domain(ctx, &nb_domain))) { fprintf(stderr, "libxl_list_domain failed.\n"); return -1; } + ret = libxl_xenstore_domid(ctx, &domid); + if (ret == ERROR_DOMAIN_NOTFOUND) { + domid = 0; + } else if (ret != 0) { + fprintf(stderr, "libxl_xenstore_domid failed.\n"); + return -1; + } if (wait_for_it) deathws = calloc(nb_domain, sizeof(*deathws)); + wait_for_it = 0; for (i = 0; i<nb_domain; i++) { - if (dominfo[i].domid == 0) + if (dominfo[i].domid == 0 || dominfo[i].domid == domid) continue; fn(dominfo[i].domid, deathws ? &deathws[i] : NULL, i, fallback_trigger); + wait_for_it++; } - if (wait_for_it) { - wait_for_domain_deaths(deathws, nb_domain - 1 /* not dom 0 */); + if (deathws) { + wait_for_domain_deaths(deathws, wait_for_it); free(deathws); } libxl_dominfo_list_free(dominfo, nb_domain); } else { libxl_evgen_domain_death *deathw = NULL; - uint32_t domid = find_domain(argv[optind]); + domid = find_domain(argv[optind]); fn(domid, wait_for_it ? &deathw : NULL, 0, fallback_trigger); -- 2.6.2 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel