xl / xend feature parity: Missing '-a' option for xl 'shutdown' to shutdown all domains
Hi All,
Is there any reason why xl doesn't support the '-a' option for shutdown, to shutdown all domains ?
--
Sander
Quoted 4 lines · Sander Eikelenboom
Hi All,
Is there any reason why xl doesn't support the '-a' option for shutdown, to shutdown all domains ?
I'd never heard of it for one thing ;-)
It should be a reasonably easy patch -- I can give some pointers if you are interested.
Ian.
Quoted 6 lines · you
Quoted 4 lines · Sander Eikelenboom
Hi All,
Is there any reason why xl doesn't support the '-a' option for shutdown, to shutdown all domains ?
Quoted 6 lines
I'd never heard of it for one thing ;-)
It should be a reasonably easy patch -- I can give some pointers if you are interested.
Ian.
Could give it a try, although my C skills are virtually non existent :-) So every pointer could be handy !
I found out some more slightly related issues/inconsistencies:
- /etc/default/xendomains contains:
XENDOMAINS_SHUTDOWN="--halt --wait"
XENDOMAINS_SHUTDOWN_ALL="--all --halt --wait"
which are used by /etc/init.d/xendomains.
- man xm says:
shutdown [OPTIONS] domain-id
Gracefully shuts down a domain. This coordinates with the domain OS to perform graceful shutdown, so there is no guarantee that it will succeed, and may take a variable length of time depending on what services must be shutdown in the domain. The command returns immediately after signally the domain unless that -w flag is used.
The behavior of what happens to a domain when it reboots is set by the on_shutdown parameter of the xmdomain.cfg file when the domain was created.
OPTIONS
-a Shutdown all domains. Often used when doing a complete shutdown of a Xen system.
-w Wait for the domain to complete shutdown before returning.
- man xl says:
shutdown [OPTIONS] domain-id
Gracefully shuts down a domain. This coordinates with the domain OS to perform graceful shutdown, so there is no guarantee that it will succeed, and may take a variable length of time depending on what services must be shutdown in the domain.
For HVM domains this requires PV drivers to be installed in your guest OS. If PV drivers are not present but you have configured the guest OS to behave appropriately you may be able to use the -F option trigger a power button press.
The command returns immediately after signally the domain unless that -w flag is used.
The behavior of what happens to a domain when it reboots is set by the on_shutdown parameter of the domain configuration file when the domain was created.
OPTIONS
-w Wait for the domain to complete shutdown before returning.
-F If the guest does not support PV shutdown control then fallback to sending an ACPI power event (equivalent to the power option to trigger.
You should ensure that the guest is configured to behave as expected in response to this event.
- xm shutdown --help
Usage: xm shutdown <Domain> [-waRH]
There are two undocumented options "R" and "H"
So i have to:
- Implement the '-a' option
- Update docs that '-a' is supported
- Find out what "--halt" / "-H" did .. and perhaps implement that as well
- Change /etc/default to use the short option format, so it will work for both xm and xl
--
Sander
Quoted 17 lines · Sander Eikelenboom
Quoted 6 lines · you
Quoted 4 lines · Sander Eikelenboom
Hi All,
Is there any reason why xl doesn't support the '-a' option for shutdown, to shutdown all domains ?
Quoted 6 lines
I'd never heard of it for one thing ;-)
It should be a reasonably easy patch -- I can give some pointers if you are interested.
Ian.
Could give it a try, although my C skills are virtually non existent :-) So every pointer could be handy !
[...]
Quoted 1 line
- Implement the '-a' option
In the case where -a is given you want to call libxl_list_domain, then loop over the list and finally call libxl_dominfo_list_free.
main_list() might be a handy reference although its semantics are subtly different (it effective assumes -a if you don't give a domain, which you don't want for shutdown!)
vcpulist() might also be a handy reference.
Quoted 1 line
- Update docs that '-a' is supported
This should be the easiest bit ;-)
You also want to update xl_cmdtable.c to include the new option in xl help etc.
Quoted 1 line
- Find out what "--halt" / "-H" did .. and perhaps implement that as well
tools/python/xen/xm/shutdown.py says
gopts.opt('halt', short='H',
fn=set_true, default=0,
use='Shutdown without reboot.')which I guess means shutdown on xm can behave like xm reboot. Later on it does:
if opts.vals.halt:
return 'halt'
elif opts.vals.reboot:
return 'reboot'
else:
return 'poweroff'
i.e.
xm shutdown -H -> "halt" xm shutdown -R -> "reboot" xm shutdown -> "poweroff"
Linux in a guest treats "halt" and "poweroff" identically.
So I think --halt/-H is pointless and you can remove it from the defaults.
Quoted 1 line
- Change
/etc/defaultto use the short option format, so it will work for both xm and xl
In principal it is possible for xl to support long options too (see e.g. main_create, but changing the default would be OK for 4.2 IMHO.
Thanks for looking into this.
Ian.
Quoted 28 lines · you
Quoted 17 lines · Sander Eikelenboom
Quoted 6 lines · you
Quoted 4 lines · Sander Eikelenboom
Hi All,
Is there any reason why xl doesn't support the '-a' option for shutdown, to shutdown all domains ?
Quoted 6 lines
I'd never heard of it for one thing ;-)
It should be a reasonably easy patch -- I can give some pointers if you are interested.
Ian.
Could give it a try, although my C skills are virtually non existent :-) So every pointer could be handy !
[...]
Quoted 1 line
- Implement the '-a' option
In the case where -a is given you want to call
libxl_list_domain, then loop over the list and finally calllibxl_dominfo_list_free.
main_list()might be a handy reference although its semantics are subtly different (it effective assumes -a if you don't give a domain, which you don't want for shutdown!)
Quoted 5 lines
vcpulist()might also be a handy reference.Quoted 1 line
- Update docs that '-a' is supported
This should be the easiest bit ;-)
Yes it seems to be ...
Just hit another thing i'm wondering about ...
The docs say you have to supply a domain_id as argument. But if you supply a domain_name instead it works as well.
But what if i'm stupid enough to give my domain a number as name (which seems to be allowed/possible) In that case i can't shut it down by name:
serveerstertje:~# xl list Name ID Mem VCPUs State Time(s) Domain-0 0 1024 6 r----- 22318.7 media 12 256 1 -b---- 73.0 webproxy 14 768 5 -b---- 41385.2 www 15 507 2 -b---- 670.8 13 17 256 1 -b---- 3.2
13 17 256 1 -b---- 3.2
serveerstertje:~# xl shutdown 13 13 is an invalid domain identifier (rc=-6)
Quoted 37 lines
You also want to update
xl_cmdtable.cto include the new option in xl help etc.Quoted 1 line
- Find out what "--halt" / "-H" did .. and perhaps implement that as well
tools/python/xen/xm/shutdown.pysaysgopts.opt('halt', short='H', fn=set_true, default=0, use='Shutdown without reboot.')which I guess means shutdown on xm can behave like xm reboot. Later on it does:
if opts.vals.halt:
return 'halt'
elif opts.vals.reboot:
return 'reboot'
else:
return 'poweroff'i.e.
xm shutdown -H -> "halt" xm shutdown -R -> "reboot" xm shutdown -> "poweroff"Linux in a guest treats "halt" and "poweroff" identically.
So I think --halt/-H is pointless and you can remove it from the defaults.
Quoted 1 line
- Change
/etc/defaultto use the short option format, so it will work for both xm and xlIn principal it is possible for xl to support long options too (see e.g.
main_create, but changing the default would be OK for 4.2 IMHO.Thanks for looking into this.
Ian.
Quoted 2 lines · Sander Eikelenboom
The docs say you have to supply a
domain_idas argument. But if you supply adomain_nameinstead it works as well.
xl(1) says "domain-id is the numeric domain id, or the domain name (which will be internally translated to domain id)"
Quoted 13 lines
But what if i'm stupid enough to give my domain a number as name (which seems to be allowed/possible)
In that case i can't shut it down by name:
serveerstertje:~# xl list Name ID Mem VCPUs State Time(s) Domain-0 0 1024 6 r----- 22318.7 media 12 256 1 -b---- 73.0 webproxy 14 768 5 -b---- 41385.2 www 15 507 2 -b---- 670.8 13 17 256 1 -b---- 3.2
Quoted 3 lines
13 17 256 1 -b---- 3.2
serveerstertje:~# xl shutdown 13 13 is an invalid domain identifier (rc=-6)
I think this is a case of Don't Do That Then. If you want a patch to the manpage clarifying that users should avoid purely numeric domain names that would be nice.
Quoted 20 lines · you
Quoted 2 lines · Sander Eikelenboom
The docs say you have to supply a
domain_idas argument. But if you supply adomain_nameinstead it works as well.xl(1) says "domain-id is the numeric domain id, or the domain name (which will be internally translated to domain id)"
Quoted 13 lines
But what if i'm stupid enough to give my domain a number as name (which seems to be allowed/possible)
In that case i can't shut it down by name:
serveerstertje:~# xl list Name ID Mem VCPUs State Time(s) Domain-0 0 1024 6 r----- 22318.7 media 12 256 1 -b---- 73.0 webproxy 14 768 5 -b---- 41385.2 www 15 507 2 -b---- 670.8 13 17 256 1 -b---- 3.2
Quoted 7 lines
Quoted 3 lines
13 17 256 1 -b---- 3.2
serveerstertje:~# xl shutdown 13 13 is an invalid domain identifier (rc=-6)I think this is a case of Don't Do That Then. If you want a patch to the manpage clarifying that users should avoid purely numeric domain names that would be nice.
How acceptable would it be to make that explicit and enforce that policy on domain creation ?
Quoted 26 lines · Sander Eikelenboom
Quoted 23 lines · you
Quoted 2 lines · Sander Eikelenboom
The docs say you have to supply a
domain_idas argument. But if you supply adomain_nameinstead it works as well.xl(1) says "domain-id is the numeric domain id, or the domain name (which will be internally translated to domain id)"
Quoted 16 lines
But what if i'm stupid enough to give my domain a number as name (which seems to be allowed/possible)
In that case i can't shut it down by name:
serveerstertje:~# xl list Name ID Mem VCPUs State Time(s) Domain-0 0 1024 6 r----- 22318.7 media 12 256 1 -b---- 73.0 webproxy 14 768 5 -b---- 41385.2 www 15 507 2 -b---- 670.8 13 17 256 1 -b---- 3.213 17 256 1 -b---- 3.2
serveerstertje:~# xl shutdown 13 13 is an invalid domain identifier (rc=-6)
Quoted 5 lines
Quoted 3 lines
I think this is a case of Don't Do That Then. If you want a patch to the manpage clarifying that users should avoid purely numeric domain names that would be nice.
How acceptable would it be to make that explicit and enforce that policy on domain creation ?
I wouldn't object, but perhaps for 4.3 at this stage?
It can be documented before it is enforced though.