All of lore.kernel.org
 help / color / mirror / Atom feed
* xl / xend feature parity: Missing '-a' option for xl 'shutdown' to shutdown all domains
@ 2012-08-31 10:49 Sander Eikelenboom
  2012-08-31 10:55 ` Ian Campbell
  0 siblings, 1 reply; 8+ messages in thread
From: Sander Eikelenboom @ 2012-08-31 10:49 UTC (permalink / raw)
  To: xen-devel

Hi All,

Is there any reason why xl doesn't support the '-a' option for shutdown,  to shutdown all domains ?

--

Sander

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xl / xend feature parity: Missing '-a' option for xl 'shutdown' to shutdown all domains
  2012-08-31 10:49 xl / xend feature parity: Missing '-a' option for xl 'shutdown' to shutdown all domains Sander Eikelenboom
@ 2012-08-31 10:55 ` Ian Campbell
  2012-08-31 11:32   ` Sander Eikelenboom
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Campbell @ 2012-08-31 10:55 UTC (permalink / raw)
  To: Sander Eikelenboom; +Cc: xen-devel

On Fri, 2012-08-31 at 11:49 +0100, Sander Eikelenboom wrote:
> 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xl / xend feature parity: Missing '-a' option for xl 'shutdown' to shutdown all domains
  2012-08-31 10:55 ` Ian Campbell
@ 2012-08-31 11:32   ` Sander Eikelenboom
  2012-08-31 11:52     ` Ian Campbell
  0 siblings, 1 reply; 8+ messages in thread
From: Sander Eikelenboom @ 2012-08-31 11:32 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel


Friday, August 31, 2012, 12:55:06 PM, you wrote:

> On Fri, 2012-08-31 at 11:49 +0100, Sander Eikelenboom wrote:
>> 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.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xl / xend feature parity: Missing '-a' option for xl 'shutdown' to shutdown all domains
  2012-08-31 11:32   ` Sander Eikelenboom
@ 2012-08-31 11:52     ` Ian Campbell
  2012-09-05 10:43       ` Sander Eikelenboom
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Campbell @ 2012-08-31 11:52 UTC (permalink / raw)
  To: Sander Eikelenboom; +Cc: xen-devel

On Fri, 2012-08-31 at 12:32 +0100, Sander Eikelenboom wrote:
> Friday, August 31, 2012, 12:55:06 PM, you wrote:
> 
> > On Fri, 2012-08-31 at 11:49 +0100, Sander Eikelenboom wrote:
> >> 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.
> 
> Could give it a try, although my C skills are virtually non existent :-)
> So every pointer could be handy !
[...]
>      - 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.

>      - 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.

>      - 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.

>      - Change /etc/default to 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xl / xend feature parity: Missing '-a' option for xl 'shutdown' to shutdown all domains
  2012-08-31 11:52     ` Ian Campbell
@ 2012-09-05 10:43       ` Sander Eikelenboom
  2012-09-05 10:52         ` Ian Campbell
  0 siblings, 1 reply; 8+ messages in thread
From: Sander Eikelenboom @ 2012-09-05 10:43 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel


Friday, August 31, 2012, 1:52:18 PM, you wrote:

> On Fri, 2012-08-31 at 12:32 +0100, Sander Eikelenboom wrote:
>> Friday, August 31, 2012, 12:55:06 PM, you wrote:
>> 
>> > On Fri, 2012-08-31 at 11:49 +0100, Sander Eikelenboom wrote:
>> >> 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.
>> 
>> Could give it a try, although my C skills are virtually non existent :-)
>> So every pointer could be handy !
> [...]
>>      - 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.

>>      - 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)



> You also want to update xl_cmdtable.c to include the new option in xl
> help etc.

>>      - 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.

>>      - Change /etc/default to 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xl / xend feature parity: Missing '-a' option for xl 'shutdown' to shutdown all domains
  2012-09-05 10:43       ` Sander Eikelenboom
@ 2012-09-05 10:52         ` Ian Campbell
  2012-09-05 10:55           ` Sander Eikelenboom
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Campbell @ 2012-09-05 10:52 UTC (permalink / raw)
  To: Sander Eikelenboom; +Cc: xen-devel

On Wed, 2012-09-05 at 11:43 +0100, Sander Eikelenboom wrote:
> The docs say you have to supply a domain_id as argument.
> But if you supply a domain_name instead 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)"

> 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)

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xl / xend feature parity: Missing '-a' option for xl 'shutdown' to shutdown all domains
  2012-09-05 10:52         ` Ian Campbell
@ 2012-09-05 10:55           ` Sander Eikelenboom
  2012-09-05 11:00             ` Ian Campbell
  0 siblings, 1 reply; 8+ messages in thread
From: Sander Eikelenboom @ 2012-09-05 10:55 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel


Wednesday, September 5, 2012, 12:52:00 PM, you wrote:

> On Wed, 2012-09-05 at 11:43 +0100, Sander Eikelenboom wrote:
>> The docs say you have to supply a domain_id as argument.
>> But if you supply a domain_name instead 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)"

>> 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)

> 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 ?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: xl / xend feature parity: Missing '-a' option for xl 'shutdown' to shutdown all domains
  2012-09-05 10:55           ` Sander Eikelenboom
@ 2012-09-05 11:00             ` Ian Campbell
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Campbell @ 2012-09-05 11:00 UTC (permalink / raw)
  To: Sander Eikelenboom; +Cc: xen-devel

On Wed, 2012-09-05 at 11:55 +0100, Sander Eikelenboom wrote:
> Wednesday, September 5, 2012, 12:52:00 PM, you wrote:
> 
> > On Wed, 2012-09-05 at 11:43 +0100, Sander Eikelenboom wrote:
> >> The docs say you have to supply a domain_id as argument.
> >> But if you supply a domain_name instead 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)"
> 
> >> 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)
> 
> > 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-09-05 11:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-31 10:49 xl / xend feature parity: Missing '-a' option for xl 'shutdown' to shutdown all domains Sander Eikelenboom
2012-08-31 10:55 ` Ian Campbell
2012-08-31 11:32   ` Sander Eikelenboom
2012-08-31 11:52     ` Ian Campbell
2012-09-05 10:43       ` Sander Eikelenboom
2012-09-05 10:52         ` Ian Campbell
2012-09-05 10:55           ` Sander Eikelenboom
2012-09-05 11:00             ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.