[Pkg-xen-devel] Bug#452721: Bug#452721: "xendomains" does not restore domains in same order as it would start them

Andy Smith andy at strugglers.net
Tue Sep 28 12:41:57 BST 2021


Hi Diederik,

On Tue, Sep 28, 2021 at 11:45:08AM +0200, Diederik de Haas wrote:
> On Monday, 27 September 2021 19:13:04 CEST Andy Smith wrote:
> > I think the "auto" directory is a pretty good and simple interface,
> > so how about using it for save/shutdown as well? So, instead of just
> > enumerating all running domids, enumerate all files in
> > /etc/xen/auto/ in REVERSE order, parsing the name of the domain out
> > of each one and doing the action on that name. When all files have
> > been exhausted, THEN do the action on any remaining running domains.
> 
> I'm not familiar with the "auto" directory('s functionality), but I _assume_ 
> that it's a directory which contains Xen domain config files which are 
> automatically started up at boot time (in alphabetical sequence).
> The user can choose to start other VMs if (s)he so chooses.

Yes; you typically symlink for example /etc/xen/foo.cfg to
/etc/xen/auto/100-foo.cfg so as to enforce some order of automatic startup.

Currently shutdown just goes in order of running domain id though.

> If that's correct, then I find it more logical to do *everything* in reverse.
> The VM that was started first, should be saved/shutdown last and IIUC your 
> proposal would not do that.

No, that's what I am suggesting too: again walk the "auto" directory
but in reverse order.

> Once all the "remaining" ones have been saved/shutdown, THEN do
> the auto ones in reverse order.

A problem here would be excluding the domains that have a specified
order from the initial round of shutdowns, which is why I suggested
doing it in reverse order by the "auto" directory and THEN shutting
down anything that's left as normal, since that way you don't need
to check anything.

As you've pointed out, this does mean that if you had linked say
/etc/xen/auto/010-important.cfg with the intention that it be
started first and shut down last, you would have to also link in
every other domain in its correct order otherwise the not-mentioned
ones would be shut down after 010-important.

However, I feel like people who use the /etc/xen/auto directory do
already link all or the majority of their domains in there - I
certainly do. I don't find it onerous to say that if you want to
specify shutdown order then you must link all of the domains in
/etc/xen/auto not just some of them.

Otherwise, if you wanted to say that all non-mentioned domains must
be shutdown first then I guess you'd have to parse the list of
domain names from the "suto" directory first, then get the list of
running domains from /usr/lib/xen-common/bin/xen-init-list and
exclude one from the other for the initial round of shutdowns.

> Could the domain ID be used for that?

I don't like it because it only says how recent a domain was
started relative to others, not any intention about start/stop
order. Shut one down manually (or crash) and start it again and it
gets a new domid higher than all existing.

> But my main point is that I think the proposed sequence should be adjusted.

We agree about reverse order, I think we only disagree about when to
shut down domains that don't have a preference set. I am all for
keeping it simple by saying ordering must be set for all domains
otherwise ordering for remaining ones is not defined.

Cheers,
Andy



More information about the Pkg-xen-devel mailing list