From: Ian Campbell Subject: Re: xl / xend feature parity: Missing '-a' option for xl 'shutdown' to shutdown all domains Date: Fri, 31 Aug 2012 12:52:18 +0100 Message-ID: <1346413938.27277.196.camel@zakaz.uk.xensource.com> References: <885821548.20120831124902@eikelenboom.it> <1346410506.27277.179.camel@zakaz.uk.xensource.com> <1342800738.20120831133238@eikelenboom.it> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1342800738.20120831133238@eikelenboom.it> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Sander Eikelenboom Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org 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.