[libvirt] [PATCH v4 5/8] screenshot: Expose the new API in virsh

Daniel P. Berrange berrange at redhat.com
Mon May 16 08:56:51 UTC 2011


On Fri, May 13, 2011 at 05:18:27PM -0600, Eric Blake wrote:
> On 05/13/2011 03:16 AM, Daniel P. Berrange wrote:
> > On Thu, May 12, 2011 at 06:29:12PM +0200, Michal Privoznik wrote:
> >> +static const vshCmdOptDef opts_screenshot[] = {
> >> +    {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
> >> +    {"file", VSH_OT_DATA, VSH_OFLAG_REQ, N_("where to store the screenshot")},
> >> +    {"screen", VSH_OT_INT, 0, N_("ID of a screen to take screenshot of")},
> >> +    {NULL, 0, 0, NULL}
> >> +};
> >> +
> 
> > I think it would be better if 'screenID' was a flag instead of a
> > positional parameter, eg
> > 
> >       screenshot --screen 1 myguest imagefile.png
> 
> But virsh _already_ handles all named arguments in any order.  That is,
> 
> screenshot --screen 1 myguest imagefile.png
> screenshot myguest imagefile.png 1
> 
> are identical, at least with the above opts_screenshot (thanks to commit
> b9973f5).

I don't see how that could work, if you want to make filename
optional. Since if you have

   screenshot myguest 1

it can't determine whether '1' is a screen number or filename. Thus
we have to use --screen for this

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list