mirror of https://gitee.com/openkylin/qemu.git
COLO-compare: Add new parameter to communicate with remote colo-frame
We add the "notify_dev=chardevID" parameter. After that colo-compare can connect with remote(currently just for Xen, KVM-COLO didn't need it.) colo-frame through chardev socket, it can notify remote(Xen) colo-frame to handle checkpoint event. Signed-off-by: Zhang Chen <chen.zhang@intel.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
aa9c6fa757
commit
cf6af766f4
|
@ -83,6 +83,7 @@ typedef struct CompareState {
|
||||||
char *pri_indev;
|
char *pri_indev;
|
||||||
char *sec_indev;
|
char *sec_indev;
|
||||||
char *outdev;
|
char *outdev;
|
||||||
|
char *notify_dev;
|
||||||
CharBackend chr_pri_in;
|
CharBackend chr_pri_in;
|
||||||
CharBackend chr_sec_in;
|
CharBackend chr_sec_in;
|
||||||
CharBackend chr_out;
|
CharBackend chr_out;
|
||||||
|
@ -897,6 +898,21 @@ static void compare_set_vnet_hdr(Object *obj,
|
||||||
s->vnet_hdr = value;
|
s->vnet_hdr = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *compare_get_notify_dev(Object *obj, Error **errp)
|
||||||
|
{
|
||||||
|
CompareState *s = COLO_COMPARE(obj);
|
||||||
|
|
||||||
|
return g_strdup(s->notify_dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void compare_set_notify_dev(Object *obj, const char *value, Error **errp)
|
||||||
|
{
|
||||||
|
CompareState *s = COLO_COMPARE(obj);
|
||||||
|
|
||||||
|
g_free(s->notify_dev);
|
||||||
|
s->notify_dev = g_strdup(value);
|
||||||
|
}
|
||||||
|
|
||||||
static void compare_pri_rs_finalize(SocketReadState *pri_rs)
|
static void compare_pri_rs_finalize(SocketReadState *pri_rs)
|
||||||
{
|
{
|
||||||
CompareState *s = container_of(pri_rs, CompareState, pri_rs);
|
CompareState *s = container_of(pri_rs, CompareState, pri_rs);
|
||||||
|
@ -1057,6 +1073,10 @@ static void colo_compare_init(Object *obj)
|
||||||
(Object **)&s->iothread,
|
(Object **)&s->iothread,
|
||||||
object_property_allow_set_link,
|
object_property_allow_set_link,
|
||||||
OBJ_PROP_LINK_STRONG, NULL);
|
OBJ_PROP_LINK_STRONG, NULL);
|
||||||
|
/* This parameter just for Xen COLO */
|
||||||
|
object_property_add_str(obj, "notify_dev",
|
||||||
|
compare_get_notify_dev, compare_set_notify_dev,
|
||||||
|
NULL);
|
||||||
|
|
||||||
s->vnet_hdr = false;
|
s->vnet_hdr = false;
|
||||||
object_property_add_bool(obj, "vnet_hdr_support", compare_get_vnet_hdr,
|
object_property_add_bool(obj, "vnet_hdr_support", compare_get_vnet_hdr,
|
||||||
|
@ -1103,6 +1123,7 @@ static void colo_compare_finalize(Object *obj)
|
||||||
g_free(s->pri_indev);
|
g_free(s->pri_indev);
|
||||||
g_free(s->sec_indev);
|
g_free(s->sec_indev);
|
||||||
g_free(s->outdev);
|
g_free(s->outdev);
|
||||||
|
g_free(s->notify_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo colo_compare_info = {
|
static const TypeInfo colo_compare_info = {
|
||||||
|
|
|
@ -4477,7 +4477,7 @@ Dump the network traffic on netdev @var{dev} to the file specified by
|
||||||
The file format is libpcap, so it can be analyzed with tools such as tcpdump
|
The file format is libpcap, so it can be analyzed with tools such as tcpdump
|
||||||
or Wireshark.
|
or Wireshark.
|
||||||
|
|
||||||
@item -object colo-compare,id=@var{id},primary_in=@var{chardevid},secondary_in=@var{chardevid},outdev=@var{chardevid},iothread=@var{id}[,vnet_hdr_support]
|
@item -object colo-compare,id=@var{id},primary_in=@var{chardevid},secondary_in=@var{chardevid},outdev=@var{chardevid},iothread=@var{id}[,vnet_hdr_support][,notify_dev=@var{id}]
|
||||||
|
|
||||||
Colo-compare gets packet from primary_in@var{chardevid} and secondary_in@var{chardevid}, than compare primary packet with
|
Colo-compare gets packet from primary_in@var{chardevid} and secondary_in@var{chardevid}, than compare primary packet with
|
||||||
secondary packet. If the packets are same, we will output primary
|
secondary packet. If the packets are same, we will output primary
|
||||||
|
@ -4486,11 +4486,15 @@ do checkpoint and send primary packet to outdev@var{chardevid}.
|
||||||
In order to improve efficiency, we need to put the task of comparison
|
In order to improve efficiency, we need to put the task of comparison
|
||||||
in another thread. If it has the vnet_hdr_support flag, colo compare
|
in another thread. If it has the vnet_hdr_support flag, colo compare
|
||||||
will send/recv packet with vnet_hdr_len.
|
will send/recv packet with vnet_hdr_len.
|
||||||
|
If you want to use Xen COLO, will need the notify_dev to notify Xen
|
||||||
|
colo-frame to do checkpoint.
|
||||||
|
|
||||||
we must use it with the help of filter-mirror and filter-redirector.
|
we must use it with the help of filter-mirror and filter-redirector.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
|
|
||||||
|
KVM COLO
|
||||||
|
|
||||||
primary:
|
primary:
|
||||||
-netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
|
-netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
|
||||||
-device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
|
-device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
|
||||||
|
@ -4514,6 +4518,33 @@ secondary:
|
||||||
-object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
|
-object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
|
||||||
-object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
|
-object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
|
||||||
|
|
||||||
|
|
||||||
|
Xen COLO
|
||||||
|
|
||||||
|
primary:
|
||||||
|
-netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
|
||||||
|
-device e1000,id=e0,netdev=hn0,mac=52:a4:00:12:78:66
|
||||||
|
-chardev socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait
|
||||||
|
-chardev socket,id=compare1,host=3.3.3.3,port=9004,server,nowait
|
||||||
|
-chardev socket,id=compare0,host=3.3.3.3,port=9001,server,nowait
|
||||||
|
-chardev socket,id=compare0-0,host=3.3.3.3,port=9001
|
||||||
|
-chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait
|
||||||
|
-chardev socket,id=compare_out0,host=3.3.3.3,port=9005
|
||||||
|
-chardev socket,id=notify_way,host=3.3.3.3,port=9009,server,nowait
|
||||||
|
-object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
|
||||||
|
-object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
|
||||||
|
-object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
|
||||||
|
-object iothread,id=iothread1
|
||||||
|
-object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,notify_dev=nofity_way,iothread=iothread1
|
||||||
|
|
||||||
|
secondary:
|
||||||
|
-netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
|
||||||
|
-device e1000,netdev=hn0,mac=52:a4:00:12:78:66
|
||||||
|
-chardev socket,id=red0,host=3.3.3.3,port=9003
|
||||||
|
-chardev socket,id=red1,host=3.3.3.3,port=9004
|
||||||
|
-object filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0
|
||||||
|
-object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1
|
||||||
|
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
If you want to know the detail of above command line, you can read
|
If you want to know the detail of above command line, you can read
|
||||||
|
|
Loading…
Reference in New Issue