diff mbox series

[1/3] qapi/net: Add new QMP command for COLO passthrough

Message ID 20201224010918.19275-2-chen.zhang@intel.com (mailing list archive)
State New, archived
Headers show
Series Bypass specific network traffic in COLO | expand

Commit Message

Zhang Chen Dec. 24, 2020, 1:09 a.m. UTC
From: Zhang Chen <chen.zhang@intel.com>

Since the real user scenario does not need to monitor all traffic.
Add colo-passthrough-add and colo-passthrough-del to maintain
a COLO network passthrough list.

Signed-off-by: Zhang Chen <chen.zhang@intel.com>
---
 net/net.c     | 12 ++++++++++++
 qapi/net.json | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)

Comments

Jason Wang Dec. 25, 2020, 6:20 a.m. UTC | #1
On 2020/12/24 上午9:09, Zhang Chen wrote:
> From: Zhang Chen <chen.zhang@intel.com>
>
> Since the real user scenario does not need to monitor all traffic.
> Add colo-passthrough-add and colo-passthrough-del to maintain
> a COLO network passthrough list.
>
> Signed-off-by: Zhang Chen <chen.zhang@intel.com>
> ---
>   net/net.c     | 12 ++++++++++++
>   qapi/net.json | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 58 insertions(+)
>
> diff --git a/net/net.c b/net/net.c
> index e1035f21d1..eac7a92618 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -1151,6 +1151,18 @@ void qmp_netdev_del(const char *id, Error **errp)
>       qemu_del_net_client(nc);
>   }
>   
> +void qmp_colo_passthrough_add(const char *prot, const uint32_t port,
> +                              Error **errp)
> +{
> +    /* Setup passthrough connection */
> +}
> +
> +void qmp_colo_passthrough_del(const char *prot, const uint32_t port,
> +                              Error **errp)
> +{
> +    /* Delete passthrough connection */
> +}
> +
>   static void netfilter_print_info(Monitor *mon, NetFilterState *nf)
>   {
>       char *str;
> diff --git a/qapi/net.json b/qapi/net.json
> index c31748c87f..466c29714e 100644
> --- a/qapi/net.json
> +++ b/qapi/net.json
> @@ -714,3 +714,49 @@
>   ##
>   { 'event': 'FAILOVER_NEGOTIATED',
>     'data': {'device-id': 'str'} }
> +
> +##
> +# @colo-passthrough-add:
> +#
> +# Add passthrough entry according to customer's needs in COLO-compare.
> +#
> +# @protocol: COLO passthrough just support TCP and UDP.
> +#
> +# @port: TCP or UDP port number.
> +#
> +# Returns: Nothing on success
> +#
> +# Since: 5.3
> +#
> +# Example:
> +#
> +# -> { "execute": "colo-passthrough-add",
> +#      "arguments": { "protocol": "tcp", "port": 3389 } }
> +# <- { "return": {} }
> +#
> +##
> +{ 'command': 'colo-passthrough-add',
> +     'data': {'protocol': 'str', 'port': 'uint32'} }


Do we plan to support 4-tuple (src ip,src port, dst ip, dst port) in the 
future? If yes, let's add them now.

And do we plan to support wildcard here?

Thanks


> +
> +##
> +# @colo-passthrough-del:
> +#
> +# Delete passthrough entry according to customer's needs in COLO-compare.
> +#
> +# @protocol: COLO passthrough just support TCP and UDP.
> +#
> +# @port: TCP or UDP port number.
> +#
> +# Returns: Nothing on success
> +#
> +# Since: 5.3
> +#
> +# Example:
> +#
> +# -> { "execute": "colo-passthrough-del",
> +#      "arguments": { "protocol": "tcp", "port": 3389 } }
> +# <- { "return": {} }
> +#
> +##
> +{ 'command': 'colo-passthrough-del',
> +     'data': {'protocol': 'str', 'port': 'uint32'} }
Zhang Chen Dec. 28, 2020, 12:38 a.m. UTC | #2
> -----Original Message-----
> From: Jason Wang <jasowang@redhat.com>
> Sent: Friday, December 25, 2020 2:20 PM
> To: Zhang, Chen <chen.zhang@intel.com>; qemu-dev <qemu-
> devel@nongnu.org>; Eric Blake <eblake@redhat.com>; Dr. David Alan
> Gilbert <dgilbert@redhat.com>; Markus Armbruster <armbru@redhat.com>
> Cc: Zhang Chen <zhangckid@gmail.com>
> Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO
> passthrough
> 
> 
> On 2020/12/24 上午9:09, Zhang Chen wrote:
> > From: Zhang Chen <chen.zhang@intel.com>
> >
> > Since the real user scenario does not need to monitor all traffic.
> > Add colo-passthrough-add and colo-passthrough-del to maintain a COLO
> > network passthrough list.
> >
> > Signed-off-by: Zhang Chen <chen.zhang@intel.com>
> > ---
> >   net/net.c     | 12 ++++++++++++
> >   qapi/net.json | 46
> ++++++++++++++++++++++++++++++++++++++++++++++
> >   2 files changed, 58 insertions(+)
> >
> > diff --git a/net/net.c b/net/net.c
> > index e1035f21d1..eac7a92618 100644
> > --- a/net/net.c
> > +++ b/net/net.c
> > @@ -1151,6 +1151,18 @@ void qmp_netdev_del(const char *id, Error
> **errp)
> >       qemu_del_net_client(nc);
> >   }
> >
> > +void qmp_colo_passthrough_add(const char *prot, const uint32_t port,
> > +                              Error **errp) {
> > +    /* Setup passthrough connection */ }
> > +
> > +void qmp_colo_passthrough_del(const char *prot, const uint32_t port,
> > +                              Error **errp) {
> > +    /* Delete passthrough connection */ }
> > +
> >   static void netfilter_print_info(Monitor *mon, NetFilterState *nf)
> >   {
> >       char *str;
> > diff --git a/qapi/net.json b/qapi/net.json index
> > c31748c87f..466c29714e 100644
> > --- a/qapi/net.json
> > +++ b/qapi/net.json
> > @@ -714,3 +714,49 @@
> >   ##
> >   { 'event': 'FAILOVER_NEGOTIATED',
> >     'data': {'device-id': 'str'} }
> > +
> > +##
> > +# @colo-passthrough-add:
> > +#
> > +# Add passthrough entry according to customer's needs in COLO-compare.
> > +#
> > +# @protocol: COLO passthrough just support TCP and UDP.
> > +#
> > +# @port: TCP or UDP port number.
> > +#
> > +# Returns: Nothing on success
> > +#
> > +# Since: 5.3
> > +#
> > +# Example:
> > +#
> > +# -> { "execute": "colo-passthrough-add",
> > +#      "arguments": { "protocol": "tcp", "port": 3389 } }
> > +# <- { "return": {} }
> > +#
> > +##
> > +{ 'command': 'colo-passthrough-add',
> > +     'data': {'protocol': 'str', 'port': 'uint32'} }
> 
> 
> Do we plan to support 4-tuple (src ip,src port, dst ip, dst port) in the future? If
> yes, let's add them now.
> 
> And do we plan to support wildcard here?

I think just using the port is enough for COLO compare.
Because in this case, users need passthrough some guest services are distinguished by static ports.
And for support 4-tuple and wildcard are a good question, do you think we should add some passthrough
Mechanism for all Qemu net filter? If yes, we should support that in the future.

Thanks
Chen

> 
> Thanks
> 
> 
> > +
> > +##
> > +# @colo-passthrough-del:
> > +#
> > +# Delete passthrough entry according to customer's needs in COLO-
> compare.
> > +#
> > +# @protocol: COLO passthrough just support TCP and UDP.
> > +#
> > +# @port: TCP or UDP port number.
> > +#
> > +# Returns: Nothing on success
> > +#
> > +# Since: 5.3
> > +#
> > +# Example:
> > +#
> > +# -> { "execute": "colo-passthrough-del",
> > +#      "arguments": { "protocol": "tcp", "port": 3389 } }
> > +# <- { "return": {} }
> > +#
> > +##
> > +{ 'command': 'colo-passthrough-del',
> > +     'data': {'protocol': 'str', 'port': 'uint32'} }
Jason Wang Dec. 28, 2020, 7:11 a.m. UTC | #3
On 2020/12/28 上午8:38, Zhang, Chen wrote:
>
>> -----Original Message-----
>> From: Jason Wang <jasowang@redhat.com>
>> Sent: Friday, December 25, 2020 2:20 PM
>> To: Zhang, Chen <chen.zhang@intel.com>; qemu-dev <qemu-
>> devel@nongnu.org>; Eric Blake <eblake@redhat.com>; Dr. David Alan
>> Gilbert <dgilbert@redhat.com>; Markus Armbruster <armbru@redhat.com>
>> Cc: Zhang Chen <zhangckid@gmail.com>
>> Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO
>> passthrough
>>
>>
>> On 2020/12/24 上午9:09, Zhang Chen wrote:
>>> From: Zhang Chen <chen.zhang@intel.com>
>>>
>>> Since the real user scenario does not need to monitor all traffic.
>>> Add colo-passthrough-add and colo-passthrough-del to maintain a COLO
>>> network passthrough list.
>>>
>>> Signed-off-by: Zhang Chen <chen.zhang@intel.com>
>>> ---
>>>    net/net.c     | 12 ++++++++++++
>>>    qapi/net.json | 46
>> ++++++++++++++++++++++++++++++++++++++++++++++
>>>    2 files changed, 58 insertions(+)
>>>
>>> diff --git a/net/net.c b/net/net.c
>>> index e1035f21d1..eac7a92618 100644
>>> --- a/net/net.c
>>> +++ b/net/net.c
>>> @@ -1151,6 +1151,18 @@ void qmp_netdev_del(const char *id, Error
>> **errp)
>>>        qemu_del_net_client(nc);
>>>    }
>>>
>>> +void qmp_colo_passthrough_add(const char *prot, const uint32_t port,
>>> +                              Error **errp) {
>>> +    /* Setup passthrough connection */ }
>>> +
>>> +void qmp_colo_passthrough_del(const char *prot, const uint32_t port,
>>> +                              Error **errp) {
>>> +    /* Delete passthrough connection */ }
>>> +
>>>    static void netfilter_print_info(Monitor *mon, NetFilterState *nf)
>>>    {
>>>        char *str;
>>> diff --git a/qapi/net.json b/qapi/net.json index
>>> c31748c87f..466c29714e 100644
>>> --- a/qapi/net.json
>>> +++ b/qapi/net.json
>>> @@ -714,3 +714,49 @@
>>>    ##
>>>    { 'event': 'FAILOVER_NEGOTIATED',
>>>      'data': {'device-id': 'str'} }
>>> +
>>> +##
>>> +# @colo-passthrough-add:
>>> +#
>>> +# Add passthrough entry according to customer's needs in COLO-compare.
>>> +#
>>> +# @protocol: COLO passthrough just support TCP and UDP.
>>> +#
>>> +# @port: TCP or UDP port number.
>>> +#
>>> +# Returns: Nothing on success
>>> +#
>>> +# Since: 5.3
>>> +#
>>> +# Example:
>>> +#
>>> +# -> { "execute": "colo-passthrough-add",
>>> +#      "arguments": { "protocol": "tcp", "port": 3389 } }
>>> +# <- { "return": {} }
>>> +#
>>> +##
>>> +{ 'command': 'colo-passthrough-add',
>>> +     'data': {'protocol': 'str', 'port': 'uint32'} }
>>
>> Do we plan to support 4-tuple (src ip,src port, dst ip, dst port) in the future? If
>> yes, let's add them now.
>>
>> And do we plan to support wildcard here?
> I think just using the port is enough for COLO compare.
> Because in this case, users need passthrough some guest services are distinguished by static ports.
> And for support 4-tuple and wildcard are a good question, do you think we should add some passthrough
> Mechanism for all Qemu net filter? If yes, we should support that in the future.


I think we can start form COLO. To avoid QMP compatibility issues, I 
would like to add the n tuple and wildcard support now.

Thanks


>
> Thanks
> Chen
>
>> Thanks
>>
>>
>>> +
>>> +##
>>> +# @colo-passthrough-del:
>>> +#
>>> +# Delete passthrough entry according to customer's needs in COLO-
>> compare.
>>> +#
>>> +# @protocol: COLO passthrough just support TCP and UDP.
>>> +#
>>> +# @port: TCP or UDP port number.
>>> +#
>>> +# Returns: Nothing on success
>>> +#
>>> +# Since: 5.3
>>> +#
>>> +# Example:
>>> +#
>>> +# -> { "execute": "colo-passthrough-del",
>>> +#      "arguments": { "protocol": "tcp", "port": 3389 } }
>>> +# <- { "return": {} }
>>> +#
>>> +##
>>> +{ 'command': 'colo-passthrough-del',
>>> +     'data': {'protocol': 'str', 'port': 'uint32'} }
Zhang Chen Dec. 29, 2020, 2:56 a.m. UTC | #4
> -----Original Message-----
> From: Jason Wang <jasowang@redhat.com>
> Sent: Monday, December 28, 2020 3:11 PM
> To: Zhang, Chen <chen.zhang@intel.com>; qemu-dev <qemu-
> devel@nongnu.org>; Eric Blake <eblake@redhat.com>; Dr. David Alan
> Gilbert <dgilbert@redhat.com>; Markus Armbruster <armbru@redhat.com>
> Cc: Zhang Chen <zhangckid@gmail.com>
> Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO
> passthrough
> 
> 
> On 2020/12/28 上午8:38, Zhang, Chen wrote:
> >
> >> -----Original Message-----
> >> From: Jason Wang <jasowang@redhat.com>
> >> Sent: Friday, December 25, 2020 2:20 PM
> >> To: Zhang, Chen <chen.zhang@intel.com>; qemu-dev <qemu-
> >> devel@nongnu.org>; Eric Blake <eblake@redhat.com>; Dr. David Alan
> >> Gilbert <dgilbert@redhat.com>; Markus Armbruster
> <armbru@redhat.com>
> >> Cc: Zhang Chen <zhangckid@gmail.com>
> >> Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO
> >> passthrough
> >>
> >>
> >> On 2020/12/24 上午9:09, Zhang Chen wrote:
> >>> From: Zhang Chen <chen.zhang@intel.com>
> >>>
> >>> Since the real user scenario does not need to monitor all traffic.
> >>> Add colo-passthrough-add and colo-passthrough-del to maintain a COLO
> >>> network passthrough list.
> >>>
> >>> Signed-off-by: Zhang Chen <chen.zhang@intel.com>
> >>> ---
> >>>    net/net.c     | 12 ++++++++++++
> >>>    qapi/net.json | 46
> >> ++++++++++++++++++++++++++++++++++++++++++++++
> >>>    2 files changed, 58 insertions(+)
> >>>
> >>> diff --git a/net/net.c b/net/net.c
> >>> index e1035f21d1..eac7a92618 100644
> >>> --- a/net/net.c
> >>> +++ b/net/net.c
> >>> @@ -1151,6 +1151,18 @@ void qmp_netdev_del(const char *id, Error
> >> **errp)
> >>>        qemu_del_net_client(nc);
> >>>    }
> >>>
> >>> +void qmp_colo_passthrough_add(const char *prot, const uint32_t port,
> >>> +                              Error **errp) {
> >>> +    /* Setup passthrough connection */ }
> >>> +
> >>> +void qmp_colo_passthrough_del(const char *prot, const uint32_t port,
> >>> +                              Error **errp) {
> >>> +    /* Delete passthrough connection */ }
> >>> +
> >>>    static void netfilter_print_info(Monitor *mon, NetFilterState *nf)
> >>>    {
> >>>        char *str;
> >>> diff --git a/qapi/net.json b/qapi/net.json index
> >>> c31748c87f..466c29714e 100644
> >>> --- a/qapi/net.json
> >>> +++ b/qapi/net.json
> >>> @@ -714,3 +714,49 @@
> >>>    ##
> >>>    { 'event': 'FAILOVER_NEGOTIATED',
> >>>      'data': {'device-id': 'str'} }
> >>> +
> >>> +##
> >>> +# @colo-passthrough-add:
> >>> +#
> >>> +# Add passthrough entry according to customer's needs in COLO-
> compare.
> >>> +#
> >>> +# @protocol: COLO passthrough just support TCP and UDP.
> >>> +#
> >>> +# @port: TCP or UDP port number.
> >>> +#
> >>> +# Returns: Nothing on success
> >>> +#
> >>> +# Since: 5.3
> >>> +#
> >>> +# Example:
> >>> +#
> >>> +# -> { "execute": "colo-passthrough-add",
> >>> +#      "arguments": { "protocol": "tcp", "port": 3389 } }
> >>> +# <- { "return": {} }
> >>> +#
> >>> +##
> >>> +{ 'command': 'colo-passthrough-add',
> >>> +     'data': {'protocol': 'str', 'port': 'uint32'} }
> >>
> >> Do we plan to support 4-tuple (src ip,src port, dst ip, dst port) in
> >> the future? If yes, let's add them now.
> >>
> >> And do we plan to support wildcard here?
> > I think just using the port is enough for COLO compare.
> > Because in this case, users need passthrough some guest services are
> distinguished by static ports.
> > And for support 4-tuple and wildcard are a good question, do you think
> > we should add some passthrough Mechanism for all Qemu net filter? If yes,
> we should support that in the future.
> 
> 
> I think we can start form COLO. To avoid QMP compatibility issues, I would
> like to add the n tuple and wildcard support now.

OK, I will do this job in next version.
For the QMP compatibility issues, please give me a demo of what we want to see, Like some existing commands.

Thanks
Chen

> 
> Thanks
> 
> 
> >
> > Thanks
> > Chen
> >
> >> Thanks
> >>
> >>
> >>> +
> >>> +##
> >>> +# @colo-passthrough-del:
> >>> +#
> >>> +# Delete passthrough entry according to customer's needs in COLO-
> >> compare.
> >>> +#
> >>> +# @protocol: COLO passthrough just support TCP and UDP.
> >>> +#
> >>> +# @port: TCP or UDP port number.
> >>> +#
> >>> +# Returns: Nothing on success
> >>> +#
> >>> +# Since: 5.3
> >>> +#
> >>> +# Example:
> >>> +#
> >>> +# -> { "execute": "colo-passthrough-del",
> >>> +#      "arguments": { "protocol": "tcp", "port": 3389 } }
> >>> +# <- { "return": {} }
> >>> +#
> >>> +##
> >>> +{ 'command': 'colo-passthrough-del',
> >>> +     'data': {'protocol': 'str', 'port': 'uint32'} }
Jason Wang Dec. 30, 2020, 3:56 a.m. UTC | #5
On 2020/12/29 上午10:56, Zhang, Chen wrote:
>> I think we can start form COLO. To avoid QMP compatibility issues, I would
>> like to add the n tuple and wildcard support now.
> OK, I will do this job in next version.
> For the QMP compatibility issues, please give me a demo of what we want to see, Like some existing commands.


I meant if we start from port and then want to add e.g n-tuple support. 
Do we need to introduce another command? Or is there any introspection 
that can let management layer know about this?

Thanks


>
> Thanks
> Chen
>
Zhang Chen Jan. 5, 2021, 3:28 a.m. UTC | #6
> -----Original Message-----
> From: Jason Wang <jasowang@redhat.com>
> Sent: Wednesday, December 30, 2020 11:57 AM
> To: Zhang, Chen <chen.zhang@intel.com>; qemu-dev <qemu-
> devel@nongnu.org>; Eric Blake <eblake@redhat.com>; Dr. David Alan
> Gilbert <dgilbert@redhat.com>; Markus Armbruster <armbru@redhat.com>
> Cc: Zhang Chen <zhangckid@gmail.com>
> Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO
> passthrough
> 
> 
> On 2020/12/29 上午10:56, Zhang, Chen wrote:
> >> I think we can start form COLO. To avoid QMP compatibility issues, I
> >> would like to add the n tuple and wildcard support now.
> > OK, I will do this job in next version.
> > For the QMP compatibility issues, please give me a demo of what we want
> to see, Like some existing commands.
> 
> 
> I meant if we start from port and then want to add e.g n-tuple support.
> Do we need to introduce another command? Or is there any introspection
> that can let management layer know about this?

OK, I will add the n-tuple support.
It looks basic command are add/del connection, Do you think something needs to be introduced?
For the management layer, I don't know the detail process of how to add new Qemu command support for example libvirt.
Maybe depend on libvirt community's plan?

Thanks
Chen 

> 
> Thanks
> 
> 
> >
> > Thanks
> > Chen
> >
Jason Wang Jan. 5, 2021, 4:17 a.m. UTC | #7
On 2021/1/5 上午11:28, Zhang, Chen wrote:
>
>> -----Original Message-----
>> From: Jason Wang <jasowang@redhat.com>
>> Sent: Wednesday, December 30, 2020 11:57 AM
>> To: Zhang, Chen <chen.zhang@intel.com>; qemu-dev <qemu-
>> devel@nongnu.org>; Eric Blake <eblake@redhat.com>; Dr. David Alan
>> Gilbert <dgilbert@redhat.com>; Markus Armbruster <armbru@redhat.com>
>> Cc: Zhang Chen <zhangckid@gmail.com>
>> Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO
>> passthrough
>>
>>
>> On 2020/12/29 上午10:56, Zhang, Chen wrote:
>>>> I think we can start form COLO. To avoid QMP compatibility issues, I
>>>> would like to add the n tuple and wildcard support now.
>>> OK, I will do this job in next version.
>>> For the QMP compatibility issues, please give me a demo of what we want
>> to see, Like some existing commands.
>>
>>
>> I meant if we start from port and then want to add e.g n-tuple support.
>> Do we need to introduce another command? Or is there any introspection
>> that can let management layer know about this?
> OK, I will add the n-tuple support.
> It looks basic command are add/del connection, Do you think something needs to be introduced?


It looks to me it's fine to start with them.


> For the management layer, I don't know the detail process of how to add new Qemu command support for example libvirt.
> Maybe depend on libvirt community's plan?


So a question here, how COLO is being used now. Is it expected to be 
managed by libvirt or not?

Thanks


>
> Thanks
> Chen
>
>> Thanks
>>
>>
>>> Thanks
>>> Chen
>>>
Zhang Chen Jan. 5, 2021, 6:29 a.m. UTC | #8
> -----Original Message-----
> From: Jason Wang <jasowang@redhat.com>
> Sent: Tuesday, January 5, 2021 12:17 PM
> To: Zhang, Chen <chen.zhang@intel.com>; qemu-dev <qemu-
> devel@nongnu.org>; Eric Blake <eblake@redhat.com>; Dr. David Alan
> Gilbert <dgilbert@redhat.com>; Markus Armbruster <armbru@redhat.com>
> Cc: Zhang Chen <zhangckid@gmail.com>
> Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO
> passthrough
> 
> 
> On 2021/1/5 上午11:28, Zhang, Chen wrote:
> >
> >> -----Original Message-----
> >> From: Jason Wang <jasowang@redhat.com>
> >> Sent: Wednesday, December 30, 2020 11:57 AM
> >> To: Zhang, Chen <chen.zhang@intel.com>; qemu-dev <qemu-
> >> devel@nongnu.org>; Eric Blake <eblake@redhat.com>; Dr. David Alan
> >> Gilbert <dgilbert@redhat.com>; Markus Armbruster
> <armbru@redhat.com>
> >> Cc: Zhang Chen <zhangckid@gmail.com>
> >> Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO
> >> passthrough
> >>
> >>
> >> On 2020/12/29 上午10:56, Zhang, Chen wrote:
> >>>> I think we can start form COLO. To avoid QMP compatibility issues,
> >>>> I would like to add the n tuple and wildcard support now.
> >>> OK, I will do this job in next version.
> >>> For the QMP compatibility issues, please give me a demo of what we
> >>> want
> >> to see, Like some existing commands.
> >>
> >>
> >> I meant if we start from port and then want to add e.g n-tuple support.
> >> Do we need to introduce another command? Or is there any
> >> introspection that can let management layer know about this?
> > OK, I will add the n-tuple support.
> > It looks basic command are add/del connection, Do you think something
> needs to be introduced?
> 
> 
> It looks to me it's fine to start with them.
> 
> 
> > For the management layer, I don't know the detail process of how to add
> new Qemu command support for example libvirt.
> > Maybe depend on libvirt community's plan?
> 
> 
> So a question here, how COLO is being used now. Is it expected to be
> managed by libvirt or not?

Yes, they use libvirt to manage COLO.
Currently, China CSP integrated COLO on edge computing product, they need change a small part of the code on libvirt,
Most of COLO parameter use libvirt bypass mechanism direct input to Qemu.
For our side, we focus on Qemu COLO code.

Thanks
Chen

> 
> Thanks
> 
> 
> >
> > Thanks
> > Chen
> >
> >> Thanks
> >>
> >>
> >>> Thanks
> >>> Chen
> >>>
Eric Blake Jan. 19, 2021, 7:32 p.m. UTC | #9
On 12/23/20 7:09 PM, Zhang Chen wrote:
> From: Zhang Chen <chen.zhang@intel.com>
> 
> Since the real user scenario does not need to monitor all traffic.
> Add colo-passthrough-add and colo-passthrough-del to maintain
> a COLO network passthrough list.
> 
> Signed-off-by: Zhang Chen <chen.zhang@intel.com>

> --- a/qapi/net.json
> +++ b/qapi/net.json
> @@ -714,3 +714,49 @@
>  ##
>  { 'event': 'FAILOVER_NEGOTIATED',
>    'data': {'device-id': 'str'} }
> +
> +##
> +# @colo-passthrough-add:
> +#
> +# Add passthrough entry according to customer's needs in COLO-compare.
> +#
> +# @protocol: COLO passthrough just support TCP and UDP.
> +#
> +# @port: TCP or UDP port number.
> +#
> +# Returns: Nothing on success
> +#
> +# Since: 5.3

The next release is 6.0, not 5.3.

> +#
> +# Example:
> +#
> +# -> { "execute": "colo-passthrough-add",
> +#      "arguments": { "protocol": "tcp", "port": 3389 } }
> +# <- { "return": {} }
> +#
> +##
> +{ 'command': 'colo-passthrough-add',
> +     'data': {'protocol': 'str', 'port': 'uint32'} }

Should 'protocol' be an enum (finite set of values) rather than an
open-coded string (infinite number of values, even though you mentioned
in the docs above that only 'tcp' or 'udp' make sense)?  In fact, do we
already have existing QAPI types representing tcp/udp and a port number
that could be reused here, rather than open-coding yet another one?

> +
> +##
> +# @colo-passthrough-del:
> +#
> +# Delete passthrough entry according to customer's needs in COLO-compare.
> +#
> +# @protocol: COLO passthrough just support TCP and UDP.
> +#
> +# @port: TCP or UDP port number.
> +#
> +# Returns: Nothing on success
> +#
> +# Since: 5.3

another 6.0 spot

> +#
> +# Example:
> +#
> +# -> { "execute": "colo-passthrough-del",
> +#      "arguments": { "protocol": "tcp", "port": 3389 } }
> +# <- { "return": {} }
> +#
> +##
> +{ 'command': 'colo-passthrough-del',
> +     'data': {'protocol': 'str', 'port': 'uint32'} }
>
Zhang Chen Jan. 21, 2021, 1:50 a.m. UTC | #10
> -----Original Message-----
> From: Eric Blake <eblake@redhat.com>
> Sent: Wednesday, January 20, 2021 3:33 AM
> To: Zhang, Chen <chen.zhang@intel.com>; Jason Wang
> <jasowang@redhat.com>; qemu-dev <qemu-devel@nongnu.org>; Dr. David
> Alan Gilbert <dgilbert@redhat.com>; Markus Armbruster
> <armbru@redhat.com>
> Cc: Zhang Chen <zhangckid@gmail.com>
> Subject: Re: [PATCH 1/3] qapi/net: Add new QMP command for COLO
> passthrough
> 
> On 12/23/20 7:09 PM, Zhang Chen wrote:
> > From: Zhang Chen <chen.zhang@intel.com>
> >
> > Since the real user scenario does not need to monitor all traffic.
> > Add colo-passthrough-add and colo-passthrough-del to maintain a COLO
> > network passthrough list.
> >
> > Signed-off-by: Zhang Chen <chen.zhang@intel.com>
> 
> > --- a/qapi/net.json
> > +++ b/qapi/net.json
> > @@ -714,3 +714,49 @@
> >  ##
> >  { 'event': 'FAILOVER_NEGOTIATED',
> >    'data': {'device-id': 'str'} }
> > +
> > +##
> > +# @colo-passthrough-add:
> > +#
> > +# Add passthrough entry according to customer's needs in COLO-compare.
> > +#
> > +# @protocol: COLO passthrough just support TCP and UDP.
> > +#
> > +# @port: TCP or UDP port number.
> > +#
> > +# Returns: Nothing on success
> > +#
> > +# Since: 5.3
> 
> The next release is 6.0, not 5.3.

Missed the plan, I will fix it in next version.

> 
> > +#
> > +# Example:
> > +#
> > +# -> { "execute": "colo-passthrough-add",
> > +#      "arguments": { "protocol": "tcp", "port": 3389 } }
> > +# <- { "return": {} }
> > +#
> > +##
> > +{ 'command': 'colo-passthrough-add',
> > +     'data': {'protocol': 'str', 'port': 'uint32'} }
> 
> Should 'protocol' be an enum (finite set of values) rather than an open-
> coded string (infinite number of values, even though you mentioned in the
> docs above that only 'tcp' or 'udp' make sense)?  In fact, do we already have
> existing QAPI types representing tcp/udp and a port number that could be
> reused here, rather than open-coding yet another one?
> 

I checked current QAPI code, looks no existing enum defined.
I will add the new general QAPI types in next version.

Thanks
Chen

> > +
> > +##
> > +# @colo-passthrough-del:
> > +#
> > +# Delete passthrough entry according to customer's needs in COLO-
> compare.
> > +#
> > +# @protocol: COLO passthrough just support TCP and UDP.
> > +#
> > +# @port: TCP or UDP port number.
> > +#
> > +# Returns: Nothing on success
> > +#
> > +# Since: 5.3
> 
> another 6.0 spot
> 

OK.

> > +#
> > +# Example:
> > +#
> > +# -> { "execute": "colo-passthrough-del",
> > +#      "arguments": { "protocol": "tcp", "port": 3389 } }
> > +# <- { "return": {} }
> > +#
> > +##
> > +{ 'command': 'colo-passthrough-del',
> > +     'data': {'protocol': 'str', 'port': 'uint32'} }
> >
> 
> --
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.           +1-919-301-3226
> Virtualization:  qemu.org | libvirt.org
diff mbox series

Patch

diff --git a/net/net.c b/net/net.c
index e1035f21d1..eac7a92618 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1151,6 +1151,18 @@  void qmp_netdev_del(const char *id, Error **errp)
     qemu_del_net_client(nc);
 }
 
+void qmp_colo_passthrough_add(const char *prot, const uint32_t port,
+                              Error **errp)
+{
+    /* Setup passthrough connection */
+}
+
+void qmp_colo_passthrough_del(const char *prot, const uint32_t port,
+                              Error **errp)
+{
+    /* Delete passthrough connection */
+}
+
 static void netfilter_print_info(Monitor *mon, NetFilterState *nf)
 {
     char *str;
diff --git a/qapi/net.json b/qapi/net.json
index c31748c87f..466c29714e 100644
--- a/qapi/net.json
+++ b/qapi/net.json
@@ -714,3 +714,49 @@ 
 ##
 { 'event': 'FAILOVER_NEGOTIATED',
   'data': {'device-id': 'str'} }
+
+##
+# @colo-passthrough-add:
+#
+# Add passthrough entry according to customer's needs in COLO-compare.
+#
+# @protocol: COLO passthrough just support TCP and UDP.
+#
+# @port: TCP or UDP port number.
+#
+# Returns: Nothing on success
+#
+# Since: 5.3
+#
+# Example:
+#
+# -> { "execute": "colo-passthrough-add",
+#      "arguments": { "protocol": "tcp", "port": 3389 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'colo-passthrough-add',
+     'data': {'protocol': 'str', 'port': 'uint32'} }
+
+##
+# @colo-passthrough-del:
+#
+# Delete passthrough entry according to customer's needs in COLO-compare.
+#
+# @protocol: COLO passthrough just support TCP and UDP.
+#
+# @port: TCP or UDP port number.
+#
+# Returns: Nothing on success
+#
+# Since: 5.3
+#
+# Example:
+#
+# -> { "execute": "colo-passthrough-del",
+#      "arguments": { "protocol": "tcp", "port": 3389 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'colo-passthrough-del',
+     'data': {'protocol': 'str', 'port': 'uint32'} }