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

Re: [Xen-devel] [PATCH v3 14/15] tools: don't stop xenstore domain when stopping dom0



On Fri, 2016-01-08 at 14:08 +0100, Juergen Gross wrote:
> +# 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

In principal this could be:
+ÂÂÂÂXS_DOMID=`${bindir}/xenstore-read /tool/xenstored/domid 2>/dev/null || 
echo 0`

But I'm far from convinced that is an improvement.

> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index f9933cb..29f9d19 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -4856,15 +4856,17 @@ static int main_shutdown_or_reboot(int do_reboot,
> int argc, char **argv)
> ÂÂÂÂÂÂÂÂÂif (wait_for_it)
> ÂÂÂÂÂÂÂÂÂÂÂÂÂdeathws = calloc(nb_domain, sizeof(*deathws));
> Â
> +ÂÂÂÂÂÂÂÂwait_for_it = 0;

Please can we avoid reusing the boolean flag used for argument handling as
a counter.

I think you will need to introduce a new nrdeathws.

I was thinking if you could invert the loop to count downwards such that
you can decrement nb_domain for uninteresting domains, but then the uses of
deathws[i] don't work, the solving of which would no doubt require another
variable anyway.


> ÂÂÂÂÂÂÂÂÂ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);
> +ÂÂÂÂÂÂÂÂÂÂÂÂ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);
> ÂÂÂÂÂÂÂÂÂ}
> Â
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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