diff mbox

[v2] QMP: Introduce the documentation for query-netdev and info netdev

Message ID 1276878387-9489-1-git-send-email-miguel.filho@gmail.com
State New
Headers show

Commit Message

Miguel Di Ciurcio Filho June 18, 2010, 4:26 p.m. UTC
These commands show the information about active backend network devices.

Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
---
 qemu-monitor.hx |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 105 insertions(+), 0 deletions(-)

Comments

Anthony Liguori June 18, 2010, 8:28 p.m. UTC | #1
On 06/18/2010 11:26 AM, Miguel Di Ciurcio Filho wrote:
> These commands show the information about active backend network devices.
>
> Signed-off-by: Miguel Di Ciurcio Filho<miguel.filho@gmail.com>
> ---
>   qemu-monitor.hx |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 files changed, 105 insertions(+), 0 deletions(-)
>
> diff --git a/qemu-monitor.hx b/qemu-monitor.hx
> index 9f62b94..8fc5ed6 100644
> --- a/qemu-monitor.hx
> +++ b/qemu-monitor.hx
> @@ -1674,6 +1674,111 @@ show the various VLANs and the associated devices
>   ETEXI
>
>   STEXI
> +@item info netdev
> +show information about the current backend network devices
> +ETEXI
> +SQMP
> +query-netdev
> +------------
> +
> +Each device is represented by a json-object. The returned value is a json-array
> +of all devices.
> +
> +Each json-object contains the following:
> +
> +- "id": the device's ID, must be unique (json-string)
> +- "type": device type (json-string)
> +    - Possible values: "tap", "user", "vde", "socket"
> +- "vlan": QEMU's internal vlan identification. Only present if the device is
> +  attached to a VLAN (json-int, optional)
> +- "peer": ID of the frontend device when on a 1:1 relationship (json-string,
> +  optional)
>    

I think we should only return items with a valid peer property and drop 
anything attached to vlans.  The current info network already provides 
vlan information.

Regards,

Anthony Liguori
Luiz Capitulino June 18, 2010, 8:40 p.m. UTC | #2
On Fri, 18 Jun 2010 15:28:42 -0500
Anthony Liguori <anthony@codemonkey.ws> wrote:

> On 06/18/2010 11:26 AM, Miguel Di Ciurcio Filho wrote:
> > These commands show the information about active backend network devices.
> >
> > Signed-off-by: Miguel Di Ciurcio Filho<miguel.filho@gmail.com>
> > ---
> >   qemu-monitor.hx |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >   1 files changed, 105 insertions(+), 0 deletions(-)
> >
> > diff --git a/qemu-monitor.hx b/qemu-monitor.hx
> > index 9f62b94..8fc5ed6 100644
> > --- a/qemu-monitor.hx
> > +++ b/qemu-monitor.hx
> > @@ -1674,6 +1674,111 @@ show the various VLANs and the associated devices
> >   ETEXI
> >
> >   STEXI
> > +@item info netdev
> > +show information about the current backend network devices
> > +ETEXI
> > +SQMP
> > +query-netdev
> > +------------
> > +
> > +Each device is represented by a json-object. The returned value is a json-array
> > +of all devices.
> > +
> > +Each json-object contains the following:
> > +
> > +- "id": the device's ID, must be unique (json-string)
> > +- "type": device type (json-string)
> > +    - Possible values: "tap", "user", "vde", "socket"
> > +- "vlan": QEMU's internal vlan identification. Only present if the device is
> > +  attached to a VLAN (json-int, optional)
> > +- "peer": ID of the frontend device when on a 1:1 relationship (json-string,
> > +  optional)
> >    
> 
> I think we should only return items with a valid peer property and drop 
> anything attached to vlans.

 The reason is that we're going to completely drop the vlan stuff, right?

> The current info network already provides vlan information.

 What did you mean by that? info network is not going to be converted to QMP,
that's why we're doing query-netdev.

 If I got it right:

 - query-netdev: backend info
 - query-qdm: device info
Miguel Di Ciurcio Filho June 18, 2010, 9:15 p.m. UTC | #3
On Fri, Jun 18, 2010 at 5:28 PM, Anthony Liguori <anthony@codemonkey.ws> wrote:
> On 06/18/2010 11:26 AM, Miguel Di Ciurcio Filho wrote:
>>
>> These commands show the information about active backend network devices.
>>
>> Signed-off-by: Miguel Di Ciurcio Filho<miguel.filho@gmail.com>
>> ---
>>  qemu-monitor.hx |  105
>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  1 files changed, 105 insertions(+), 0 deletions(-)
>>
>> diff --git a/qemu-monitor.hx b/qemu-monitor.hx
>> index 9f62b94..8fc5ed6 100644
>> --- a/qemu-monitor.hx
>> +++ b/qemu-monitor.hx
>> @@ -1674,6 +1674,111 @@ show the various VLANs and the associated devices
>>  ETEXI
>>
>>  STEXI
>> +@item info netdev
>> +show information about the current backend network devices
>> +ETEXI
>> +SQMP
>> +query-netdev
>> +------------
>> +
>> +Each device is represented by a json-object. The returned value is a
>> json-array
>> +of all devices.
>> +
>> +Each json-object contains the following:
>> +
>> +- "id": the device's ID, must be unique (json-string)
>> +- "type": device type (json-string)
>> +    - Possible values: "tap", "user", "vde", "socket"
>> +- "vlan": QEMU's internal vlan identification. Only present if the device
>> is
>> +  attached to a VLAN (json-int, optional)
>> +- "peer": ID of the frontend device when on a 1:1 relationship
>> (json-string,
>> +  optional)
>>
>
> I think we should only return items with a valid peer property and drop
> anything attached to vlans.  The current info network already provides vlan
> information.
>

We need a strong compromise that sometime in the future, the qemu
"vlan" concept will be removed, deprecated, or something like that.
Otherwise we will end up with QMP not exporting networking
configuration that can be setup by a user or management software.

Previous discussions about the "vlan" removal:
http://lists.gnu.org/archive/html/qemu-devel/2010-06/msg00947.html

Will it break for some people? Yes, but the current status quo is not
good. Interconnecting virtual network devices should be done by
software like VDE or Open vSwitch on the host.

I think even devices without a peer must be listed. After a netdev_add
command, there is going to be no way to verify that the netdev is
there, only after adding a guest NIC associated with the netdev if we
put a restriction like that.

Regards,

Miguel
Anthony Liguori June 18, 2010, 9:20 p.m. UTC | #4
On 06/18/2010 04:15 PM, Miguel Di Ciurcio Filho wrote:
> On Fri, Jun 18, 2010 at 5:28 PM, Anthony Liguori<anthony@codemonkey.ws>  wrote:
>    
>> On 06/18/2010 11:26 AM, Miguel Di Ciurcio Filho wrote:
>>      
>>> These commands show the information about active backend network devices.
>>>
>>> Signed-off-by: Miguel Di Ciurcio Filho<miguel.filho@gmail.com>
>>> ---
>>>   qemu-monitor.hx |  105
>>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>   1 files changed, 105 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/qemu-monitor.hx b/qemu-monitor.hx
>>> index 9f62b94..8fc5ed6 100644
>>> --- a/qemu-monitor.hx
>>> +++ b/qemu-monitor.hx
>>> @@ -1674,6 +1674,111 @@ show the various VLANs and the associated devices
>>>   ETEXI
>>>
>>>   STEXI
>>> +@item info netdev
>>> +show information about the current backend network devices
>>> +ETEXI
>>> +SQMP
>>> +query-netdev
>>> +------------
>>> +
>>> +Each device is represented by a json-object. The returned value is a
>>> json-array
>>> +of all devices.
>>> +
>>> +Each json-object contains the following:
>>> +
>>> +- "id": the device's ID, must be unique (json-string)
>>> +- "type": device type (json-string)
>>> +    - Possible values: "tap", "user", "vde", "socket"
>>> +- "vlan": QEMU's internal vlan identification. Only present if the device
>>> is
>>> +  attached to a VLAN (json-int, optional)
>>> +- "peer": ID of the frontend device when on a 1:1 relationship
>>> (json-string,
>>> +  optional)
>>>
>>>        
>> I think we should only return items with a valid peer property and drop
>> anything attached to vlans.  The current info network already provides vlan
>> information.
>>
>>      
> We need a strong compromise that sometime in the future, the qemu
> "vlan" concept will be removed, deprecated, or something like that.
> Otherwise we will end up with QMP not exporting networking
> configuration that can be setup by a user or management software.
>    

One way or another, vlan will go away in the form it exists today.  I'm 
not sure how we're going to replace it yet but the notion that every 
device is always connected to a hub is not something that we can 
reasonably live with.

netdev has already killed it.  TBH, I don't think netdev should have a 
vlan tag.  In fact, I think a patch to remove that from the user 
interface would be a very good thing.

Regards,

Anthony Liguori
Markus Armbruster June 21, 2010, 8:23 a.m. UTC | #5
Anthony Liguori <anthony@codemonkey.ws> writes:

> On 06/18/2010 11:26 AM, Miguel Di Ciurcio Filho wrote:
>> These commands show the information about active backend network devices.
>>
>> Signed-off-by: Miguel Di Ciurcio Filho<miguel.filho@gmail.com>
>> ---
>>   qemu-monitor.hx |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>   1 files changed, 105 insertions(+), 0 deletions(-)
>>
>> diff --git a/qemu-monitor.hx b/qemu-monitor.hx
>> index 9f62b94..8fc5ed6 100644
>> --- a/qemu-monitor.hx
>> +++ b/qemu-monitor.hx
>> @@ -1674,6 +1674,111 @@ show the various VLANs and the associated devices
>>   ETEXI
>>
>>   STEXI
>> +@item info netdev
>> +show information about the current backend network devices
>> +ETEXI
>> +SQMP
>> +query-netdev
>> +------------
>> +
>> +Each device is represented by a json-object. The returned value is a json-array
>> +of all devices.
>> +
>> +Each json-object contains the following:
>> +
>> +- "id": the device's ID, must be unique (json-string)
>> +- "type": device type (json-string)
>> +    - Possible values: "tap", "user", "vde", "socket"
>> +- "vlan": QEMU's internal vlan identification. Only present if the device is
>> +  attached to a VLAN (json-int, optional)
>> +- "peer": ID of the frontend device when on a 1:1 relationship (json-string,
>> +  optional)
>>    
>
> I think we should only return items with a valid peer property and
> drop anything attached to vlans.  The current info network already
> provides vlan information.

Not quite.  Not having a valid peer doesn't imply connection to VLAN.

I also think we should keep VLAN-stuff as separate as possible, to ease
the transition away from it.

In implementation terms, I'd like query-netdev to cover the members of
non_vlan_clients that are not guest devices (info->type !=
NET_CLIENT_TYPE_NIC).  Member vlan should be ignored (it should always
be null).  Member peer points to the guest device, and may be null (no
guest device attached).
Markus Armbruster June 21, 2010, 8:27 a.m. UTC | #6
Luiz Capitulino <lcapitulino@redhat.com> writes:

> On Fri, 18 Jun 2010 15:28:42 -0500
> Anthony Liguori <anthony@codemonkey.ws> wrote:
>
>> On 06/18/2010 11:26 AM, Miguel Di Ciurcio Filho wrote:
>> > These commands show the information about active backend network devices.
>> >
>> > Signed-off-by: Miguel Di Ciurcio Filho<miguel.filho@gmail.com>
>> > ---
>> >   qemu-monitor.hx |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> >   1 files changed, 105 insertions(+), 0 deletions(-)
>> >
>> > diff --git a/qemu-monitor.hx b/qemu-monitor.hx
>> > index 9f62b94..8fc5ed6 100644
>> > --- a/qemu-monitor.hx
>> > +++ b/qemu-monitor.hx
>> > @@ -1674,6 +1674,111 @@ show the various VLANs and the associated devices
>> >   ETEXI
>> >
>> >   STEXI
>> > +@item info netdev
>> > +show information about the current backend network devices
>> > +ETEXI
>> > +SQMP
>> > +query-netdev
>> > +------------
>> > +
>> > +Each device is represented by a json-object. The returned value is a json-array
>> > +of all devices.
>> > +
>> > +Each json-object contains the following:
>> > +
>> > +- "id": the device's ID, must be unique (json-string)
>> > +- "type": device type (json-string)
>> > +    - Possible values: "tap", "user", "vde", "socket"
>> > +- "vlan": QEMU's internal vlan identification. Only present if the device is
>> > +  attached to a VLAN (json-int, optional)
>> > +- "peer": ID of the frontend device when on a 1:1 relationship (json-string,
>> > +  optional)
>> >    
>> 
>> I think we should only return items with a valid peer property and drop 
>> anything attached to vlans.
>
>  The reason is that we're going to completely drop the vlan stuff, right?
>
>> The current info network already provides vlan information.
>
>  What did you mean by that? info network is not going to be converted to QMP,
> that's why we're doing query-netdev.

If we want to cover VLANs in QMP, we can either cover them in
query-netdev, or provide a separate query, say query-vlans.  The latter
has the advantage that we won't have to mess with query-netdev when we
get rid of VLANs.

In my personal opinion, we should just ditch VLANs and be done with it.

>  If I got it right:
>
>  - query-netdev: backend info
>  - query-qdm: device info

I think you mean query-qtree.  query-qdm is about available device
models.
Luiz Capitulino June 21, 2010, 2:34 p.m. UTC | #7
On Mon, 21 Jun 2010 10:27:11 +0200
Markus Armbruster <armbru@redhat.com> wrote:

> Luiz Capitulino <lcapitulino@redhat.com> writes:
> 
> > On Fri, 18 Jun 2010 15:28:42 -0500
> > Anthony Liguori <anthony@codemonkey.ws> wrote:
> >
> >> On 06/18/2010 11:26 AM, Miguel Di Ciurcio Filho wrote:
> >> > These commands show the information about active backend network devices.
> >> >
> >> > Signed-off-by: Miguel Di Ciurcio Filho<miguel.filho@gmail.com>
> >> > ---
> >> >   qemu-monitor.hx |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >> >   1 files changed, 105 insertions(+), 0 deletions(-)
> >> >
> >> > diff --git a/qemu-monitor.hx b/qemu-monitor.hx
> >> > index 9f62b94..8fc5ed6 100644
> >> > --- a/qemu-monitor.hx
> >> > +++ b/qemu-monitor.hx
> >> > @@ -1674,6 +1674,111 @@ show the various VLANs and the associated devices
> >> >   ETEXI
> >> >
> >> >   STEXI
> >> > +@item info netdev
> >> > +show information about the current backend network devices
> >> > +ETEXI
> >> > +SQMP
> >> > +query-netdev
> >> > +------------
> >> > +
> >> > +Each device is represented by a json-object. The returned value is a json-array
> >> > +of all devices.
> >> > +
> >> > +Each json-object contains the following:
> >> > +
> >> > +- "id": the device's ID, must be unique (json-string)
> >> > +- "type": device type (json-string)
> >> > +    - Possible values: "tap", "user", "vde", "socket"
> >> > +- "vlan": QEMU's internal vlan identification. Only present if the device is
> >> > +  attached to a VLAN (json-int, optional)
> >> > +- "peer": ID of the frontend device when on a 1:1 relationship (json-string,
> >> > +  optional)
> >> >    
> >> 
> >> I think we should only return items with a valid peer property and drop 
> >> anything attached to vlans.
> >
> >  The reason is that we're going to completely drop the vlan stuff, right?
> >
> >> The current info network already provides vlan information.
> >
> >  What did you mean by that? info network is not going to be converted to QMP,
> > that's why we're doing query-netdev.
> 
> If we want to cover VLANs in QMP, we can either cover them in
> query-netdev, or provide a separate query, say query-vlans.  The latter
> has the advantage that we won't have to mess with query-netdev when we
> get rid of VLANs.
> 
> In my personal opinion, we should just ditch VLANs and be done with it.

 Agreed.

> 
> >  If I got it right:
> >
> >  - query-netdev: backend info
> >  - query-qdm: device info
> 
> I think you mean query-qtree.  query-qdm is about available device
> models.

 Yes.
Luiz Capitulino June 21, 2010, 2:42 p.m. UTC | #8
On Fri, 18 Jun 2010 13:26:27 -0300
Miguel Di Ciurcio Filho <miguel.filho@gmail.com> wrote:

> These commands show the information about active backend network devices.
> 
> Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
> ---
>  qemu-monitor.hx |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 105 insertions(+), 0 deletions(-)
> 
> diff --git a/qemu-monitor.hx b/qemu-monitor.hx
> index 9f62b94..8fc5ed6 100644
> --- a/qemu-monitor.hx
> +++ b/qemu-monitor.hx
> @@ -1674,6 +1674,111 @@ show the various VLANs and the associated devices
>  ETEXI
>  
>  STEXI
> +@item info netdev
> +show information about the current backend network devices
> +ETEXI
> +SQMP
> +query-netdev
> +------------
> +
> +Each device is represented by a json-object. The returned value is a json-array
> +of all devices.
> +
> +Each json-object contains the following:
> +
> +- "id": the device's ID, must be unique (json-string)

 There were some talking about changing this to 'device. Jan, Markus?

> +- "type": device type (json-string)
> +    - Possible values: "tap", "user", "vde", "socket"
> +- "vlan": QEMU's internal vlan identification. Only present if the device is
> +  attached to a VLAN (json-int, optional)
> +- "peer": ID of the frontend device when on a 1:1 relationship (json-string,
> +  optional)
> +- "info": json-object containing the configuration information about the device.
> +        - When "type" is "tap", the following values might be available:
> +            - "fd": available if connected to an already opened TAP interface
> +              (json-int, optional)
> +            - "script": path to an script used to configure the interface, if
> +              the value is "no" then no script is used. (json-string, only
> +              present if "fd" is not present)

 What if the script is called "no"? Better not to include the key in this case.

> +            - "downscript": path to an script used to deconfigure the interface,
> +              if the value is "no" then no script is used. (json-string, only
> +              present if "fd" is not present)

 Same as above.

> +            - "ifname": name of the attached host interface (json-string, only
> +              present if "fd" is not present)
> +            - "vhost": vhost acceleration status, true if enabled, false
> +              otherwise (json-boolean)
> +            - "vnet_hdr": true if the IFF_VNET_HDR flag must be set, false 
> +              otherwise (json-boolean)

 Why is vnet_hdr important?

> +            - "vhostfd": positive number if the device is connected to an
> +              already opened vhost net device, -1 otherwise (json-int)

 Making the key option is better, IMO.

> +            - "sndbuf": send buffer size, in bytes (json-int)
> +        - When "type" is "vde", the following values might be available:
> +            - "sock": path to the VDE listening socket (json-string)
> +            - "port": port number connected to virtual switch (json-int)
> +            - "group": group name (json-string)
> +            - "mode": permission mode, in octal (json-int)
> +        - When "type" is "user", the following values might be available:
> +            - "hostname": client hostname reported by the builtin DHCP server,
> +              (json-string, optional)
> +            - "restrict": true if guest is isolated from the host,
> +              false otherwise (json-boolean)
> +            - "net": network address (json-string)
> +            - "netmask": netmask (json-string)
> +            - "host": guest-visible address of the host (json-string)
> +            - "tftp": root directory of the built-in TFTP server (json-string,
> +              optional)
> +            - "bootfile": BOOTP filename (json-string, optional)
> +            - "dhcpstart": the first of the 16 IPs the built-in DHCP server can
> +              assign (json-string)
> +            - "dns": guest-visible address of the virtual nameserver
> +              (json-string)
> +            - "smb": root directory of the built-in SMB server (json-string,
> +              optional)
> +            - "smbserver": IP address of the built-in SMB server (json-string,
> +              optional)
> +            - "hostfwd": guest port number to forward incoming TCP or UDP
> +              connections (json-int, optional)
> +            - "guestfwd": IP address and port to forward guest TCP connections
> +              (json-int, optional)
> +        - When "type" is "socket", the following values might be available:
> +            - "host": IP address (json-string)
> +            - "service": port number (json-int)
> +            - "family": IP version, possible values "ipv4" or "ipv6"
> +              (json-string)
> +            - "server": true if the socket is receiving incoming connections,
> +              false otherwise (json-boolean)
> +
> +Example:
> +
> +-> { "execute": "query-netdev" }
> +<- {
> +      "return": [
> +         {
> +            "id": "tap.0",
> +            "type": "tap",
> +            "vlan": 0,
> +            "info": {
> +               "script": "/etc/qemu-ifup",
> +               "downscript": "/etc/qemu-ifdown",
> +               "ifname": "tap0",
> +               "vhost": true
> +            },
> +         },
> +         {
> +            "id": "user.0",
> +            "type": "user",
> +            "peer": "e1000.0",
> +            "info": {
> +               "net": "10.0.2.0",
> +               "netmask": "255.255.255.0"
> +            },
> +         },
> +      ]
> +   }
> +
> +EQMP
> +
> +STEXI
>  @item info chardev
>  show the character devices
>  ETEXI
Jan Kiszka June 21, 2010, 2:47 p.m. UTC | #9
Luiz Capitulino wrote:
> On Fri, 18 Jun 2010 13:26:27 -0300
> Miguel Di Ciurcio Filho <miguel.filho@gmail.com> wrote:
> 
>> These commands show the information about active backend network devices.
>>
>> Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
>> ---
>>  qemu-monitor.hx |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  1 files changed, 105 insertions(+), 0 deletions(-)
>>
>> diff --git a/qemu-monitor.hx b/qemu-monitor.hx
>> index 9f62b94..8fc5ed6 100644
>> --- a/qemu-monitor.hx
>> +++ b/qemu-monitor.hx
>> @@ -1674,6 +1674,111 @@ show the various VLANs and the associated devices
>>  ETEXI
>>  
>>  STEXI
>> +@item info netdev
>> +show information about the current backend network devices
>> +ETEXI
>> +SQMP
>> +query-netdev
>> +------------
>> +
>> +Each device is represented by a json-object. The returned value is a json-array
>> +of all devices.
>> +
>> +Each json-object contains the following:
>> +
>> +- "id": the device's ID, must be unique (json-string)
> 
>  There were some talking about changing this to 'device. Jan, Markus?

Only for qdev. Should be a different namespace here.

Jan
Markus Armbruster June 21, 2010, 4:44 p.m. UTC | #10
Jan Kiszka <jan.kiszka@siemens.com> writes:

> Luiz Capitulino wrote:
>> On Fri, 18 Jun 2010 13:26:27 -0300
>> Miguel Di Ciurcio Filho <miguel.filho@gmail.com> wrote:
>> 
>>> These commands show the information about active backend network devices.
>>>
>>> Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
>>> ---
>>>  qemu-monitor.hx |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>  1 files changed, 105 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/qemu-monitor.hx b/qemu-monitor.hx
>>> index 9f62b94..8fc5ed6 100644
>>> --- a/qemu-monitor.hx
>>> +++ b/qemu-monitor.hx
>>> @@ -1674,6 +1674,111 @@ show the various VLANs and the associated devices
>>>  ETEXI
>>>  
>>>  STEXI
>>> +@item info netdev
>>> +show information about the current backend network devices
>>> +ETEXI
>>> +SQMP
>>> +query-netdev
>>> +------------
>>> +
>>> +Each device is represented by a json-object. The returned value is a json-array
>>> +of all devices.
>>> +
>>> +Each json-object contains the following:
>>> +
>>> +- "id": the device's ID, must be unique (json-string)
>> 
>>  There were some talking about changing this to 'device. Jan, Markus?
>
> Only for qdev. Should be a different namespace here.

Huh?

We need to point to the NIC here, i.e. we need a unambigous name.
Device ID is fine, but it's optional.  Canonical qdev path?
Miguel Di Ciurcio Filho June 21, 2010, 5:58 p.m. UTC | #11
On Mon, Jun 21, 2010 at 11:42 AM, Luiz Capitulino
<lcapitulino@redhat.com> wrote:
>> +- "info": json-object containing the configuration information about the device.
>> +        - When "type" is "tap", the following values might be available:
>> +            - "fd": available if connected to an already opened TAP interface
>> +              (json-int, optional)
>> +            - "script": path to an script used to configure the interface, if
>> +              the value is "no" then no script is used. (json-string, only
>> +              present if "fd" is not present)
>
>  What if the script is called "no"? Better not to include the key in this case.

Actually, it can't be named "no". Because if the name is "no", qemu
does not run any script. net/tap.c:net_tap_init():391 and
net/tap.c:net_init_tap:():462.

$ qemu -netdev type=tap,script=no,downscript=no....

But, returning "no" is really not a good idea, indeed. If scripts were
disabled in the command line, "script" and "downscript" should not
exist.

>> +            - "downscript": path to an script used to deconfigure the interface,
>> +              if the value is "no" then no script is used. (json-string, only
>> +              present if "fd" is not present)
>
>  Same as above.
>
>> +            - "ifname": name of the attached host interface (json-string, only
>> +              present if "fd" is not present)
>> +            - "vhost": vhost acceleration status, true if enabled, false
>> +              otherwise (json-boolean)
>> +            - "vnet_hdr": true if the IFF_VNET_HDR flag must be set, false
>> +              otherwise (json-boolean)
>
>  Why is vnet_hdr important?

Because of this (quoting the command line docs):

"use vnet_hdr=off to avoid enabling the IFF_VNET_HDR tap flag
use vnet_hdr=on to make the lack of IFF_VNET_HDR support an error condition"

So if "vnet_hdr" is true, it means that the VM is effectively using the feature.

>
>> +            - "vhostfd": positive number if the device is connected to an
>> +              already opened vhost net device, -1 otherwise (json-int)
>
>  Making the key option is better, IMO.
>

Indeed, same case as "script" and "downscript".

Regards,

Miguel
Jan Kiszka June 22, 2010, 8:50 a.m. UTC | #12
Markus Armbruster wrote:
> Jan Kiszka <jan.kiszka@siemens.com> writes:
> 
>> Luiz Capitulino wrote:
>>> On Fri, 18 Jun 2010 13:26:27 -0300
>>> Miguel Di Ciurcio Filho <miguel.filho@gmail.com> wrote:
>>>
>>>> These commands show the information about active backend network devices.
>>>>
>>>> Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
>>>> ---
>>>>  qemu-monitor.hx |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>>  1 files changed, 105 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/qemu-monitor.hx b/qemu-monitor.hx
>>>> index 9f62b94..8fc5ed6 100644
>>>> --- a/qemu-monitor.hx
>>>> +++ b/qemu-monitor.hx
>>>> @@ -1674,6 +1674,111 @@ show the various VLANs and the associated devices
>>>>  ETEXI
>>>>  
>>>>  STEXI
>>>> +@item info netdev
>>>> +show information about the current backend network devices
>>>> +ETEXI
>>>> +SQMP
>>>> +query-netdev
>>>> +------------
>>>> +
>>>> +Each device is represented by a json-object. The returned value is a json-array
>>>> +of all devices.
>>>> +
>>>> +Each json-object contains the following:
>>>> +
>>>> +- "id": the device's ID, must be unique (json-string)
>>>  There were some talking about changing this to 'device. Jan, Markus?
>> Only for qdev. Should be a different namespace here.
> 
> Huh?
> 
> We need to point to the NIC here, i.e. we need a unambigous name.
> Device ID is fine, but it's optional.  Canonical qdev path?

Unless I'm still on the wrong track: 'peer' should point to the
front-end, this ID describes the back-end, and that's not a qdev thing.
Still, dumping the peer's qdev path along its (optional) ID might be
worth a thought.

Jan
Markus Armbruster June 22, 2010, 11:53 a.m. UTC | #13
Jan Kiszka <jan.kiszka@siemens.com> writes:

> Markus Armbruster wrote:
>> Jan Kiszka <jan.kiszka@siemens.com> writes:
>> 
>>> Luiz Capitulino wrote:
>>>> On Fri, 18 Jun 2010 13:26:27 -0300
>>>> Miguel Di Ciurcio Filho <miguel.filho@gmail.com> wrote:
>>>>
>>>>> These commands show the information about active backend network devices.
>>>>>
>>>>> Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
>>>>> ---
>>>>>  qemu-monitor.hx |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>>>  1 files changed, 105 insertions(+), 0 deletions(-)
>>>>>
>>>>> diff --git a/qemu-monitor.hx b/qemu-monitor.hx
>>>>> index 9f62b94..8fc5ed6 100644
>>>>> --- a/qemu-monitor.hx
>>>>> +++ b/qemu-monitor.hx
>>>>> @@ -1674,6 +1674,111 @@ show the various VLANs and the associated devices
>>>>>  ETEXI
>>>>>  
>>>>>  STEXI
>>>>> +@item info netdev
>>>>> +show information about the current backend network devices
>>>>> +ETEXI
>>>>> +SQMP
>>>>> +query-netdev
>>>>> +------------
>>>>> +
>>>>> +Each device is represented by a json-object. The returned value is a json-array
>>>>> +of all devices.
>>>>> +
>>>>> +Each json-object contains the following:
>>>>> +
>>>>> +- "id": the device's ID, must be unique (json-string)
>>>>  There were some talking about changing this to 'device. Jan, Markus?
>>> Only for qdev. Should be a different namespace here.
>> 
>> Huh?
>> 
>> We need to point to the NIC here, i.e. we need a unambigous name.
>> Device ID is fine, but it's optional.  Canonical qdev path?
>
> Unless I'm still on the wrong track: 'peer' should point to the
> front-end, this ID describes the back-end, and that's not a qdev thing.
> Still, dumping the peer's qdev path along its (optional) ID might be
> worth a thought.

One of us is probably confused, and it could well be me :)

Frontend / backend is difficult for the directionally challenged, so
let's use "guest NIC" and "host network device".

A guest NIC's peer points to a host network device, and vice versa.

query-netdev is about host network devices.  Thus, peer identifes a
guest NIC.
diff mbox

Patch

diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 9f62b94..8fc5ed6 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -1674,6 +1674,111 @@  show the various VLANs and the associated devices
 ETEXI
 
 STEXI
+@item info netdev
+show information about the current backend network devices
+ETEXI
+SQMP
+query-netdev
+------------
+
+Each device is represented by a json-object. The returned value is a json-array
+of all devices.
+
+Each json-object contains the following:
+
+- "id": the device's ID, must be unique (json-string)
+- "type": device type (json-string)
+    - Possible values: "tap", "user", "vde", "socket"
+- "vlan": QEMU's internal vlan identification. Only present if the device is
+  attached to a VLAN (json-int, optional)
+- "peer": ID of the frontend device when on a 1:1 relationship (json-string,
+  optional)
+- "info": json-object containing the configuration information about the device.
+        - When "type" is "tap", the following values might be available:
+            - "fd": available if connected to an already opened TAP interface
+              (json-int, optional)
+            - "script": path to an script used to configure the interface, if
+              the value is "no" then no script is used. (json-string, only
+              present if "fd" is not present)
+            - "downscript": path to an script used to deconfigure the interface,
+              if the value is "no" then no script is used. (json-string, only
+              present if "fd" is not present)
+            - "ifname": name of the attached host interface (json-string, only
+              present if "fd" is not present)
+            - "vhost": vhost acceleration status, true if enabled, false
+              otherwise (json-boolean)
+            - "vnet_hdr": true if the IFF_VNET_HDR flag must be set, false 
+              otherwise (json-boolean)
+            - "vhostfd": positive number if the device is connected to an
+              already opened vhost net device, -1 otherwise (json-int)
+            - "sndbuf": send buffer size, in bytes (json-int)
+        - When "type" is "vde", the following values might be available:
+            - "sock": path to the VDE listening socket (json-string)
+            - "port": port number connected to virtual switch (json-int)
+            - "group": group name (json-string)
+            - "mode": permission mode, in octal (json-int)
+        - When "type" is "user", the following values might be available:
+            - "hostname": client hostname reported by the builtin DHCP server,
+              (json-string, optional)
+            - "restrict": true if guest is isolated from the host,
+              false otherwise (json-boolean)
+            - "net": network address (json-string)
+            - "netmask": netmask (json-string)
+            - "host": guest-visible address of the host (json-string)
+            - "tftp": root directory of the built-in TFTP server (json-string,
+              optional)
+            - "bootfile": BOOTP filename (json-string, optional)
+            - "dhcpstart": the first of the 16 IPs the built-in DHCP server can
+              assign (json-string)
+            - "dns": guest-visible address of the virtual nameserver
+              (json-string)
+            - "smb": root directory of the built-in SMB server (json-string,
+              optional)
+            - "smbserver": IP address of the built-in SMB server (json-string,
+              optional)
+            - "hostfwd": guest port number to forward incoming TCP or UDP
+              connections (json-int, optional)
+            - "guestfwd": IP address and port to forward guest TCP connections
+              (json-int, optional)
+        - When "type" is "socket", the following values might be available:
+            - "host": IP address (json-string)
+            - "service": port number (json-int)
+            - "family": IP version, possible values "ipv4" or "ipv6"
+              (json-string)
+            - "server": true if the socket is receiving incoming connections,
+              false otherwise (json-boolean)
+
+Example:
+
+-> { "execute": "query-netdev" }
+<- {
+      "return": [
+         {
+            "id": "tap.0",
+            "type": "tap",
+            "vlan": 0,
+            "info": {
+               "script": "/etc/qemu-ifup",
+               "downscript": "/etc/qemu-ifdown",
+               "ifname": "tap0",
+               "vhost": true
+            },
+         },
+         {
+            "id": "user.0",
+            "type": "user",
+            "peer": "e1000.0",
+            "info": {
+               "net": "10.0.2.0",
+               "netmask": "255.255.255.0"
+            },
+         },
+      ]
+   }
+
+EQMP
+
+STEXI
 @item info chardev
 show the character devices
 ETEXI