Message ID | 1469602913-20979-3-git-send-email-xiecl.fnst@cn.fujitsu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Jul 27, 2016 at 03:01:43PM +0800, Changlong Xie wrote: > From: Wen Congyang <wency@cn.fujitsu.com> > > Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> > Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com> > Signed-off-by: Wang WeiWei <wangww.fnst@cn.fujitsu.com> > Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> > Signed-off-by: Gonglei <arei.gonglei@huawei.com> > --- > block/backup.c | 18 ++++++++++++++++++ > include/block/block_backup.h | 25 +++++++++++++++++++++++++ > 2 files changed, 43 insertions(+) > create mode 100644 include/block/block_backup.h Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
On Wed, Jul 27, 2016 at 03:01:43PM +0800, Changlong Xie wrote: > From: Wen Congyang <wency@cn.fujitsu.com> > > Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> > Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com> > Signed-off-by: Wang WeiWei <wangww.fnst@cn.fujitsu.com> > Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> > Signed-off-by: Gonglei <arei.gonglei@huawei.com> > --- > block/backup.c | 18 ++++++++++++++++++ > include/block/block_backup.h | 25 +++++++++++++++++++++++++ > 2 files changed, 43 insertions(+) > create mode 100644 include/block/block_backup.h [...] Tested-by: Kashyap Chamarthy <kchamart@redhat.com> Test case: Without this patch applied ========================== Create an empty target image: $ qemu-img create -f qcow2 target.qcow2 1G $ ./qmp-shell -v -p ./qmp-sock (QEMU) blockdev-add options={"id":"drive-ide1-0-0","driver":"qcow2","file":{"driver":"file","filename":"/export/target.qcow2"},"backing":"drive-ide0-0-0"} (QEMU) blockdev-backup device=drive-ide0-0-0 target=drive-ide1-0-0 sync=none { "execute": "blockdev-backup", "arguments": { "device": "drive-ide0-0-0", "target": "drive-ide1-0-0", "sync": "none" } } { "error": { "class": "GenericError", "desc": "Node 'drive-ide0-0-0' is busy: node is used as backing hd of '#block360'" } } With this patch applied ======================= `blockdev-backup` of an image to its immediate overlay succeds: ----------------------------------------------------------------------- (QEMU) blockdev-backup device=drive-ide0-0-0 target=drive-ide1-0-0 sync=none { "execute": "blockdev-backup", "arguments": { "device": "drive-ide0-0-0", "target": "drive-ide1-0-0", "sync": "none" } } { "return": {} } (QEMU) query-block-jobs { "execute": "query-block-jobs", "arguments": {} } { "return": [ { "busy": false, "type": "backup", "len": 41126400, "paused": false, "ready": false, "io-status": "ok", "offset": 0, "device": "drive-ide0-0-0", "speed": 0 } ] } -----------------------------------------------------------------------
On Tue, Aug 16, 2016 at 02:55:41PM +0200, Kashyap Chamarthy wrote: > On Wed, Jul 27, 2016 at 03:01:43PM +0800, Changlong Xie wrote: > > From: Wen Congyang <wency@cn.fujitsu.com> > > > > Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> > > Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com> > > Signed-off-by: Wang WeiWei <wangww.fnst@cn.fujitsu.com> > > Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> > > Signed-off-by: Gonglei <arei.gonglei@huawei.com> > > --- > > block/backup.c | 18 ++++++++++++++++++ > > include/block/block_backup.h | 25 +++++++++++++++++++++++++ > > 2 files changed, 43 insertions(+) > > create mode 100644 include/block/block_backup.h > > [...] > Tested-by: Kashyap Chamarthy <kchamart@redhat.com> I meant to give the Tested-by to this patch: [PATCH v24 01/12] unblock backup operations in backing file https://lists.gnu.org/archive/html/qemu-devel/2016-07/msg06096.html (I erroneously mixed up 01/12 02/12, sorry for the noise.) I'll respond on the correct patch, for archives' sake. [...]
diff --git a/block/backup.c b/block/backup.c index 2c05323..3bce416 100644 --- a/block/backup.c +++ b/block/backup.c @@ -17,6 +17,7 @@ #include "block/block.h" #include "block/block_int.h" #include "block/blockjob.h" +#include "block/block_backup.h" #include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qemu/ratelimit.h" @@ -253,6 +254,23 @@ static void backup_attached_aio_context(BlockJob *job, AioContext *aio_context) blk_set_aio_context(s->target, aio_context); } +void backup_do_checkpoint(BlockJob *job, Error **errp) +{ + BackupBlockJob *backup_job = container_of(job, BackupBlockJob, common); + int64_t len; + + assert(job->driver->job_type == BLOCK_JOB_TYPE_BACKUP); + + if (backup_job->sync_mode != MIRROR_SYNC_MODE_NONE) { + error_setg(errp, "The backup job only supports block checkpoint in" + " sync=none mode"); + return; + } + + len = DIV_ROUND_UP(backup_job->common.len, backup_job->cluster_size); + bitmap_zero(backup_job->done_bitmap, len); +} + static const BlockJobDriver backup_job_driver = { .instance_size = sizeof(BackupBlockJob), .job_type = BLOCK_JOB_TYPE_BACKUP, diff --git a/include/block/block_backup.h b/include/block/block_backup.h new file mode 100644 index 0000000..157596c --- /dev/null +++ b/include/block/block_backup.h @@ -0,0 +1,25 @@ +/* + * QEMU backup + * + * Copyright (c) 2013 Proxmox Server Solutions + * Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD. + * Copyright (c) 2016 Intel Corporation + * Copyright (c) 2016 FUJITSU LIMITED + * + * Authors: + * Dietmar Maurer <dietmar@proxmox.com> + * Changlong Xie <xiecl.fnst@cn.fujitsu.com> + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#ifndef BLOCK_BACKUP_H +#define BLOCK_BACKUP_H + +#include "block/block_int.h" + +void backup_do_checkpoint(BlockJob *job, Error **errp); + +#endif