diff mbox

[RFC,v2,01/10] Init colo-proxy object based on netfilter

Message ID 1450780978-19123-2-git-send-email-zhangchen.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

Zhang Chen Dec. 22, 2015, 10:42 a.m. UTC
From: zhangchen <zhangchen.fnst@cn.fujitsu.com>

add colo-proxy to vl.c and qemu-options.hx
add trace-colo-proxy relation

Signed-off-by: zhangchen <zhangchen.fnst@cn.fujitsu.com>
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
---
 qemu-options.hx | 6 ++++++
 trace-events    | 8 ++++++++
 vl.c            | 3 ++-
 3 files changed, 16 insertions(+), 1 deletion(-)

Comments

Dr. David Alan Gilbert Jan. 15, 2016, 6:21 p.m. UTC | #1
* Zhang Chen (zhangchen.fnst@cn.fujitsu.com) wrote:
> From: zhangchen <zhangchen.fnst@cn.fujitsu.com>
> 
> add colo-proxy to vl.c and qemu-options.hx
> add trace-colo-proxy relation
> 
> Signed-off-by: zhangchen <zhangchen.fnst@cn.fujitsu.com>
> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> ---
>  qemu-options.hx | 6 ++++++
>  trace-events    | 8 ++++++++
>  vl.c            | 3 ++-
>  3 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 0eea4ee..6daa3f0 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -3670,6 +3670,12 @@ queue @var{all|rx|tx} is an option that can be applied to any netfilter.
>  @option{tx}: the filter is attached to the transmit queue of the netdev,
>               where it will receive packets sent by the netdev.
>  
> +@item -object colo-proxy,id=@var{id},netdev=@var{netdevid},addr=@var{host:port},mode=@var{primary|secondary}[,queue=@var{all}]
> +
> +Colo-proxy on netdev @var{netdevid},set colo mode @var{primary|secondary}
> +connect other colo through addr@var{host:port},and colo needs queue all
> +packet arriving in queue=@var{all}
> +
>  @item -object filter-dump,id=@var{id},netdev=@var{dev},file=@var{filename}][,maxlen=@var{len}]
>  
>  Dump the network traffic on netdev @var{dev} to the file specified by
> diff --git a/trace-events b/trace-events
> index 5f95b3c..a957fb3 100644
> --- a/trace-events
> +++ b/trace-events
> @@ -1586,6 +1586,14 @@ colo_failover_set_state(int new_state) "new state %d"
>  colo_start_block_replication(void) "Block replication is started"
>  colo_stop_block_replication(const char *reason) "Block replication is stopped(reason: '%s')"
>  
> +# net/colo-proxy.c
> +colo_proxy(const char *sta) ": %s"

You use the 'colo_proxy' trace in a lot of different places;  it would
be better to use individual trace entries, so for example you could
just trace miscompares.

Dave

> +colo_proxy_with_ret(const char *sta, ssize_t ret) ": %s ret = %zu"
> +colo_proxy_packet_src(const char *src) ":ipsrc = %s"
> +colo_proxy_packet_dst(const char *dst) ":ipdst = %s"
> +colo_proxy_packet_size(int size) ": %d"
> +colo_proxy_queue_size(int size) ": %d"
> +
>  # kvm-all.c
>  kvm_ioctl(int type, void *arg) "type 0x%x, arg %p"
>  kvm_vm_ioctl(int type, void *arg) "type 0x%x, arg %p"
> diff --git a/vl.c b/vl.c
> index 8dc34ce..dcfb3a9 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2838,7 +2838,8 @@ static bool object_create_initial(const char *type)
>       * they depend on netdevs already existing
>       */
>      if (g_str_equal(type, "filter-buffer") ||
> -        g_str_equal(type, "filter-dump")) {
> +        g_str_equal(type, "filter-dump") ||
> +        g_str_equal(type, "colo-proxy")) {
>          return false;
>      }
>  
> -- 
> 1.9.1
> 
> 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
Zhang Chen Jan. 18, 2016, 7:08 a.m. UTC | #2
On 01/16/2016 02:21 AM, Dr. David Alan Gilbert wrote:
> * Zhang Chen (zhangchen.fnst@cn.fujitsu.com) wrote:
>> From: zhangchen <zhangchen.fnst@cn.fujitsu.com>
>>
>> add colo-proxy to vl.c and qemu-options.hx
>> add trace-colo-proxy relation
>>
>> Signed-off-by: zhangchen <zhangchen.fnst@cn.fujitsu.com>
>> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
>> ---
>>   qemu-options.hx | 6 ++++++
>>   trace-events    | 8 ++++++++
>>   vl.c            | 3 ++-
>>   3 files changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/qemu-options.hx b/qemu-options.hx
>> index 0eea4ee..6daa3f0 100644
>> --- a/qemu-options.hx
>> +++ b/qemu-options.hx
>> @@ -3670,6 +3670,12 @@ queue @var{all|rx|tx} is an option that can be applied to any netfilter.
>>   @option{tx}: the filter is attached to the transmit queue of the netdev,
>>                where it will receive packets sent by the netdev.
>>   
>> +@item -object colo-proxy,id=@var{id},netdev=@var{netdevid},addr=@var{host:port},mode=@var{primary|secondary}[,queue=@var{all}]
>> +
>> +Colo-proxy on netdev @var{netdevid},set colo mode @var{primary|secondary}
>> +connect other colo through addr@var{host:port},and colo needs queue all
>> +packet arriving in queue=@var{all}
>> +
>>   @item -object filter-dump,id=@var{id},netdev=@var{dev},file=@var{filename}][,maxlen=@var{len}]
>>   
>>   Dump the network traffic on netdev @var{dev} to the file specified by
>> diff --git a/trace-events b/trace-events
>> index 5f95b3c..a957fb3 100644
>> --- a/trace-events
>> +++ b/trace-events
>> @@ -1586,6 +1586,14 @@ colo_failover_set_state(int new_state) "new state %d"
>>   colo_start_block_replication(void) "Block replication is started"
>>   colo_stop_block_replication(const char *reason) "Block replication is stopped(reason: '%s')"
>>   
>> +# net/colo-proxy.c
>> +colo_proxy(const char *sta) ": %s"
> You use the 'colo_proxy' trace in a lot of different places;  it would
> be better to use individual trace entries, so for example you could
> just trace miscompares.
>
> Dave

I will fix it in next version.

Thanks
zhangchen

>
>> +colo_proxy_with_ret(const char *sta, ssize_t ret) ": %s ret = %zu"
>> +colo_proxy_packet_src(const char *src) ":ipsrc = %s"
>> +colo_proxy_packet_dst(const char *dst) ":ipdst = %s"
>> +colo_proxy_packet_size(int size) ": %d"
>> +colo_proxy_queue_size(int size) ": %d"
>> +
>>   # kvm-all.c
>>   kvm_ioctl(int type, void *arg) "type 0x%x, arg %p"
>>   kvm_vm_ioctl(int type, void *arg) "type 0x%x, arg %p"
>> diff --git a/vl.c b/vl.c
>> index 8dc34ce..dcfb3a9 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -2838,7 +2838,8 @@ static bool object_create_initial(const char *type)
>>        * they depend on netdevs already existing
>>        */
>>       if (g_str_equal(type, "filter-buffer") ||
>> -        g_str_equal(type, "filter-dump")) {
>> +        g_str_equal(type, "filter-dump") ||
>> +        g_str_equal(type, "colo-proxy")) {
>>           return false;
>>       }
>>   
>> -- 
>> 1.9.1
>>
>>
>>
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
>
>
> .
>
diff mbox

Patch

diff --git a/qemu-options.hx b/qemu-options.hx
index 0eea4ee..6daa3f0 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -3670,6 +3670,12 @@  queue @var{all|rx|tx} is an option that can be applied to any netfilter.
 @option{tx}: the filter is attached to the transmit queue of the netdev,
              where it will receive packets sent by the netdev.
 
+@item -object colo-proxy,id=@var{id},netdev=@var{netdevid},addr=@var{host:port},mode=@var{primary|secondary}[,queue=@var{all}]
+
+Colo-proxy on netdev @var{netdevid},set colo mode @var{primary|secondary}
+connect other colo through addr@var{host:port},and colo needs queue all
+packet arriving in queue=@var{all}
+
 @item -object filter-dump,id=@var{id},netdev=@var{dev},file=@var{filename}][,maxlen=@var{len}]
 
 Dump the network traffic on netdev @var{dev} to the file specified by
diff --git a/trace-events b/trace-events
index 5f95b3c..a957fb3 100644
--- a/trace-events
+++ b/trace-events
@@ -1586,6 +1586,14 @@  colo_failover_set_state(int new_state) "new state %d"
 colo_start_block_replication(void) "Block replication is started"
 colo_stop_block_replication(const char *reason) "Block replication is stopped(reason: '%s')"
 
+# net/colo-proxy.c
+colo_proxy(const char *sta) ": %s"
+colo_proxy_with_ret(const char *sta, ssize_t ret) ": %s ret = %zu"
+colo_proxy_packet_src(const char *src) ":ipsrc = %s"
+colo_proxy_packet_dst(const char *dst) ":ipdst = %s"
+colo_proxy_packet_size(int size) ": %d"
+colo_proxy_queue_size(int size) ": %d"
+
 # kvm-all.c
 kvm_ioctl(int type, void *arg) "type 0x%x, arg %p"
 kvm_vm_ioctl(int type, void *arg) "type 0x%x, arg %p"
diff --git a/vl.c b/vl.c
index 8dc34ce..dcfb3a9 100644
--- a/vl.c
+++ b/vl.c
@@ -2838,7 +2838,8 @@  static bool object_create_initial(const char *type)
      * they depend on netdevs already existing
      */
     if (g_str_equal(type, "filter-buffer") ||
-        g_str_equal(type, "filter-dump")) {
+        g_str_equal(type, "filter-dump") ||
+        g_str_equal(type, "colo-proxy")) {
         return false;
     }