Artur Linhart - Linux communication
2008-Sep-11 01:12 UTC
[Xen-users] Error in /etc/init.d/xendomains if using option XEN_DOMAINS_AUTO_ONLY=true - saving of the domains always fails / shutdown is called
Hello,
for everybody who develops or uses the script /etc/init.d/xendomains, there
is a serious error in this script.
If the given variable XEN_DOMAINS_AUTO_ONLY is set to true in
/etc/sysconfig/xendomains, then the saving of the domains always fails - the
domains are shut down instead of the saving. This is very bad especially for
some HVM domains which MUST be saved instead of shut down, it affects also
the wished migration of the domain to another machine, etc. The error code
is in the beginning of the loop in the stop() procedure:
stop()
{
# Collect list of domains to shut down
if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
rdnames
fi
echo -n "Shutting down Xen domains:"
while read LN; do
parseln "$LN"
if test $id = 0; then continue; fi
echo -n " $name"
if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
case $name in
($NAMES)
# nothing
;;
(*)
echo -n "(skip)"
continue
;;
esac
fi
.....
}
The case cause is not evaluated correctly in the case
"$XENDOMAINS_AUTO_ONLY" = "true" - it falls always to the
possibility (*) in
the case there are more than one domain specified in /etc/xen/auto - then in
$NAMES there is for example something like DomName1|DomName2 what is then
incorrectly handled and it never matches the $name parameter even if it is
filled by DomName1 or DomName2 or whatever else. So there comes the
"continue" statement and nothing is made with the given domain, no
saving,
no migration to another machine, nothing. The domains are then shut down
with the shutdown of all remaining "non-auto" domains
The correct way is to evaluate the case using eval:
stop()
{
# Collect list of domains to shut down
if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
rdnames
fi
echo -n "Shutting down Xen domains:"
while read LN; do
parseln "$LN"
if test $id = 0; then continue; fi
echo -n " $name"
if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
eval "
case $name in
($NAMES)
# nothing
;;
(*)
echo -n ''(skip)''
continue
;;
esac
"
fi
...
}
- in this case the variable $NAMES is substituted first into the case, which
is then evaluated with the help of the eval built-in.
This error can be found in version 3.1.0 as well as in version 3.2.1 of Xen.
Please repair it for the next version of Xen, it cost me some hours to track
it out, so please do not waste this time by other users too. This is a
serious bug causing crash of the HVM domains not reacting on shutdown.
With regards
Artur Linhart
http://www.bcpraha.cz <http://www.bcpraha.cz/>
_______________________________________________
Xen-users mailing list
Xen-users@lists.xensource.com
http://lists.xensource.com/xen-users
Ian Jackson
2008-Sep-11 11:30 UTC
Re: [Xen-devel] Error in /etc/init.d/xendomains if using option XEN_DOMAINS_AUTO_ONLY=true - saving of the domains always fails / shutdown is called
Artur Linhart - Linux communication writes ("[Xen-devel] Error in
/etc/init.d/xendomains if using option XEN_DOMAINS_AUTO_ONLY=true - saving of
the domains always fails / shutdown is called"):> for everybody who develops or uses the script /etc/init.d/xendomains, there
> is a serious error in this script.
Thanks for your report.
> [description]
You would appear to be correct and your proposed solution is very
nearly correct. Thanks.
In general it would have been best if you had sent us a patch made
with `diff''. For example,
diff -u /etc/init.d/xendomains~ /etc/init.d/xendomains
or
diff -u ~/xen-unstable.hg/tools/examples/init.d/xendomains
/etc/init.d/xendomains
or some such. (The -u is important to produce the right output
format.) You would probably find that easier than cutting and pasting
fragments of the two versions (with mysterious extra linebreaks, too)
and of course we can directly apply it.
Also, it would be usual to say
Signed-Off-By: Your Name <your.email@address.example.com>
which indicates to us that you own the copyright in your contribution
and intend for your contribution to be made part of Xen and
distributed in the usual way. Again, I think it''s clear from your
message that this is the case and your proposed change is very small
so there is no need for that now.
I mention these things for the next time you wish to report a problem,
with a proposed fix, to a Free Software project. Sending a patch made
with diff -u with an appropriated Signed-Off-By, is the best current
practice. It makes life easier for everyone and will increase the
chances of the bug, that you''re reporting, being fixed.
I have converted your suggested change to such a patch, and fixed up a
minor and probably irrelevant wrinkle with shell quoting.
Thanks,
Ian.
Contributed-by: Artur Linhart <AL.LINUX@bcpraha.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
diff -r fba8dca321c2 tools/examples/init.d/xendomains
--- a/tools/examples/init.d/xendomains Thu Sep 11 11:58:08 2008 +0100
+++ b/tools/examples/init.d/xendomains Thu Sep 11 12:21:59 2008 +0100
@@ -327,15 +327,17 @@ stop()
if test $id = 0; then continue; fi
echo -n " $name"
if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
- case $name in
+ eval "
+ case \"\$name\" in
($NAMES)
# nothing
;;
(*)
- echo -n "(skip)"
+ echo -n ''(skip)''
continue
;;
esac
+ "
fi
# XENDOMAINS_SYSRQ chould be something like just "s"
# or "s e i u" or even "s e s i u o"
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Maybe Matching Threads
- Error in /etc/init.d/xendomains if using option XEN_DOMAINS_AUTO_ONLY=true - saving of the domains always fails / shutdown is called
- Bug#772274: xen-utils-common: when upgrading package: insserv: Service xenstored has to be enabled to start service xendomains
- Xen 4.2.2 /etc/init.d/xendomains save and restore of domains does not work
- Xendomains always broken for me, nobody else?
- Bug#395305: /etc/init.d/xendomains parseln() and long domU names