[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH V7 5/7] xl: add pvusb commands



On Fri, 2015-10-02 at 16:17 +0100, George Dunlap wrote:
> On Fri, Oct 2, 2015 at 2:35 PM, Ian Campbell <ian.campbell@xxxxxxxxxx>
> wrote:
> > On Thu, 2015-10-01 at 18:02 +0100, George Dunlap wrote:
> > > On 25/09/15 03:11, Chunyan Liu wrote:
> > > > Add pvusb commands: usb-ctrl-attach, usb-ctrl-detach, usb-list,
> > > > usb-attach and usb-detach.
> > > > 
> > > > To attach a usb device to guest through pvusb, one could follow
> > > > following example:
> > > > 
> > > >  #xl usb-ctrl-attach test_vm version=1 num_ports=8
> > > 
> > > So all the way back in v2 of this series, I suggested making the
> > > arguments for usb-ctrl-attach and usb-attach mirror the format that
> > > is
> > > found in the config file[1]
> > > [...]
> > > [1]
> > > marc.info/?i=<
> > > CAFLBxZb1N3_9PVvg-yC8dyVaiySZVRA3H2e8496vHNEfvrm6Zg@xxxxxxxxxxxxxx>
> > 
> > Re: xl usb-ctrl-attach test_vm name=pv-1,type=pv,version=1,ports=8
> > 
> > FWIW I think most of the existing ones allow (but don't require) a
> > slight
> > difference in the cli version, which is that they allow space spearated
> > lists as well as command separate, which ends up a bit more natural:
> > 
> >     xl usb-ctrl-attach test_vm name=pv-1 type=pv version=1 ports=8
> > 
[...]

BTW this is generally pretty easy to arrange, You have a helper:
    parse_foo(const char *s, libxl_foo *foo) 
which takes a comma separate list "s" and _incremntally_ updates the object
"foo" which it was given.

Then when parsing the cfg file you call parse_foo on the string and when
parsing the command line you call parse_foo for every argv (with the same
object).

See e.g. parse_nic_config in xl_cmdimpl.c.

Disk does it a bit differently with parse_disk_config and
parse_disk_config_multistring, where the latter effectively incorporates
the loop over argv.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.