From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: zhanghailiang <zhang.zhanghailiang@huawei.com>,
Li Zhijian <lizhijian@cn.fujitsu.com>,
Gui jianfeng <guijianfeng@cn.fujitsu.com>,
Jason Wang <jasowang@redhat.com>,
"eddie.dong" <eddie.dong@intel.com>,
qemu devel <qemu-devel@nongnu.org>,
Huang peng <peter.huangpeng@huawei.com>,
Gong lei <arei.gonglei@huawei.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
jan.kiszka@siemens.com,
Yang Hongyang <hongyang.yang@easystack.cn>
Subject: Re: [Qemu-devel] [RFC PATCH v2 05/10] net/colo-proxy: Add colo interface to use proxy
Date: Mon, 22 Feb 2016 11:08:06 +0800 [thread overview]
Message-ID: <56CA7B96.2090603@cn.fujitsu.com> (raw)
In-Reply-To: <20160219195849.GJ2412@work-vm>
On 02/20/2016 03:58 AM, Dr. David Alan Gilbert wrote:
> * Zhang Chen (zhangchen.fnst@cn.fujitsu.com) wrote:
>> From: zhangchen <zhangchen.fnst@cn.fujitsu.com>
>>
>> Add interface used by migration/colo.c
>> so colo framework can work with proxy
>>
>> Signed-off-by: zhangchen <zhangchen.fnst@cn.fujitsu.com>
>> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
>> ---
>> net/colo-proxy.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 93 insertions(+)
>>
>> diff --git a/net/colo-proxy.c b/net/colo-proxy.c
>> index f448ee1..ba2bbe7 100644
>> --- a/net/colo-proxy.c
>> +++ b/net/colo-proxy.c
>> @@ -167,6 +167,11 @@ static int connection_key_equal(const void *opaque1, const void *opaque2)
>> return memcmp(opaque1, opaque2, sizeof(ConnectionKey)) == 0;
>> }
>>
>> +bool colo_proxy_query_checkpoint(void)
>> +{
>> + return colo_do_checkpoint;
>> +}
>> +
>> static ssize_t colo_proxy_receive_iov(NetFilterState *nf,
>> NetClientState *sender,
>> unsigned flags,
>> @@ -203,6 +208,94 @@ static void colo_proxy_cleanup(NetFilterState *nf)
>> qemu_event_destroy(&s->need_compare_ev);
>> }
>>
>> +static void colo_proxy_notify_checkpoint(void)
>> +{
>> + trace_colo_proxy("colo_proxy_notify_checkpoint");
>> + colo_do_checkpoint = true;
>> +}
>> +
>> +static void colo_proxy_start_one(NetFilterState *nf,
>> + void *opaque, Error **errp)
>> +{
>> + COLOProxyState *s;
>> + int mode, ret;
>> +
>> + if (strcmp(object_get_typename(OBJECT(nf)), TYPE_FILTER_COLO_PROXY)) {
>> + return;
>> + }
>> +
>> + mode = *(int *)opaque;
>> + s = FILTER_COLO_PROXY(nf);
>> + assert(s->colo_mode == mode);
>> +
>> + if (s->colo_mode == COLO_MODE_PRIMARY) {
>> + char thread_name[1024];
>> +
>> + ret = colo_proxy_connect(s);
>> + if (ret) {
>> + error_setg(errp, "colo proxy connect failed");
>> + return ;
>> + }
>> +
>> + s->status = COLO_PROXY_RUNNING;
>> + sprintf(thread_name, "proxy compare %s", nf->netdev_id);
>> + qemu_thread_create(&s->thread, thread_name,
>> + colo_proxy_compare_thread, s,
>> + QEMU_THREAD_JOINABLE);
> Note most OSs have a ~14 character limit on the size of the thread
> name, otherwise they ignore the request to set the name (and the
> thread shows up as 'migration'), so I suggest keep it as "proxy:%s".
>
> Dave
I will fix it in colo-compare module.
Thanks
zhangchen
>> + } else {
>> + ret = colo_wait_incoming(s);
>> + if (ret) {
>> + error_setg(errp, "colo proxy wait incoming failed");
>> + return ;
>> + }
>> + s->status = COLO_PROXY_RUNNING;
>> + }
>> +}
>> +
>> +int colo_proxy_start(int mode)
>> +{
>> + Error *err = NULL;
>> + qemu_foreach_netfilter(colo_proxy_start_one, &mode, &err);
>> + if (err) {
>> + return -1;
>> + }
>> + return 0;
>> +}
>> +
>> +static void colo_proxy_stop_one(NetFilterState *nf,
>> + void *opaque, Error **errp)
>> +{
>> + COLOProxyState *s;
>> + int mode;
>> +
>> + if (strcmp(object_get_typename(OBJECT(nf)), TYPE_FILTER_COLO_PROXY)) {
>> + return;
>> + }
>> +
>> + s = FILTER_COLO_PROXY(nf);
>> + mode = *(int *)opaque;
>> + assert(s->colo_mode == mode);
>> +
>> + s->status = COLO_PROXY_DONE;
>> + if (s->sockfd >= 0) {
>> + qemu_set_fd_handler(s->sockfd, NULL, NULL, NULL);
>> + closesocket(s->sockfd);
>> + }
>> + if (s->colo_mode == COLO_MODE_PRIMARY) {
>> + colo_proxy_primary_checkpoint(s);
>> + qemu_event_set(&s->need_compare_ev);
>> + qemu_thread_join(&s->thread);
>> + } else {
>> + colo_proxy_secondary_checkpoint(s);
>> + }
>> +}
>> +
>> +void colo_proxy_stop(int mode)
>> +{
>> + Error *err = NULL;
>> + qemu_foreach_netfilter(colo_proxy_stop_one, &mode, &err);
>> +}
>> +
>> static void colo_proxy_setup(NetFilterState *nf, Error **errp)
>> {
>> COLOProxyState *s = FILTER_COLO_PROXY(nf);
>> --
>> 1.9.1
>>
>>
>>
>>
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
>
>
> .
>
--
Thanks
zhangchen
next prev parent reply other threads:[~2016-02-22 3:07 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-22 10:42 [Qemu-devel] [RFC PATCH v2 00/10] Add colo-proxy based on netfilter Zhang Chen
2015-12-22 10:42 ` [Qemu-devel] [RFC PATCH v2 01/10] Init colo-proxy object " Zhang Chen
2016-01-15 18:21 ` Dr. David Alan Gilbert
2016-01-18 7:08 ` Zhang Chen
2015-12-22 10:42 ` [Qemu-devel] [RFC PATCH v2 02/10] Jhash: add linux kernel jhashtable in qemu Zhang Chen
2016-01-08 12:08 ` Dr. David Alan Gilbert
2016-01-11 1:49 ` Zhang Chen
2016-01-11 12:50 ` Dr. David Alan Gilbert
2016-01-12 1:58 ` Zhang Chen
2016-01-12 8:58 ` Dr. David Alan Gilbert
2015-12-22 10:42 ` [Qemu-devel] [RFC PATCH v2 03/10] Colo-proxy: add colo-proxy framework Zhang Chen
2016-02-19 19:57 ` Dr. David Alan Gilbert
2016-02-22 3:04 ` Zhang Chen
2015-12-22 10:42 ` [Qemu-devel] [RFC PATCH v2 04/10] Colo-proxy: add data structure and jhash func Zhang Chen
2015-12-22 10:42 ` [Qemu-devel] [RFC PATCH v2 05/10] net/colo-proxy: Add colo interface to use proxy Zhang Chen
2016-02-19 19:58 ` Dr. David Alan Gilbert
2016-02-22 3:08 ` Zhang Chen [this message]
2015-12-22 10:42 ` [Qemu-devel] [RFC PATCH v2 06/10] net/colo-proxy: add socket used by forward func Zhang Chen
2016-02-19 20:01 ` Dr. David Alan Gilbert
2016-02-22 5:51 ` Zhang Chen
2015-12-22 10:42 ` [Qemu-devel] [RFC PATCH v2 07/10] net/colo-proxy: Add packet enqueue & handle func Zhang Chen
2015-12-22 10:42 ` [Qemu-devel] [RFC PATCH v2 08/10] net/colo-proxy: Handle packet and connection Zhang Chen
2016-02-19 20:04 ` Dr. David Alan Gilbert
2016-02-22 6:41 ` Zhang Chen
2016-02-22 19:54 ` Dr. David Alan Gilbert
2016-02-23 17:58 ` Dr. David Alan Gilbert
2016-02-24 2:01 ` Zhang Chen
2015-12-22 10:42 ` [Qemu-devel] [RFC PATCH v2 09/10] net/colo-proxy: Compare pri pkt to sec pkt Zhang Chen
2016-02-19 20:07 ` Dr. David Alan Gilbert
2015-12-22 10:42 ` [Qemu-devel] [RFC PATCH v2 10/10] net/colo-proxy: Colo-proxy do checkpoint and clear Zhang Chen
2015-12-29 6:31 ` [Qemu-devel] [RFC PATCH v2 00/10] Add colo-proxy based on netfilter Zhang Chen
2015-12-29 6:58 ` Jason Wang
2015-12-29 7:08 ` Zhang Chen
2015-12-31 2:36 ` Jason Wang
2015-12-31 8:02 ` Li Zhijian
2016-01-04 2:08 ` Jason Wang
2015-12-31 8:40 ` Zhang Chen
2016-01-04 5:37 ` Jason Wang
2016-01-04 8:16 ` Zhang Chen
2016-01-04 9:46 ` Jason Wang
2016-01-04 11:17 ` Zhang Chen
2016-01-06 5:16 ` Jason Wang
2016-01-18 7:05 ` Zhang Chen
2016-01-18 9:29 ` Jason Wang
2016-01-20 3:29 ` Zhang Chen
2016-01-20 6:54 ` Jason Wang
2016-01-20 7:44 ` Wen Congyang
2016-01-20 9:20 ` Jason Wang
2016-01-20 9:49 ` Wen Congyang
2016-01-20 10:03 ` Jason Wang
2016-01-20 10:34 ` Wen Congyang
2016-01-22 5:33 ` Jason Wang
2016-01-22 5:57 ` Wen Congyang
2016-01-20 10:01 ` Wen Congyang
2016-01-20 10:19 ` Jason Wang
2016-01-20 10:30 ` Wen Congyang
2016-01-22 3:15 ` Jason Wang
2016-01-22 3:28 ` Wen Congyang
2016-01-22 5:41 ` Jason Wang
2016-01-22 5:56 ` Wen Congyang
2016-01-22 6:21 ` Jason Wang
2016-01-22 6:47 ` Wen Congyang
2016-01-22 7:42 ` Jason Wang
2016-01-22 7:46 ` Wen Congyang
2016-01-27 15:22 ` Eric Blake
2016-01-04 16:52 ` Dr. David Alan Gilbert
2016-01-06 5:20 ` Jason Wang
2016-01-06 9:10 ` Dr. David Alan Gilbert
2016-01-08 11:19 ` Dr. David Alan Gilbert
2016-01-11 1:30 ` Zhang Chen
2016-01-11 12:59 ` Dr. David Alan Gilbert
2016-01-12 7:32 ` Zhang Chen
2016-02-29 20:04 ` Dr. David Alan Gilbert
2016-03-01 2:39 ` Li Zhijian
2016-03-01 10:48 ` Dr. David Alan Gilbert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56CA7B96.2090603@cn.fujitsu.com \
--to=zhangchen.fnst@cn.fujitsu.com \
--cc=arei.gonglei@huawei.com \
--cc=dgilbert@redhat.com \
--cc=eddie.dong@intel.com \
--cc=guijianfeng@cn.fujitsu.com \
--cc=hongyang.yang@easystack.cn \
--cc=jan.kiszka@siemens.com \
--cc=jasowang@redhat.com \
--cc=lizhijian@cn.fujitsu.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=zhang.zhanghailiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.