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

2015-10-09 Thread Chun Yan Liu


>>> On 10/2/2015 at 01:02 AM, in message <560d6733.4030...@citrix.com>, 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], at which point you replied "That could be, 
> I can update".  But you didn't change the interface in v3, so I 
> suggested it again[2], and there was no argument or discussion about it. 
>  
> (There was a long back-and-forth with Juergen at that point about 
> usb-assignable-list, so [2] may have gotten lost in the noise.) 
>  
> I still think that's the best interface to use.  Do you have reasons to 
> favor the interface you propose here?

Sorry for replying late, just back from holiday.

It's my fault not updating it, missing that after a lot of other changes, not
favor this or that. Thanks for reminding again.

- Chunyan

>  
>  -George 
>  
> [1] 
> marc.info/?i=  
>om> 
>  
> [2] 
> marc.info/?i= com> 
>  
> >  
> >  #xl usb-list test_vm 
> >  will show the usb controllers and port usage under the domain. 
> >  
> >  #xl usb-attach test_vm 1.6 
> >  will find the first usable controller:port, and attach usb 
> >  device whose bus address is 1.6 (busnum is 1, devnum is 6) 
> >  to it. One could also specify which  and which . 
> >  
> >  #xl usb-detach test_vm 0 1 
> >  will detach USB device under controller 0 port 1. 
> >  
> >  #xl usb-ctrl-detach test_vm dev_id 
> >  will destroy the controller with specified dev_id. Dev_id 
> >  can be traced in usb-list info. 
> >  
> > Signed-off-by: Chunyan Liu  
> > Signed-off-by: Simon Cao  
> > --- 
> >  docs/man/xl.pod.1 |  40  
> >  tools/libxl/xl.h  |   5 + 
> >  tools/libxl/xl_cmdimpl.c  | 232  
> ++ 
> >  tools/libxl/xl_cmdtable.c |  25 + 
> >  4 files changed, 302 insertions(+) 
> >  
> > diff --git a/docs/man/xl.pod.1 b/docs/man/xl.pod.1 
> > index f22c3f3..4c92c78 100644 
> > --- a/docs/man/xl.pod.1 
> > +++ b/docs/man/xl.pod.1 
> > @@ -1345,6 +1345,46 @@ List pass-through pci devices for a domain. 
> >   
> >  =back 
> >   
> > +=head1 USB PASS-THROUGH 
> > + 
> > +=over 4 
> > + 
> > +=item B I 

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

2015-10-02 Thread George Dunlap
On Fri, Oct 2, 2015 at 2:35 PM, Ian Campbell  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-yc8dyvaiyszvra3h2e8496vhnefvrm...@mail.gmail.com>
>
> 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
>
> I also agree that we should try and do something similar here unless there
> is a compelling reason we can't.

I didn't realize that. +1

 -George

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


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

2015-10-02 Thread Ian Campbell
On Fri, 2015-10-02 at 16:17 +0100, George Dunlap wrote:
> On Fri, Oct 2, 2015 at 2:35 PM, Ian Campbell 
> 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-yc8dyvaiyszvra3h2e8496vhnefvrm...@mail.gmail.com>
> > 
> > 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@lists.xen.org
http://lists.xen.org/xen-devel


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

2015-10-01 Thread George Dunlap
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], at which point you replied "That could be,
I can update".  But you didn't change the interface in v3, so I
suggested it again[2], and there was no argument or discussion about it.

(There was a long back-and-forth with Juergen at that point about
usb-assignable-list, so [2] may have gotten lost in the noise.)

I still think that's the best interface to use.  Do you have reasons to
favor the interface you propose here?

 -George

[1]
marc.info/?i=

[2]
marc.info/?i=

> 
>  #xl usb-list test_vm
>  will show the usb controllers and port usage under the domain.
> 
>  #xl usb-attach test_vm 1.6
>  will find the first usable controller:port, and attach usb
>  device whose bus address is 1.6 (busnum is 1, devnum is 6)
>  to it. One could also specify which  and which .
> 
>  #xl usb-detach test_vm 0 1
>  will detach USB device under controller 0 port 1.
> 
>  #xl usb-ctrl-detach test_vm dev_id
>  will destroy the controller with specified dev_id. Dev_id
>  can be traced in usb-list info.
> 
> Signed-off-by: Chunyan Liu 
> Signed-off-by: Simon Cao 
> ---
>  docs/man/xl.pod.1 |  40 
>  tools/libxl/xl.h  |   5 +
>  tools/libxl/xl_cmdimpl.c  | 232 
> ++
>  tools/libxl/xl_cmdtable.c |  25 +
>  4 files changed, 302 insertions(+)
> 
> diff --git a/docs/man/xl.pod.1 b/docs/man/xl.pod.1
> index f22c3f3..4c92c78 100644
> --- a/docs/man/xl.pod.1
> +++ b/docs/man/xl.pod.1
> @@ -1345,6 +1345,46 @@ List pass-through pci devices for a domain.
>  
>  =back
>  
> +=head1 USB PASS-THROUGH
> +
> +=over 4
> +
> +=item B I 

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

2015-09-24 Thread Chunyan Liu
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

 #xl usb-list test_vm
 will show the usb controllers and port usage under the domain.

 #xl usb-attach test_vm 1.6
 will find the first usable controller:port, and attach usb
 device whose bus address is 1.6 (busnum is 1, devnum is 6)
 to it. One could also specify which  and which .

 #xl usb-detach test_vm 0 1
 will detach USB device under controller 0 port 1.

 #xl usb-ctrl-detach test_vm dev_id
 will destroy the controller with specified dev_id. Dev_id
 can be traced in usb-list info.

Signed-off-by: Chunyan Liu 
Signed-off-by: Simon Cao 
---
 docs/man/xl.pod.1 |  40 
 tools/libxl/xl.h  |   5 +
 tools/libxl/xl_cmdimpl.c  | 232 ++
 tools/libxl/xl_cmdtable.c |  25 +
 4 files changed, 302 insertions(+)

diff --git a/docs/man/xl.pod.1 b/docs/man/xl.pod.1
index f22c3f3..4c92c78 100644
--- a/docs/man/xl.pod.1
+++ b/docs/man/xl.pod.1
@@ -1345,6 +1345,46 @@ List pass-through pci devices for a domain.
 
 =back
 
+=head1 USB PASS-THROUGH
+
+=over 4
+
+=item B I