From: Wen Congyang <wency@cn.fujitsu.com>
To: Fam Zheng <famz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
Yang Hongyang <yanghy@cn.fujitsu.com>,
Lai Jiangshan <laijs@cn.fujitsu.com>,
qemu block <qemu-block@nongnu.org>,
Jiang Yunhong <yunhong.jiang@intel.com>,
Dong Eddie <eddie.dong@intel.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
qemu devel <qemu-devel@nongnu.org>,
Gonglei <arei.gonglei@huawei.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Luiz Capitulino <lcapitulino@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Max Reitz <mreitz@redhat.com>,
Michael Roth <mdroth@linux.vnet.ibm.com>,
zhanghailiang <zhang.zhanghailiang@huawei.com>
Subject: Re: [Qemu-devel] [RFC PATCH COLO v2 04/13] Add new block driver interfaces to control block replication
Date: Thu, 26 Mar 2015 15:22:58 +0800 [thread overview]
Message-ID: <5513B3D2.3000506@cn.fujitsu.com> (raw)
In-Reply-To: <20150326071246.GA1035@ad.nay.redhat.com>
On 03/26/2015 03:12 PM, Fam Zheng wrote:
> On Wed, 03/25 17:36, Wen Congyang wrote:
>> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
>> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
>> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
>> Cc: Luiz Capitulino <lcapitulino@redhat.com>
>> Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
>> ---
>> block.c | 39 +++++++++++++++++++++++++++++++++++++++
>> include/block/block.h | 4 ++++
>> include/block/block_int.h | 11 +++++++++++
>> qapi/block.json | 16 ++++++++++++++++
>> 4 files changed, 70 insertions(+)
>>
>> diff --git a/block.c b/block.c
>> index 0fe97de..0ff5cf8 100644
>> --- a/block.c
>> +++ b/block.c
>> @@ -6196,3 +6196,42 @@ BlockAcctStats *bdrv_get_stats(BlockDriverState *bs)
>> {
>> return &bs->stats;
>> }
>> +
>> +void bdrv_start_replication(BlockDriverState *bs, COLOMode mode, Error **errp)
>> +{
>> + BlockDriver *drv = bs->drv;
>> +
>> + if (drv && drv->bdrv_start_replication) {
>> + drv->bdrv_start_replication(bs, mode, errp);
>> + } else if (bs->file) {
>> + bdrv_start_replication(bs->file, mode, errp);
>> + } else {
>> + error_set(errp, QERR_UNSUPPORTED);
>
> I think we should use error_setg in new code? (The same to following ones)
Hmm, do you mean that don't use QERR_UNSUPPORTED here?
>
>> + }
>> +}
>> +
>> +void bdrv_do_checkpoint(BlockDriverState *bs, Error **errp)
>> +{
>> + BlockDriver *drv = bs->drv;
>> +
>> + if (drv && drv->bdrv_do_checkpoint) {
>> + drv->bdrv_do_checkpoint(bs, errp);
>> + } else if (bs->file) {
>> + bdrv_do_checkpoint(bs->file, errp);
>> + } else {
>> + error_set(errp, QERR_UNSUPPORTED);
>> + }
>> +}
>> +
>> +void bdrv_stop_replication(BlockDriverState *bs, Error **errp)
>> +{
>> + BlockDriver *drv = bs->drv;
>> +
>> + if (drv && drv->bdrv_stop_replication) {
>> + drv->bdrv_stop_replication(bs, errp);
>> + } else if (bs->file) {
>> + bdrv_stop_replication(bs->file, errp);
>> + } else {
>> + error_set(errp, QERR_UNSUPPORTED);
>> + }
>> +}
>> diff --git a/include/block/block.h b/include/block/block.h
>> index 4c57d63..68f3b1a 100644
>> --- a/include/block/block.h
>> +++ b/include/block/block.h
>> @@ -569,4 +569,8 @@ void bdrv_flush_io_queue(BlockDriverState *bs);
>>
>> BlockAcctStats *bdrv_get_stats(BlockDriverState *bs);
>>
>> +void bdrv_start_replication(BlockDriverState *bs, COLOMode mode, Error **errp);
>> +void bdrv_do_checkpoint(BlockDriverState *bs, Error **errp);
>> +void bdrv_stop_replication(BlockDriverState *bs, Error **errp);
>> +
>> #endif
>> diff --git a/include/block/block_int.h b/include/block/block_int.h
>> index dccb092..08dd8ba 100644
>> --- a/include/block/block_int.h
>> +++ b/include/block/block_int.h
>> @@ -290,6 +290,17 @@ struct BlockDriver {
>> */
>> int (*bdrv_probe_geometry)(BlockDriverState *bs, HDGeometry *geo);
>>
>> +
>> + void (*bdrv_start_replication)(BlockDriverState *bs, COLOMode mode,
>> + Error **errp);
>
> Need some documentation, but I have a generic question:
>
> Why is a single interface with modes better than different functions for each
> mode (bdrv_start_replication_{primary,secondary}? Asking because the behavior
> is very different between them, and I don't see much sharing -- you implement
> primary operation in quorum, and secondary in qcow2+colo.
No special reason.
>
>> + /* Drop Disk buffer when doing checkpoint. */
>> + void (*bdrv_do_checkpoint)(BlockDriverState *bs, Error **errp);
>> + /*
>> + * After failover, we should flush Disk buffer into secondary disk
>> + * and stop block replication.
>> + */
>> + void (*bdrv_stop_replication)(BlockDriverState *bs, Error **errp);
>> +
>> QLIST_ENTRY(BlockDriver) list;
>> };
>>
>> diff --git a/qapi/block.json b/qapi/block.json
>> index e313465..e640566 100644
>> --- a/qapi/block.json
>> +++ b/qapi/block.json
>> @@ -40,6 +40,22 @@
>> 'data': ['auto', 'none', 'lba', 'large', 'rechs']}
>>
>> ##
>> +# @COLOMode
>> +#
>> +# An enumeration of COLO mode.
>> +#
>> +# @unprotected: COLO is not started or after failover
>> +#
>> +# @primary: Primary mode, the vm's state will be sent to secondary QEMU.
>> +#
>> +# @secondary: Secondary mode, receive the vm's state from primary QEMU.
>> +#
>> +# Since: 2.4
>> +##
>> +{ 'enum' : 'COLOMode',
>> + 'data' : ['unprotected', 'primary', 'secondary']}
>
> If split bdrv_start_replication, do we still need an enum? I can't find the
> usage in QMP interface, is it in some other series?
I will check it.
Thanks
Wen Congyang
>
> Fam
>
>> +
>> +##
>> # @BlockdevSnapshotInternal
>> #
>> # @device: the name of the device to generate the snapshot from
>> --
>> 2.1.0
>>
> .
>
next prev parent reply other threads:[~2015-03-26 7:20 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-25 9:36 [Qemu-devel] [RFC PATCH COLO v2 00/13] Block replication for continuous checkpoints Wen Congyang
2015-03-25 9:36 ` [Qemu-devel] [RFC PATCH COLO v2 01/13] docs: block replication's description Wen Congyang
2015-03-25 15:38 ` [Qemu-devel] [Qemu-block] " Eric Blake
2015-03-26 8:58 ` Wen Congyang
2015-03-26 10:28 ` Gonglei
2015-03-26 12:30 ` Eric Blake
2015-03-26 12:46 ` Gonglei
2015-03-26 6:31 ` [Qemu-devel] " Fam Zheng
2015-03-26 7:17 ` Wen Congyang
2015-04-03 2:35 ` Wen Congyang
2015-04-03 5:19 ` Fam Zheng
2015-03-25 9:36 ` [Qemu-devel] [RFC PATCH COLO v2 02/13] quorum: allow ignoring child errors Wen Congyang
2015-03-25 12:45 ` Paolo Bonzini
2015-03-25 9:36 ` [Qemu-devel] [RFC PATCH COLO v2 03/13] NBD client: connect to nbd server later Wen Congyang
2015-03-25 12:46 ` Paolo Bonzini
2015-03-25 9:36 ` [Qemu-devel] [RFC PATCH COLO v2 04/13] Add new block driver interfaces to control block replication Wen Congyang
2015-03-25 12:48 ` Paolo Bonzini
2015-03-25 15:43 ` Eric Blake
2015-03-26 7:12 ` Fam Zheng
2015-03-26 7:22 ` Wen Congyang [this message]
2015-03-25 9:36 ` [Qemu-devel] [RFC PATCH COLO v2 05/13] quorum: implement block driver interfaces for " Wen Congyang
2015-03-25 12:50 ` Paolo Bonzini
2015-03-25 9:36 ` [Qemu-devel] [RFC PATCH COLO v2 06/13] NBD client: " Wen Congyang
2015-03-25 12:50 ` Paolo Bonzini
2015-03-26 7:21 ` Fam Zheng
2015-03-26 7:32 ` Wen Congyang
2015-03-27 1:06 ` Fam Zheng
2015-03-27 1:16 ` Wen Congyang
2015-03-27 7:34 ` [Qemu-devel] Use of QERR_ macros and error classes (was: [RFC PATCH COLO v2 06/13] NBD client: implement block driver interfaces for block replication) Markus Armbruster
2015-03-25 9:36 ` [Qemu-devel] [RFC PATCH COLO v2 07/13] allow writing to the backing file Wen Congyang
2015-03-25 9:36 ` [Qemu-devel] [RFC PATCH COLO v2 08/13] Allow creating backup jobs when opening BDS Wen Congyang
2015-03-26 7:07 ` Fam Zheng
2015-03-26 7:14 ` Wen Congyang
2015-03-26 7:18 ` Fam Zheng
2015-03-26 7:23 ` Wen Congyang
2015-03-26 13:53 ` Paolo Bonzini
2015-03-25 9:36 ` [Qemu-devel] [RFC PATCH COLO v2 09/13] block: Parse "backing_reference" option to reference existing BDS Wen Congyang
2015-03-26 7:31 ` Fam Zheng
2015-03-25 9:36 ` [Qemu-devel] [RFC PATCH COLO v2 10/13] Backup: clear all bitmap when doing block checkpoint Wen Congyang
2015-03-25 12:55 ` Paolo Bonzini
2015-03-26 0:59 ` Wen Congyang
2015-03-25 9:36 ` [Qemu-devel] [RFC PATCH COLO v2 11/13] qcow2: support colo Wen Congyang
2015-03-25 9:36 ` [Qemu-devel] [RFC PATCH COLO v2 12/13] skip nbd_target when starting block replication Wen Congyang
2015-03-26 7:03 ` Fam Zheng
2015-03-26 7:15 ` Wen Congyang
2015-03-25 9:36 ` [Qemu-devel] [RFC PATCH COLO v2 13/13] Don't allow a disk use backing reference target Wen Congyang
2015-03-25 12:56 ` [Qemu-devel] [RFC PATCH COLO v2 00/13] Block replication for continuous checkpoints Paolo Bonzini
2015-03-25 14:24 ` Dr. David Alan Gilbert
2015-03-26 2:34 ` Gonglei
2015-07-01 3:09 ` Michael R. Hines
2015-07-01 4:11 ` Wen Congyang
2015-07-01 19:30 ` Michael R. Hines
2015-07-01 19:37 ` Michael R. Hines
2015-07-02 0:58 ` Wen Congyang
2015-07-02 1:43 ` Wen Congyang
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=5513B3D2.3000506@cn.fujitsu.com \
--to=wency@cn.fujitsu.com \
--cc=arei.gonglei@huawei.com \
--cc=dgilbert@redhat.com \
--cc=eddie.dong@intel.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=laijs@cn.fujitsu.com \
--cc=lcapitulino@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=yanghy@cn.fujitsu.com \
--cc=yunhong.jiang@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).