From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565997574; cv=none; d=zoho.com; s=zohoarc; b=kLQhkB3DLTQJTFZBf8rpHURxSAay3RpS3bzjUImkxfjjLzaER+T+J0WOPt86dmASmLn70eJieZO9IrHovp1ECpFRrZcKxjtu9CnO4/OgLlmk7/EJLRr9hehgDverMZIdhhhfDn/hlSI1xmjpmloT9yy/M5CswSH66JhuUVK7joI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565997574; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ty2ol5srfVpM8//VHW6bQYalFYxAcLPNuehetTJXF2w=; b=Dydn2CUcu9bto4AvUZGmWPFuTPHujytuteGtO0vw7e+B/PsPB1yTirn+Ccw1+RZ9Qn79wD03o2led7KfoNM5cGZFAqAE4Oyra3ZaHFFsryTK/sbSlWJRPsEeVCepFPpwSokE1ItHR7A8fl455xJHwyeTkanhH6zadD5Zc6mAIkk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565997574713588.681537733139; Fri, 16 Aug 2019 16:19:34 -0700 (PDT) Received: from localhost ([::1]:33120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylVN-0004Bl-4T for importer@patchew.org; Fri, 16 Aug 2019 19:19:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46054) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPY-0006BZ-RM for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPX-0005hJ-47 for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40896) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPR-0005bN-Gj; Fri, 16 Aug 2019 19:13:26 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C0AE3082A6C; Fri, 16 Aug 2019 23:13:23 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4F6C19C6A; Fri, 16 Aug 2019 23:13:22 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:43 -0400 Message-Id: <20190816231318.8650-2-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 16 Aug 2019 23:13:23 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 01/36] qapi/block-core: Introduce BackupCommon X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-block@nongnu.org, Markus Armbruster , qemu-stable@nongnu.org, Max Reitz , jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" drive-backup and blockdev-backup have an awful lot of things in common that are the same. Let's fix that. I don't deduplicate 'target', because the semantics actually did change between each structure. Leave that one alone so it can be documented separately. Where documentation was not identical, use the most up-to-date version. For "speed", use Blockdev-Backup's version. For "sync", use Drive-Backup's version. Signed-off-by: John Snow Reviewed-by: Max Reitz [Maintainer edit: modified commit message. --js] Reviewed-by: Markus Armbruster Message-id: 20190709232550.10724-2-jsnow@redhat.com Signed-off-by: John Snow --- qapi/block-core.json | 103 ++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 70 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index f1e7701fbea..8ca12004ae9 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1315,32 +1315,23 @@ 'data': { 'node': 'str', 'overlay': 'str' } } =20 ## -# @DriveBackup: +# @BackupCommon: # # @job-id: identifier for the newly-created block job. If # omitted, the device name will be used. (Since 2.7) # # @device: the device name or node-name of a root node which should be cop= ied. # -# @target: the target of the new image. If the file exists, or if it -# is a device, the existing file/device will be used as the new -# destination. If it does not exist, a new file will be created. -# -# @format: the format of the new destination, default is to -# probe if @mode is 'existing', else the format of the source -# # @sync: what parts of the disk image should be copied to the destination # (all the disk, only the sectors allocated in the topmost image, f= rom a # dirty bitmap, or only new I/O). # -# @mode: whether and how QEMU should create a new image, default is -# 'absolute-paths'. -# -# @speed: the maximum speed, in bytes per second +# @speed: the maximum speed, in bytes per second. The default is 0, +# for unlimited. # # @bitmap: the name of dirty bitmap if sync is "incremental". # Must be present if sync is "incremental", must NOT be present -# otherwise. (Since 2.4) +# otherwise. (Since 2.4 (drive-backup), 3.1 (blockdev-backup)) # # @compress: true to compress data, if the target format supports it. # (default: false) (since 2.8) @@ -1370,75 +1361,47 @@ # I/O. If an error occurs during a guest write request, the device's # rerror/werror actions will be used. # +# Since: 4.2 +## +{ 'struct': 'BackupCommon', + 'data': { '*job-id': 'str', 'device': 'str', + 'sync': 'MirrorSyncMode', '*speed': 'int', + '*bitmap': 'str', '*compress': 'bool', + '*on-source-error': 'BlockdevOnError', + '*on-target-error': 'BlockdevOnError', + '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } } + +## +# @DriveBackup: +# +# @target: the target of the new image. If the file exists, or if it +# is a device, the existing file/device will be used as the new +# destination. If it does not exist, a new file will be created. +# +# @format: the format of the new destination, default is to +# probe if @mode is 'existing', else the format of the source +# +# @mode: whether and how QEMU should create a new image, default is +# 'absolute-paths'. +# # Since: 1.6 ## { 'struct': 'DriveBackup', - 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str', - '*format': 'str', 'sync': 'MirrorSyncMode', - '*mode': 'NewImageMode', '*speed': 'int', - '*bitmap': 'str', '*compress': 'bool', - '*on-source-error': 'BlockdevOnError', - '*on-target-error': 'BlockdevOnError', - '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } } + 'base': 'BackupCommon', + 'data': { 'target': 'str', + '*format': 'str', + '*mode': 'NewImageMode' } } =20 ## # @BlockdevBackup: # -# @job-id: identifier for the newly-created block job. If -# omitted, the device name will be used. (Since 2.7) -# -# @device: the device name or node-name of a root node which should be cop= ied. -# # @target: the device name or node-name of the backup target node. # -# @sync: what parts of the disk image should be copied to the destination -# (all the disk, only the sectors allocated in the topmost image, or -# only new I/O). -# -# @speed: the maximum speed, in bytes per second. The default is 0, -# for unlimited. -# -# @bitmap: the name of dirty bitmap if sync is "incremental". -# Must be present if sync is "incremental", must NOT be present -# otherwise. (Since 3.1) -# -# @compress: true to compress data, if the target format supports it. -# (default: false) (since 2.8) -# -# @on-source-error: the action to take on an error on the source, -# default 'report'. 'stop' and 'enospc' can only be used -# if the block device supports io-status (see BlockInfo). -# -# @on-target-error: the action to take on an error on the target, -# default 'report' (no limitations, since this applies to -# a different block device than @device). -# -# @auto-finalize: When false, this job will wait in a PENDING state after = it has -# finished its work, waiting for @block-job-finalize before -# making any block graph changes. -# When true, this job will automatically -# perform its abort or commit actions. -# Defaults to true. (Since 2.12) -# -# @auto-dismiss: When false, this job will wait in a CONCLUDED state after= it -# has completely ceased all work, and awaits @block-job-dis= miss. -# When true, this job will automatically disappear from the= query -# list without user intervention. -# Defaults to true. (Since 2.12) -# -# Note: @on-source-error and @on-target-error only affect background -# I/O. If an error occurs during a guest write request, the device's -# rerror/werror actions will be used. -# # Since: 2.3 ## { 'struct': 'BlockdevBackup', - 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str', - 'sync': 'MirrorSyncMode', '*speed': 'int', - '*bitmap': 'str', '*compress': 'bool', - '*on-source-error': 'BlockdevOnError', - '*on-target-error': 'BlockdevOnError', - '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } } + 'base': 'BackupCommon', + 'data': { 'target': 'str' } } =20 ## # @blockdev-snapshot-sync: --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565997719; cv=none; d=zoho.com; s=zohoarc; b=fk2g7vUEMXp8cfPMedmiT5C1vh92nrFV71iR32mzmzshiqx/QeCDkRkvICBbknP/oR9xwfI3/E8rOeuydfMsM7k85f/jH12eXxtmycqNnpdwv+VPj1ElHN+RFxJGCIjKkKStO9XveC8/TTieNL0k/DrYLrn8V7AxGWcp7yWBsLA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565997719; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Td5EpOmQvGwScy+wlC1Jui+TPrsg9BC760sXc4U8H18=; b=iOogsqjiVrFbZ7cQKdqv9XsE6Pug7nTaP+UfVvxOIcNt4ZXw1H3vHYubAS1r9QNwkIpTqwiJsvmsXYakBIIGSqf0u3eBLu+o3H56QpMW6YG7/aMgQ2Ntm3QP3KTEZPEVBd6mWKSSWd6hH5EQbDGC/8vFuaY97LI/YZy2dlaD4VU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565997719056788.8346262788218; Fri, 16 Aug 2019 16:21:59 -0700 (PDT) Received: from localhost ([::1]:33162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylXf-0007ps-0U for importer@patchew.org; Fri, 16 Aug 2019 19:21:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46127) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPa-0006EP-EI for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPY-0005jV-Qr for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43704) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPT-0005bz-Eq; Fri, 16 Aug 2019 19:13:29 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 727F7C049E1A; Fri, 16 Aug 2019 23:13:24 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id BFA5719C6A; Fri, 16 Aug 2019 23:13:23 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:44 -0400 Message-Id: <20190816231318.8650-3-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 16 Aug 2019 23:13:24 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 02/36] drive-backup: create do_backup_common X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Create a common core that comprises the actual meat of what the backup API boundary needs to do, and then switch drive-backup to use it. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-3-jsnow@redhat.com Signed-off-by: John Snow --- blockdev.c | 122 +++++++++++++++++++++++++++++------------------------ 1 file changed, 67 insertions(+), 55 deletions(-) diff --git a/blockdev.c b/blockdev.c index 95cdd5a5cb0..d822b19b4b0 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3427,6 +3427,70 @@ out: aio_context_release(aio_context); } =20 +/* Common QMP interface for drive-backup and blockdev-backup */ +static BlockJob *do_backup_common(BackupCommon *backup, + BlockDriverState *bs, + BlockDriverState *target_bs, + AioContext *aio_context, + JobTxn *txn, Error **errp) +{ + BlockJob *job =3D NULL; + BdrvDirtyBitmap *bmap =3D NULL; + int job_flags =3D JOB_DEFAULT; + int ret; + + if (!backup->has_speed) { + backup->speed =3D 0; + } + if (!backup->has_on_source_error) { + backup->on_source_error =3D BLOCKDEV_ON_ERROR_REPORT; + } + if (!backup->has_on_target_error) { + backup->on_target_error =3D BLOCKDEV_ON_ERROR_REPORT; + } + if (!backup->has_job_id) { + backup->job_id =3D NULL; + } + if (!backup->has_auto_finalize) { + backup->auto_finalize =3D true; + } + if (!backup->has_auto_dismiss) { + backup->auto_dismiss =3D true; + } + if (!backup->has_compress) { + backup->compress =3D false; + } + + ret =3D bdrv_try_set_aio_context(target_bs, aio_context, errp); + if (ret < 0) { + return NULL; + } + + if (backup->has_bitmap) { + bmap =3D bdrv_find_dirty_bitmap(bs, backup->bitmap); + if (!bmap) { + error_setg(errp, "Bitmap '%s' could not be found", backup->bit= map); + return NULL; + } + if (bdrv_dirty_bitmap_check(bmap, BDRV_BITMAP_DEFAULT, errp)) { + return NULL; + } + } + + if (!backup->auto_finalize) { + job_flags |=3D JOB_MANUAL_FINALIZE; + } + if (!backup->auto_dismiss) { + job_flags |=3D JOB_MANUAL_DISMISS; + } + + job =3D backup_job_create(backup->job_id, bs, target_bs, backup->speed, + backup->sync, bmap, backup->compress, + backup->on_source_error, backup->on_target_err= or, + job_flags, NULL, NULL, txn, errp); + return job; +} + static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn, Error **errp) { @@ -3434,39 +3498,16 @@ static BlockJob *do_drive_backup(DriveBackup *backu= p, JobTxn *txn, BlockDriverState *target_bs; BlockDriverState *source =3D NULL; BlockJob *job =3D NULL; - BdrvDirtyBitmap *bmap =3D NULL; AioContext *aio_context; QDict *options =3D NULL; Error *local_err =3D NULL; - int flags, job_flags =3D JOB_DEFAULT; + int flags; int64_t size; bool set_backing_hd =3D false; - int ret; =20 - if (!backup->has_speed) { - backup->speed =3D 0; - } - if (!backup->has_on_source_error) { - backup->on_source_error =3D BLOCKDEV_ON_ERROR_REPORT; - } - if (!backup->has_on_target_error) { - backup->on_target_error =3D BLOCKDEV_ON_ERROR_REPORT; - } if (!backup->has_mode) { backup->mode =3D NEW_IMAGE_MODE_ABSOLUTE_PATHS; } - if (!backup->has_job_id) { - backup->job_id =3D NULL; - } - if (!backup->has_auto_finalize) { - backup->auto_finalize =3D true; - } - if (!backup->has_auto_dismiss) { - backup->auto_dismiss =3D true; - } - if (!backup->has_compress) { - backup->compress =3D false; - } =20 bs =3D bdrv_lookup_bs(backup->device, backup->device, errp); if (!bs) { @@ -3543,12 +3584,6 @@ static BlockJob *do_drive_backup(DriveBackup *backup= , JobTxn *txn, goto out; } =20 - ret =3D bdrv_try_set_aio_context(target_bs, aio_context, errp); - if (ret < 0) { - bdrv_unref(target_bs); - goto out; - } - if (set_backing_hd) { bdrv_set_backing_hd(target_bs, source, &local_err); if (local_err) { @@ -3556,31 +3591,8 @@ static BlockJob *do_drive_backup(DriveBackup *backup= , JobTxn *txn, } } =20 - if (backup->has_bitmap) { - bmap =3D bdrv_find_dirty_bitmap(bs, backup->bitmap); - if (!bmap) { - error_setg(errp, "Bitmap '%s' could not be found", backup->bit= map); - goto unref; - } - if (bdrv_dirty_bitmap_check(bmap, BDRV_BITMAP_DEFAULT, errp)) { - goto unref; - } - } - if (!backup->auto_finalize) { - job_flags |=3D JOB_MANUAL_FINALIZE; - } - if (!backup->auto_dismiss) { - job_flags |=3D JOB_MANUAL_DISMISS; - } - - job =3D backup_job_create(backup->job_id, bs, target_bs, backup->speed, - backup->sync, bmap, backup->compress, - backup->on_source_error, backup->on_target_err= or, - job_flags, NULL, NULL, txn, &local_err); - if (local_err !=3D NULL) { - error_propagate(errp, local_err); - goto unref; - } + job =3D do_backup_common(qapi_DriveBackup_base(backup), + bs, target_bs, aio_context, txn, errp); =20 unref: bdrv_unref(target_bs); --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565997357; cv=none; d=zoho.com; s=zohoarc; b=nEDQRC0GSQ0yBh98QW9vyFyvdUPyxRHWHUnefwWEiFJ7NeENzIBhhPTLP0y5VdRTpPr4nF56FbxJb9Exr4HTcTis1DNAjn+uir8lseQkQZZwqnozQg/tRBT3BrhfvBV3EipsSdCTFhX9z6mvQR4yQuHB2k8gLfeU6TwizRM+3Rc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565997357; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=7LAOZPVniS/xXLnQLle+nOcaHaqKsuf7mf0pgWV7sd4=; b=Uq/ur9fUyU+3FPLjKrn7QdHdD4Cdq4zVpyNabSdaoHKFo24j6SutN8Hd15rYdHk2dqWRCD0Zxw59xoq5vxlpBOcuzEuagJx4KDi9XMLFQIGbNtxnuZqFtmc8pyZ/fmQoVWiNUNsc/sv1x76NJePdxgplgbf56TdKWhSg+Zc4o7U= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565997357173690.6995734887419; Fri, 16 Aug 2019 16:15:57 -0700 (PDT) Received: from localhost ([::1]:33038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylRq-0000Mu-Qj for importer@patchew.org; Fri, 16 Aug 2019 19:15:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46024) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPY-0006AX-4v for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPW-0005gp-Mi for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37208) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPT-0005bv-Ej; Fri, 16 Aug 2019 19:13:27 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4BBA9190C01D; Fri, 16 Aug 2019 23:13:25 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9518A19C6A; Fri, 16 Aug 2019 23:13:24 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:45 -0400 Message-Id: <20190816231318.8650-4-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.70]); Fri, 16 Aug 2019 23:13:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 03/36] blockdev-backup: utilize do_backup_common X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-4-jsnow@redhat.com Signed-off-by: John Snow --- blockdev.c | 65 +++++------------------------------------------------- 1 file changed, 6 insertions(+), 59 deletions(-) diff --git a/blockdev.c b/blockdev.c index d822b19b4b0..8e4f70a8d66 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3626,78 +3626,25 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup= , JobTxn *txn, { BlockDriverState *bs; BlockDriverState *target_bs; - Error *local_err =3D NULL; - BdrvDirtyBitmap *bmap =3D NULL; AioContext *aio_context; - BlockJob *job =3D NULL; - int job_flags =3D JOB_DEFAULT; - int ret; - - if (!backup->has_speed) { - backup->speed =3D 0; - } - if (!backup->has_on_source_error) { - backup->on_source_error =3D BLOCKDEV_ON_ERROR_REPORT; - } - if (!backup->has_on_target_error) { - backup->on_target_error =3D BLOCKDEV_ON_ERROR_REPORT; - } - if (!backup->has_job_id) { - backup->job_id =3D NULL; - } - if (!backup->has_auto_finalize) { - backup->auto_finalize =3D true; - } - if (!backup->has_auto_dismiss) { - backup->auto_dismiss =3D true; - } - if (!backup->has_compress) { - backup->compress =3D false; - } + BlockJob *job; =20 bs =3D bdrv_lookup_bs(backup->device, backup->device, errp); if (!bs) { return NULL; } =20 - aio_context =3D bdrv_get_aio_context(bs); - aio_context_acquire(aio_context); - target_bs =3D bdrv_lookup_bs(backup->target, backup->target, errp); if (!target_bs) { - goto out; + return NULL; } =20 - ret =3D bdrv_try_set_aio_context(target_bs, aio_context, errp); - if (ret < 0) { - goto out; - } + aio_context =3D bdrv_get_aio_context(bs); + aio_context_acquire(aio_context); =20 - if (backup->has_bitmap) { - bmap =3D bdrv_find_dirty_bitmap(bs, backup->bitmap); - if (!bmap) { - error_setg(errp, "Bitmap '%s' could not be found", backup->bit= map); - goto out; - } - if (bdrv_dirty_bitmap_check(bmap, BDRV_BITMAP_DEFAULT, errp)) { - goto out; - } - } + job =3D do_backup_common(qapi_BlockdevBackup_base(backup), + bs, target_bs, aio_context, txn, errp); =20 - if (!backup->auto_finalize) { - job_flags |=3D JOB_MANUAL_FINALIZE; - } - if (!backup->auto_dismiss) { - job_flags |=3D JOB_MANUAL_DISMISS; - } - job =3D backup_job_create(backup->job_id, bs, target_bs, backup->speed, - backup->sync, bmap, backup->compress, - backup->on_source_error, backup->on_target_err= or, - job_flags, NULL, NULL, txn, &local_err); - if (local_err !=3D NULL) { - error_propagate(errp, local_err); - } -out: aio_context_release(aio_context); return job; } --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565997588; cv=none; d=zoho.com; s=zohoarc; b=EKfpGULu0/aJntBEJa9L03JzmABJNPjz8WtXt238X7JctmdZYVOaN6Rs5T1kQE4ac1B3T0JRkqCsFjhoke/WN/RWlcijsljJtwTncj49kFg7FVNe/pAwB3t825x2QnZZhSWUaeOaDtEzGgE7y+E0SrzKE/dVufPfOPoI3kFM1cI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565997588; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=x8TWgVMuQRwsJy8PrlPVIi4RyeLX+14AntaaL/Q2+mE=; b=Q+V7oX/CTxlBiEhJA5DYg+V7w3yA/9qPN/4yXnfWfOBaOA96Av0qjvUoZC8ERL/oqpnnaUVyOxgyqfVJe9qVzN14HVZ8QwZ7LvPM9+g/z1b/3S9c9CPstMqE7Yq6a2wKnIpsX6qa0LMJdWJdMRWuMp4yvtXH/l7+orDWYeB8leI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565997588708264.7571096786761; Fri, 16 Aug 2019 16:19:48 -0700 (PDT) Received: from localhost ([::1]:33124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylVb-0004Xd-99 for importer@patchew.org; Fri, 16 Aug 2019 19:19:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46066) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPZ-0006By-1I for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPX-0005hn-HB for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51440) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPU-0005cz-EO; Fri, 16 Aug 2019 19:13:28 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 34C721089042; Fri, 16 Aug 2019 23:13:26 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C3BE19C6A; Fri, 16 Aug 2019 23:13:25 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:46 -0400 Message-Id: <20190816231318.8650-5-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Fri, 16 Aug 2019 23:13:26 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 04/36] qapi: add BitmapSyncMode enum X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-block@nongnu.org, Markus Armbruster , qemu-stable@nongnu.org, Max Reitz , jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Depending on what a user is trying to accomplish, there might be a few bitmap cleanup actions that occur when an operation is finished that could be useful. I am proposing three: - NEVER: The bitmap is never synchronized against what was copied. - ALWAYS: The bitmap is always synchronized, even on failures. - ON-SUCCESS: The bitmap is synchronized only on success. The existing incremental backup modes use 'on-success' semantics, so add just that one for right now. Signed-off-by: John Snow Reviewed-by: Max Reitz Reviewed-by: Markus Armbruster Message-id: 20190709232550.10724-5-jsnow@redhat.com Signed-off-by: John Snow --- qapi/block-core.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/qapi/block-core.json b/qapi/block-core.json index 8ca12004ae9..06eb3bb3d78 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1134,6 +1134,20 @@ { 'enum': 'MirrorSyncMode', 'data': ['top', 'full', 'none', 'incremental'] } =20 +## +# @BitmapSyncMode: +# +# An enumeration of possible behaviors for the synchronization of a bitmap +# when used for data copy operations. +# +# @on-success: The bitmap is only synced when the operation is successful. +# This is the behavior always used for 'INCREMENTAL' backups. +# +# Since: 4.2 +## +{ 'enum': 'BitmapSyncMode', + 'data': ['on-success'] } + ## # @MirrorCopyMode: # --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565997827; cv=none; d=zoho.com; s=zohoarc; b=ZwHbRwx5Tc7eNgNCEtiepVMVVoC433KFRVerSldamFLrrMVmhZp7HIDQzV/1umNXV6XgLE37J2d/S5iYoNF/6Y55LWzNAdE8k/yoQRGJGYVR36G7UwYOihxo3R5T/VgJLoiVSHVyK6QeZASiY3t1J1wmDhXYJ/X0hGrVKnx7hZ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565997827; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=EOdPSdfBW3q/56rMC7F+F9/4r+yT0DjnTEHzFChRznw=; b=V13gCkS092s2jFw1zm2KeDKlM2aZu7GyDjCvh/uObwGIBoybU3rD3HPyyTnrDcTFGoVyw1P+K8qDOLm9jlIIakCBARvyswFea0WxmWeZTYVD0gVES8yXGHA+jYnDUm0GMPnpv0Gg//ACEVGypECC0+jqidmPhsOuf8wwTFj8YHY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15659978279728.55162780306955; Fri, 16 Aug 2019 16:23:47 -0700 (PDT) Received: from localhost ([::1]:33194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylZS-0002Fl-J1 for importer@patchew.org; Fri, 16 Aug 2019 19:23:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46329) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPf-0006MM-6n for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPb-0005ms-Ao for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46942) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPW-0005cs-F7; Fri, 16 Aug 2019 19:13:30 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 08FF1859FB; Fri, 16 Aug 2019 23:13:27 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5601619C6A; Fri, 16 Aug 2019 23:13:26 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:47 -0400 Message-Id: <20190816231318.8650-6-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 16 Aug 2019 23:13:27 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 05/36] block/backup: Add mirror sync mode 'bitmap' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We don't need or want a new sync mode for simple differences in semantics. Create a new mode simply named "BITMAP" that is designed to make use of the new Bitmap Sync Mode field. Because the only bitmap sync mode is 'on-success', this adds no new functionality to the backup job (yet). The old incremental backup mode is maintained as a syntactic sugar for sync=3Dbitmap, mode=3Don-success. Add all of the plumbing necessary to support this new instruction. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-6-jsnow@redhat.com Signed-off-by: John Snow --- block/backup.c | 20 ++++++++++++-------- block/mirror.c | 6 ++++-- block/replication.c | 2 +- blockdev.c | 25 +++++++++++++++++++++++-- include/block/block_int.h | 4 +++- qapi/block-core.json | 21 +++++++++++++++------ 6 files changed, 58 insertions(+), 20 deletions(-) diff --git a/block/backup.c b/block/backup.c index 4743c8f0bc5..2b4c5c23e4e 100644 --- a/block/backup.c +++ b/block/backup.c @@ -38,9 +38,9 @@ typedef struct CowRequest { typedef struct BackupBlockJob { BlockJob common; BlockBackend *target; - /* bitmap for sync=3Dincremental */ BdrvDirtyBitmap *sync_bitmap; MirrorSyncMode sync_mode; + BitmapSyncMode bitmap_mode; BlockdevOnError on_source_error; BlockdevOnError on_target_error; CoRwlock flush_rwlock; @@ -461,7 +461,7 @@ static int coroutine_fn backup_run(Job *job, Error **er= rp) =20 job_progress_set_remaining(job, s->len); =20 - if (s->sync_mode =3D=3D MIRROR_SYNC_MODE_INCREMENTAL) { + if (s->sync_mode =3D=3D MIRROR_SYNC_MODE_BITMAP) { backup_incremental_init_copy_bitmap(s); } else { hbitmap_set(s->copy_bitmap, 0, s->len); @@ -545,6 +545,7 @@ static int64_t backup_calculate_cluster_size(BlockDrive= rState *target, BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, BlockDriverState *target, int64_t speed, MirrorSyncMode sync_mode, BdrvDirtyBitmap *sync_bitmap, + BitmapSyncMode bitmap_mode, bool compress, BlockdevOnError on_source_error, BlockdevOnError on_target_error, @@ -592,10 +593,13 @@ BlockJob *backup_job_create(const char *job_id, Block= DriverState *bs, return NULL; } =20 - if (sync_mode =3D=3D MIRROR_SYNC_MODE_INCREMENTAL) { + /* QMP interface should have handled translating this to bitmap mode */ + assert(sync_mode !=3D MIRROR_SYNC_MODE_INCREMENTAL); + + if (sync_mode =3D=3D MIRROR_SYNC_MODE_BITMAP) { if (!sync_bitmap) { error_setg(errp, "must provide a valid bitmap name for " - "\"incremental\" sync mode"); + "'%s' sync mode", MirrorSyncMode_str(sync_mode)); return NULL; } =20 @@ -605,8 +609,8 @@ BlockJob *backup_job_create(const char *job_id, BlockDr= iverState *bs, } } else if (sync_bitmap) { error_setg(errp, - "a sync_bitmap was provided to backup_run, " - "but received an incompatible sync_mode (%s)", + "a bitmap was given to backup_job_create, " + "but it received an incompatible sync_mode (%s)", MirrorSyncMode_str(sync_mode)); return NULL; } @@ -649,8 +653,8 @@ BlockJob *backup_job_create(const char *job_id, BlockDr= iverState *bs, job->on_source_error =3D on_source_error; job->on_target_error =3D on_target_error; job->sync_mode =3D sync_mode; - job->sync_bitmap =3D sync_mode =3D=3D MIRROR_SYNC_MODE_INCREMENTAL ? - sync_bitmap : NULL; + job->sync_bitmap =3D sync_bitmap; + job->bitmap_mode =3D bitmap_mode; job->compress =3D compress; =20 /* Detect image-fleecing (and similar) schemes */ diff --git a/block/mirror.c b/block/mirror.c index 9b36391bb97..70f24d9ef63 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1755,8 +1755,10 @@ void mirror_start(const char *job_id, BlockDriverSta= te *bs, bool is_none_mode; BlockDriverState *base; =20 - if (mode =3D=3D MIRROR_SYNC_MODE_INCREMENTAL) { - error_setg(errp, "Sync mode 'incremental' not supported"); + if ((mode =3D=3D MIRROR_SYNC_MODE_INCREMENTAL) || + (mode =3D=3D MIRROR_SYNC_MODE_BITMAP)) { + error_setg(errp, "Sync mode '%s' not supported", + MirrorSyncMode_str(mode)); return; } is_none_mode =3D mode =3D=3D MIRROR_SYNC_MODE_NONE; diff --git a/block/replication.c b/block/replication.c index 23b2993d747..936b2f8b5a4 100644 --- a/block/replication.c +++ b/block/replication.c @@ -543,7 +543,7 @@ static void replication_start(ReplicationState *rs, Rep= licationMode mode, =20 s->backup_job =3D backup_job_create( NULL, s->secondary_disk->bs, s->hidden_dis= k->bs, - 0, MIRROR_SYNC_MODE_NONE, NULL, false, + 0, MIRROR_SYNC_MODE_NONE, NULL, 0, false, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT, JOB_INTERNAL, backup_job_completed, bs, NULL, &local_err= ); diff --git a/blockdev.c b/blockdev.c index 8e4f70a8d66..985b6cd75c0 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3466,12 +3466,31 @@ static BlockJob *do_backup_common(BackupCommon *bac= kup, return NULL; } =20 + if (backup->sync =3D=3D MIRROR_SYNC_MODE_INCREMENTAL) { + if (backup->has_bitmap_mode && + backup->bitmap_mode !=3D BITMAP_SYNC_MODE_ON_SUCCESS) { + error_setg(errp, "Bitmap sync mode must be '%s' " + "when using sync mode '%s'", + BitmapSyncMode_str(BITMAP_SYNC_MODE_ON_SUCCESS), + MirrorSyncMode_str(backup->sync)); + return NULL; + } + backup->has_bitmap_mode =3D true; + backup->sync =3D MIRROR_SYNC_MODE_BITMAP; + backup->bitmap_mode =3D BITMAP_SYNC_MODE_ON_SUCCESS; + } + if (backup->has_bitmap) { bmap =3D bdrv_find_dirty_bitmap(bs, backup->bitmap); if (!bmap) { error_setg(errp, "Bitmap '%s' could not be found", backup->bit= map); return NULL; } + if (!backup->has_bitmap_mode) { + error_setg(errp, "Bitmap sync mode must be given " + "when providing a bitmap"); + return NULL; + } if (bdrv_dirty_bitmap_check(bmap, BDRV_BITMAP_DEFAULT, errp)) { return NULL; } @@ -3485,8 +3504,10 @@ static BlockJob *do_backup_common(BackupCommon *back= up, } =20 job =3D backup_job_create(backup->job_id, bs, target_bs, backup->speed, - backup->sync, bmap, backup->compress, - backup->on_source_error, backup->on_target_err= or, + backup->sync, bmap, backup->bitmap_mode, + backup->compress, + backup->on_source_error, + backup->on_target_error, job_flags, NULL, NULL, txn, errp); return job; } diff --git a/include/block/block_int.h b/include/block/block_int.h index 6207a105ff4..80953ac8aeb 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1147,7 +1147,8 @@ void mirror_start(const char *job_id, BlockDriverStat= e *bs, * @target: Block device to write to. * @speed: The maximum speed, in bytes per second, or 0 for unlimited. * @sync_mode: What parts of the disk image should be copied to the destin= ation. - * @sync_bitmap: The dirty bitmap if sync_mode is MIRROR_SYNC_MODE_INCREME= NTAL. + * @sync_bitmap: The dirty bitmap if sync_mode is 'bitmap' or 'incremental' + * @bitmap_mode: The bitmap synchronization policy to use. * @on_source_error: The action to take upon error reading from the source. * @on_target_error: The action to take upon error writing to the target. * @creation_flags: Flags that control the behavior of the Job lifetime. @@ -1163,6 +1164,7 @@ BlockJob *backup_job_create(const char *job_id, Block= DriverState *bs, BlockDriverState *target, int64_t speed, MirrorSyncMode sync_mode, BdrvDirtyBitmap *sync_bitmap, + BitmapSyncMode bitmap_mode, bool compress, BlockdevOnError on_source_error, BlockdevOnError on_target_error, diff --git a/qapi/block-core.json b/qapi/block-core.json index 06eb3bb3d78..dd926f78285 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1127,12 +1127,15 @@ # # @none: only copy data written from now on # -# @incremental: only copy data described by the dirty bitmap. Since: 2.4 +# @incremental: only copy data described by the dirty bitmap. (since: 2.4) +# +# @bitmap: only copy data described by the dirty bitmap. (since: 4.2) +# Behavior on completion is determined by the BitmapSyncMode. # # Since: 1.3 ## { 'enum': 'MirrorSyncMode', - 'data': ['top', 'full', 'none', 'incremental'] } + 'data': ['top', 'full', 'none', 'incremental', 'bitmap'] } =20 ## # @BitmapSyncMode: @@ -1343,9 +1346,14 @@ # @speed: the maximum speed, in bytes per second. The default is 0, # for unlimited. # -# @bitmap: the name of dirty bitmap if sync is "incremental". -# Must be present if sync is "incremental", must NOT be present -# otherwise. (Since 2.4 (drive-backup), 3.1 (blockdev-backup)) +# @bitmap: the name of a dirty bitmap if sync is "bitmap" or "incremental". +# Must be present if sync is "bitmap" or "incremental". +# Must not be present otherwise. +# (Since 2.4 (drive-backup), 3.1 (blockdev-backup)) +# +# @bitmap-mode: Specifies the type of data the bitmap should contain after +# the operation concludes. Must be present if sync is "bitma= p". +# Must NOT be present otherwise. (Since 4.2) # # @compress: true to compress data, if the target format supports it. # (default: false) (since 2.8) @@ -1380,7 +1388,8 @@ { 'struct': 'BackupCommon', 'data': { '*job-id': 'str', 'device': 'str', 'sync': 'MirrorSyncMode', '*speed': 'int', - '*bitmap': 'str', '*compress': 'bool', + '*bitmap': 'str', '*bitmap-mode': 'BitmapSyncMode', + '*compress': 'bool', '*on-source-error': 'BlockdevOnError', '*on-target-error': 'BlockdevOnError', '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } } --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565997360; cv=none; d=zoho.com; s=zohoarc; b=iQXCmymSd9vH/ZyIO8tpWsmQlWfMW9KG+07gV/uOtxj598MMDDhHU31shGWMSKnE3U9vQGFach+fbI8wXnaKnZV6ZoSya9v4/YMePKOu8Fkv+1h4ZPH8gtTGLQAkNrCDWPn5Vi9I2OSPjY25x13rwU1ApOzV/AeRiywGH0M/Zso= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565997360; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=2wwx05OI2Za9QjmN7+Q3OYVk7xPI385+Fgd+tp9/ckA=; b=CpMcd1cCLeZQVzZi5ygqwq2+HZ5IYtW1q97m2esKYUCnHAlOQviMjNMmR/ZooMMYz1OPpmZQ02mcQF++pspwiMuasAJjAIAndX0pSdLsGcMJT84pV7gd7w34vmJ14ffyP6GQB+/oh36JmBpLB2RqCK8k3fqo+9wSlXaZ06+GeEE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565997360694822.6117570761025; Fri, 16 Aug 2019 16:16:00 -0700 (PDT) Received: from localhost ([::1]:33040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylRu-0000Se-Ur for importer@patchew.org; Fri, 16 Aug 2019 19:15:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46061) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPY-0006Bg-TN for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPX-0005hy-Lh for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40904) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPU-0005ek-VQ; Fri, 16 Aug 2019 19:13:29 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D289F3082A6C; Fri, 16 Aug 2019 23:13:27 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B5CD19C6A; Fri, 16 Aug 2019 23:13:27 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:48 -0400 Message-Id: <20190816231318.8650-7-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 16 Aug 2019 23:13:27 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 06/36] block/backup: add 'never' policy to bitmap sync mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This adds a "never" policy for bitmap synchronization. Regardless of if the job succeeds or fails, we never update the bitmap. This can be used to perform differential backups, or simply to avoid the job modifying a bitmap. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-7-jsnow@redhat.com Signed-off-by: John Snow --- block/backup.c | 7 +++++-- qapi/block-core.json | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/block/backup.c b/block/backup.c index 2b4c5c23e4e..d07b838930f 100644 --- a/block/backup.c +++ b/block/backup.c @@ -274,8 +274,11 @@ static void backup_cleanup_sync_bitmap(BackupBlockJob = *job, int ret) BdrvDirtyBitmap *bm; BlockDriverState *bs =3D blk_bs(job->common.blk); =20 - if (ret < 0) { - /* Merge the successor back into the parent, delete nothing. */ + if (ret < 0 || job->bitmap_mode =3D=3D BITMAP_SYNC_MODE_NEVER) { + /* + * Failure, or we don't want to synchronize the bitmap. + * Merge the successor back into the parent, delete nothing. + */ bm =3D bdrv_reclaim_dirty_bitmap(bs, job->sync_bitmap, NULL); assert(bm); } else { diff --git a/qapi/block-core.json b/qapi/block-core.json index dd926f78285..06e34488a30 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1146,10 +1146,13 @@ # @on-success: The bitmap is only synced when the operation is successful. # This is the behavior always used for 'INCREMENTAL' backups. # +# @never: The bitmap is never synchronized with the operation, and is +# treated solely as a read-only manifest of blocks to copy. +# # Since: 4.2 ## { 'enum': 'BitmapSyncMode', - 'data': ['on-success'] } + 'data': ['on-success', 'never'] } =20 ## # @MirrorCopyMode: --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565997586; cv=none; d=zoho.com; s=zohoarc; b=eIku/SZT080g3GuL/mpAhruU6M2ojhzY2iVgt1Rr7y6Bcl4tAbCDWcAZKAHpf8KqdjuiMVAHKGlNVXjIOZ4GzvRr+GtoaHtgWyyO4Zdu8Wcif9p8SdVKmZ6+oGnlnKJyEPaFbwIjlns5LVdstPeiBHaAHQ8LlMDmXrw7PcUrhWA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565997586; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=wLacePzFM99+G6IZV5xQkSdOh6rdngjSHYTR8UQku60=; b=n7hdd9/4AU6ZslodPPAIJ1uq9DBqiyPm8c22km+qvGphozinIQ1984QLvOtdDRf+cmy6teG15dlQ0onVGFPWLUKEPBAlgipK74n0FRHz1KE3xLLU2xtCQS0u+l6eQrYrSsy0E8s2Lgv4Zz9MOEHAJnZPRgnTw4MF8K4clBEZdMQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565997586677162.28068056290795; Fri, 16 Aug 2019 16:19:46 -0700 (PDT) Received: from localhost ([::1]:33122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylVZ-0004V0-A6 for importer@patchew.org; Fri, 16 Aug 2019 19:19:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46121) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPa-0006E6-AA for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPY-0005jP-Qj for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37234) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPW-0005f7-9A; Fri, 16 Aug 2019 19:13:30 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A7E3510BFB3F; Fri, 16 Aug 2019 23:13:28 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0029719C6A; Fri, 16 Aug 2019 23:13:27 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:49 -0400 Message-Id: <20190816231318.8650-8-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Fri, 16 Aug 2019 23:13:28 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 07/36] hbitmap: Fix merge when b is empty, and result is not an alias of a X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Nobody calls the function like this currently, but we neither prohibit or cope with this behavior. I decided to make the function cope with it. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-8-jsnow@redhat.com Signed-off-by: John Snow --- util/hbitmap.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/util/hbitmap.c b/util/hbitmap.c index bcc0acdc6a0..83927f3c08a 100644 --- a/util/hbitmap.c +++ b/util/hbitmap.c @@ -785,8 +785,9 @@ bool hbitmap_can_merge(const HBitmap *a, const HBitmap = *b) } =20 /** - * Given HBitmaps A and B, let A :=3D A (BITOR) B. - * Bitmap B will not be modified. + * Given HBitmaps A and B, let R :=3D A (BITOR) B. + * Bitmaps A and B will not be modified, + * except when bitmap R is an alias of A or B. * * @return true if the merge was successful, * false if it was not attempted. @@ -801,7 +802,13 @@ bool hbitmap_merge(const HBitmap *a, const HBitmap *b,= HBitmap *result) } assert(hbitmap_can_merge(b, result)); =20 - if (hbitmap_count(b) =3D=3D 0) { + if ((!hbitmap_count(a) && result =3D=3D b) || + (!hbitmap_count(b) && result =3D=3D a)) { + return true; + } + + if (!hbitmap_count(a) && !hbitmap_count(b)) { + hbitmap_reset_all(result); return true; } =20 --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565997375; cv=none; d=zoho.com; s=zohoarc; b=EVfZbGqtnC71qLxM5Yc0UQyW/8obEitOIRwI6kxYZD5IoNRoXi/Up6GnDYSomX9HGx9IDFppJO+Ebaf45pgSQ3/hANhkgUXj47DqOT6kKuPv56NDU0T3bg+23jAwo2My7FZgaD89aYsSdTMFTAnPzhhviM7/wV9BSOWK9Wja4P4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565997375; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=QSsqhdAn2OR/NemPEyokADyuAGZgspA3P0jNYW8C/Xo=; b=BLtpeu2gMW+Kk6Q9R/8ajsGuOubK24hLkE9kbDBVAqAbq2E1otGfNYRSdY/yuXmWuyebYAszKk+Ko3chTa6YrWtaAj5HYyN6uiFnAzg/jaPrbMpKaEoJ+CbdhB22md6MEfHtNykvYyuKpO4d8fqchiwOOX9OSSfjvAOzaEopX7M= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156599737532089.45816696051452; Fri, 16 Aug 2019 16:16:15 -0700 (PDT) Received: from localhost ([::1]:33044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylS6-0000lM-J1 for importer@patchew.org; Fri, 16 Aug 2019 19:16:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46111) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPa-0006Df-24 for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPY-0005jd-RV for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54784) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPW-0005fu-6C; Fri, 16 Aug 2019 19:13:30 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8009D30A5686; Fri, 16 Aug 2019 23:13:29 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9E7719C6A; Fri, 16 Aug 2019 23:13:28 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:50 -0400 Message-Id: <20190816231318.8650-9-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 16 Aug 2019 23:13:29 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 08/36] hbitmap: enable merging across granularities X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-9-jsnow@redhat.com Signed-off-by: John Snow --- util/hbitmap.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/util/hbitmap.c b/util/hbitmap.c index 83927f3c08a..fd44c897ab0 100644 --- a/util/hbitmap.c +++ b/util/hbitmap.c @@ -781,7 +781,27 @@ void hbitmap_truncate(HBitmap *hb, uint64_t size) =20 bool hbitmap_can_merge(const HBitmap *a, const HBitmap *b) { - return (a->size =3D=3D b->size) && (a->granularity =3D=3D b->granulari= ty); + return (a->orig_size =3D=3D b->orig_size); +} + +/** + * hbitmap_sparse_merge: performs dst =3D dst | src + * works with differing granularities. + * best used when src is sparsely populated. + */ +static void hbitmap_sparse_merge(HBitmap *dst, const HBitmap *src) +{ + uint64_t offset =3D 0; + uint64_t count =3D src->orig_size; + + while (hbitmap_next_dirty_area(src, &offset, &count)) { + hbitmap_set(dst, offset, count); + offset +=3D count; + if (offset >=3D src->orig_size) { + break; + } + count =3D src->orig_size - offset; + } } =20 /** @@ -812,10 +832,24 @@ bool hbitmap_merge(const HBitmap *a, const HBitmap *b= , HBitmap *result) return true; } =20 + if (a->granularity !=3D b->granularity) { + if ((a !=3D result) && (b !=3D result)) { + hbitmap_reset_all(result); + } + if (a !=3D result) { + hbitmap_sparse_merge(result, a); + } + if (b !=3D result) { + hbitmap_sparse_merge(result, b); + } + return true; + } + /* This merge is O(size), as BITS_PER_LONG and HBITMAP_LEVELS are cons= tant. * It may be possible to improve running times for sparsely populated = maps * by using hbitmap_iter_next, but this is suboptimal for dense maps. */ + assert(a->size =3D=3D b->size); for (i =3D HBITMAP_LEVELS - 1; i >=3D 0; i--) { for (j =3D 0; j < a->sizes[i]; j++) { result->levels[i][j] =3D a->levels[i][j] | b->levels[i][j]; --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565997644; cv=none; d=zoho.com; s=zohoarc; b=EePbCDU8SQToCtqeFFshiIXtEbXUDxO3kj3tMLxWbW0Dy716Ph8nop7sEoqmI2x+Ht71UeEAJrEhSxJdzRDRt6vjg5dD2lIZ27L/Cb6rNr1KMz+pFB4ZVPrm/aCrk2+Vq+kOFnYJvI+W/h8mlo7D8btRS1fyJLgKX/E729jStFI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565997644; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=19Df0IRpptohRw5w8NxZ+vepVNT36dlUpUqsuQk0WQc=; b=R8kkTw84YkPOZQge9vQ2j/WzbtOIjpJ4vkLOKpEOAykOMS4yl3aXvRT8BSkXiCvnDcEE3eCn0DF/As3NdUx5DjpDNdeGQYPUkHuHWci7lifB5GVC2YFD44i4R0vBOg3rvFxBr/OIu7lOwXYovLoWOkY5/eAQBwf2KWOwBr+WEvI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565997644098928.7683915331601; Fri, 16 Aug 2019 16:20:44 -0700 (PDT) Received: from localhost ([::1]:33126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylWU-0005mi-MN for importer@patchew.org; Fri, 16 Aug 2019 19:20:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46212) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPc-0006HZ-DW for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPa-0005lq-E8 for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36006) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPX-0005gY-3a; Fri, 16 Aug 2019 19:13:31 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 551A53DFCD; Fri, 16 Aug 2019 23:13:30 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id A173919C6A; Fri, 16 Aug 2019 23:13:29 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:51 -0400 Message-Id: <20190816231318.8650-10-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 16 Aug 2019 23:13:30 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 09/36] block/dirty-bitmap: add bdrv_dirty_bitmap_merge_internal X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" I'm surprised it didn't come up sooner, but sometimes we have a +busy bitmap as a source. This is dangerous from the QMP API, but if we are the owner that marked the bitmap busy, it's safe to merge it using it as a read only source. It is not safe in the general case to allow users to read from in-use bitmaps, so create an internal variant that foregoes the safety checking. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-10-jsnow@redhat.com Signed-off-by: John Snow --- block/dirty-bitmap.c | 54 +++++++++++++++++++++++++++++++++++---- include/block/block_int.h | 3 +++ 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 95a9c2a5d8a..7881fea684b 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -810,6 +810,12 @@ bool bdrv_dirty_bitmap_next_dirty_area(BdrvDirtyBitmap= *bitmap, return hbitmap_next_dirty_area(bitmap->bitmap, offset, bytes); } =20 +/** + * bdrv_merge_dirty_bitmap: merge src into dest. + * Ensures permissions on bitmaps are reasonable; use for public API. + * + * @backup: If provided, make a copy of dest here prior to merge. + */ void bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, const BdrvDirtyBitmap = *src, HBitmap **backup, Error **errp) { @@ -833,6 +839,42 @@ void bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, co= nst BdrvDirtyBitmap *src, goto out; } =20 + ret =3D bdrv_dirty_bitmap_merge_internal(dest, src, backup, false); + assert(ret); + +out: + qemu_mutex_unlock(dest->mutex); + if (src->mutex !=3D dest->mutex) { + qemu_mutex_unlock(src->mutex); + } +} + +/** + * bdrv_dirty_bitmap_merge_internal: merge src into dest. + * Does NOT check bitmap permissions; not suitable for use as public API. + * + * @backup: If provided, make a copy of dest here prior to merge. + * @lock: If true, lock and unlock bitmaps on the way in/out. + * returns true if the merge succeeded; false if unattempted. + */ +bool bdrv_dirty_bitmap_merge_internal(BdrvDirtyBitmap *dest, + const BdrvDirtyBitmap *src, + HBitmap **backup, + bool lock) +{ + bool ret; + + assert(!bdrv_dirty_bitmap_readonly(dest)); + assert(!bdrv_dirty_bitmap_inconsistent(dest)); + assert(!bdrv_dirty_bitmap_inconsistent(src)); + + if (lock) { + qemu_mutex_lock(dest->mutex); + if (src->mutex !=3D dest->mutex) { + qemu_mutex_lock(src->mutex); + } + } + if (backup) { *backup =3D dest->bitmap; dest->bitmap =3D hbitmap_alloc(dest->size, hbitmap_granularity(*ba= ckup)); @@ -840,11 +882,13 @@ void bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, c= onst BdrvDirtyBitmap *src, } else { ret =3D hbitmap_merge(dest->bitmap, src->bitmap, dest->bitmap); } - assert(ret); =20 -out: - qemu_mutex_unlock(dest->mutex); - if (src->mutex !=3D dest->mutex) { - qemu_mutex_unlock(src->mutex); + if (lock) { + qemu_mutex_unlock(dest->mutex); + if (src->mutex !=3D dest->mutex) { + qemu_mutex_unlock(src->mutex); + } } + + return ret; } diff --git a/include/block/block_int.h b/include/block/block_int.h index 80953ac8aeb..aa697f1f694 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1253,6 +1253,9 @@ void bdrv_set_dirty(BlockDriverState *bs, int64_t off= set, int64_t bytes); =20 void bdrv_clear_dirty_bitmap(BdrvDirtyBitmap *bitmap, HBitmap **out); void bdrv_restore_dirty_bitmap(BdrvDirtyBitmap *bitmap, HBitmap *backup); +bool bdrv_dirty_bitmap_merge_internal(BdrvDirtyBitmap *dest, + const BdrvDirtyBitmap *src, + HBitmap **backup, bool lock); =20 void bdrv_inc_in_flight(BlockDriverState *bs); void bdrv_dec_in_flight(BlockDriverState *bs); --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565997880; cv=none; d=zoho.com; s=zohoarc; b=KnYyl9v7s0pNCmzDHHqUYjdWLkvssEWgAE2yF1SJsqQ0KnRj4VSTRdMgQCF5TAxh/jBnRQ9rDPvAjySSBjWv2cnVPX6iHMRgmgRheL2Ugm7BXDmDCMfNDxtCejRLFyE2+ItZcS34bF8l0to5VMO21fQa3m3UCSAt62y24WGRTus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565997880; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=htIvX1oha+4rfVZCBrKmQVIoim1WkgVeI7o2VZOiui8=; b=LrX5ZiJ5KvvNGdLGWC0PSggqh6dcYlTAP6IflSo7bb7c0cHKRt/L5inqJBImtePIf3XiQH7yrbivAipKHJOtiSRwMGEiJnlXiTsrJymyk11FYODHM8D97NMpVtVg/R+9kg1j+1VvOjAXyrAUmYLhlgCDch44UL8Fc2+V1y/X7ZE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565997880031216.13354571151444; Fri, 16 Aug 2019 16:24:40 -0700 (PDT) Received: from localhost ([::1]:33204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylaI-0003oD-Et for importer@patchew.org; Fri, 16 Aug 2019 19:24:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46302) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPe-0006Ky-7h for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPb-0005nI-En for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13630) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPX-0005hX-Ud; Fri, 16 Aug 2019 19:13:32 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2E9F9859FB; Fri, 16 Aug 2019 23:13:31 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78A03165D8; Fri, 16 Aug 2019 23:13:30 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:52 -0400 Message-Id: <20190816231318.8650-11-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 16 Aug 2019 23:13:31 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 10/36] block/dirty-bitmap: add bdrv_dirty_bitmap_get X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Add a public interface for get. While we're at it, rename "bdrv_get_dirty_bitmap_locked" to "bdrv_dirty_bitmap_get_locked". (There are more functions to rename to the bdrv_dirty_bitmap_VERB form, but they will wait until the conclusion of this series.) Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-11-jsnow@redhat.com Signed-off-by: John Snow --- block/dirty-bitmap.c | 19 ++++++++++++------- block/mirror.c | 2 +- include/block/dirty-bitmap.h | 4 ++-- migration/block.c | 5 ++--- nbd/server.c | 2 +- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 7881fea684b..75a5daf116f 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -509,14 +509,19 @@ BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDri= verState *bs) } =20 /* Called within bdrv_dirty_bitmap_lock..unlock */ -bool bdrv_get_dirty_locked(BlockDriverState *bs, BdrvDirtyBitmap *bitmap, - int64_t offset) +bool bdrv_dirty_bitmap_get_locked(BdrvDirtyBitmap *bitmap, int64_t offset) { - if (bitmap) { - return hbitmap_get(bitmap->bitmap, offset); - } else { - return false; - } + return hbitmap_get(bitmap->bitmap, offset); +} + +bool bdrv_dirty_bitmap_get(BdrvDirtyBitmap *bitmap, int64_t offset) +{ + bool ret; + bdrv_dirty_bitmap_lock(bitmap); + ret =3D bdrv_dirty_bitmap_get_locked(bitmap, offset); + bdrv_dirty_bitmap_unlock(bitmap); + + return ret; } =20 /** diff --git a/block/mirror.c b/block/mirror.c index 70f24d9ef63..2b870683f14 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -476,7 +476,7 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlo= ckJob *s) int64_t next_offset =3D offset + nb_chunks * s->granularity; int64_t next_chunk =3D next_offset / s->granularity; if (next_offset >=3D s->bdev_length || - !bdrv_get_dirty_locked(source, s->dirty_bitmap, next_offset)) { + !bdrv_dirty_bitmap_get_locked(s->dirty_bitmap, next_offset)) { break; } if (test_bit(next_chunk, s->in_flight_bitmap)) { diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h index 62682eb865f..0120ef3f05a 100644 --- a/include/block/dirty-bitmap.h +++ b/include/block/dirty-bitmap.h @@ -84,12 +84,12 @@ void bdrv_dirty_bitmap_set_busy(BdrvDirtyBitmap *bitmap= , bool busy); void bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, const BdrvDirtyBitmap = *src, HBitmap **backup, Error **errp); void bdrv_dirty_bitmap_set_migration(BdrvDirtyBitmap *bitmap, bool migrati= on); +bool bdrv_dirty_bitmap_get(BdrvDirtyBitmap *bitmap, int64_t offset); =20 /* Functions that require manual locking. */ void bdrv_dirty_bitmap_lock(BdrvDirtyBitmap *bitmap); void bdrv_dirty_bitmap_unlock(BdrvDirtyBitmap *bitmap); -bool bdrv_get_dirty_locked(BlockDriverState *bs, BdrvDirtyBitmap *bitmap, - int64_t offset); +bool bdrv_dirty_bitmap_get_locked(BdrvDirtyBitmap *bitmap, int64_t offset); void bdrv_set_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap, int64_t offset, int64_t bytes); void bdrv_reset_dirty_bitmap_locked(BdrvDirtyBitmap *bitmap, diff --git a/migration/block.c b/migration/block.c index e81fd7e14fa..aa747b55fa8 100644 --- a/migration/block.c +++ b/migration/block.c @@ -521,7 +521,6 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDev= State *bmds, int is_async) { BlkMigBlock *blk; - BlockDriverState *bs =3D blk_bs(bmds->blk); int64_t total_sectors =3D bmds->total_sectors; int64_t sector; int nr_sectors; @@ -536,8 +535,8 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDev= State *bmds, blk_mig_unlock(); } bdrv_dirty_bitmap_lock(bmds->dirty_bitmap); - if (bdrv_get_dirty_locked(bs, bmds->dirty_bitmap, - sector * BDRV_SECTOR_SIZE)) { + if (bdrv_dirty_bitmap_get_locked(bmds->dirty_bitmap, + sector * BDRV_SECTOR_SIZE)) { if (total_sectors - sector < BDRV_SECTORS_PER_DIRTY_CHUNK) { nr_sectors =3D total_sectors - sector; } else { diff --git a/nbd/server.c b/nbd/server.c index 3eacb898757..f55ccf8edfd 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -2004,7 +2004,7 @@ static unsigned int bitmap_to_extents(BdrvDirtyBitmap= *bitmap, uint64_t offset, bdrv_dirty_bitmap_lock(bitmap); =20 it =3D bdrv_dirty_iter_new(bitmap); - dirty =3D bdrv_get_dirty_locked(NULL, bitmap, offset); + dirty =3D bdrv_dirty_bitmap_get_locked(bitmap, offset); =20 assert(begin < overall_end && nb_extents); while (begin < overall_end && i < nb_extents) { --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565997953; cv=none; d=zoho.com; s=zohoarc; b=kSHcDhFNshDSCwLQh+EjAlVN2JeGrJ5LzWXJJz58kVSfDRP9KPa9cccMs6LH+1S8lwGi4yv80litETlGMy9+ZnSml5y/l9fQ5kgiJRhWkBYlzqrKKzLijbkhwai7T7HnBuWFIIZ39JweR7N1ogYn1G2XVmrXfRr3UtxGRAl1vXg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565997953; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=JsenZtyzhzTfKsq4BIZ/Ha8EL38KXbqf50IgDl8Imlg=; b=c7arCVNv/YvXkW8CH0j9B/akToYjUI1CLtgzes1OtWndE/SuoBp0+ohVRlL/y3wib+BLUQdl5Qox2rVyw0eY+eEf/u/Zkl6pJfRZQNahQ7f568387QON6YHOYf88l+sjxSzFccsWNUja3kmkvnU6SpVaxAClanIH9p35vDWI/p8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565997953346732.4151059319273; Fri, 16 Aug 2019 16:25:53 -0700 (PDT) Received: from localhost ([::1]:33220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylbT-0005ZR-V8 for importer@patchew.org; Fri, 16 Aug 2019 19:25:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46405) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPh-0006R4-Qr for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPe-0005sQ-DJ for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47772) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPY-0005iV-QL; Fri, 16 Aug 2019 19:13:33 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 03B16308FE8D; Fri, 16 Aug 2019 23:13:32 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FAEB10512; Fri, 16 Aug 2019 23:13:31 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:53 -0400 Message-Id: <20190816231318.8650-12-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 16 Aug 2019 23:13:32 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 11/36] block/backup: upgrade copy_bitmap to BdrvDirtyBitmap X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This simplifies some interface matters; namely the initialization and (later) merging the manifest back into the sync_bitmap if it was provided. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-12-jsnow@redhat.com Signed-off-by: John Snow --- block/backup.c | 84 ++++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 40 deletions(-) diff --git a/block/backup.c b/block/backup.c index d07b838930f..474f8eeae29 100644 --- a/block/backup.c +++ b/block/backup.c @@ -38,7 +38,10 @@ typedef struct CowRequest { typedef struct BackupBlockJob { BlockJob common; BlockBackend *target; + BdrvDirtyBitmap *sync_bitmap; + BdrvDirtyBitmap *copy_bitmap; + MirrorSyncMode sync_mode; BitmapSyncMode bitmap_mode; BlockdevOnError on_source_error; @@ -51,7 +54,6 @@ typedef struct BackupBlockJob { NotifierWithReturn before_write; QLIST_HEAD(, CowRequest) inflight_reqs; =20 - HBitmap *copy_bitmap; bool use_copy_range; int64_t copy_range_size; =20 @@ -113,7 +115,7 @@ static int coroutine_fn backup_cow_with_bounce_buffer(B= ackupBlockJob *job, int write_flags =3D job->serialize_target_writes ? BDRV_REQ_SERIALISIN= G : 0; =20 assert(QEMU_IS_ALIGNED(start, job->cluster_size)); - hbitmap_reset(job->copy_bitmap, start, job->cluster_size); + bdrv_reset_dirty_bitmap(job->copy_bitmap, start, job->cluster_size); nbytes =3D MIN(job->cluster_size, job->len - start); if (!*bounce_buffer) { *bounce_buffer =3D blk_blockalign(blk, job->cluster_size); @@ -146,7 +148,7 @@ static int coroutine_fn backup_cow_with_bounce_buffer(B= ackupBlockJob *job, =20 return nbytes; fail: - hbitmap_set(job->copy_bitmap, start, job->cluster_size); + bdrv_set_dirty_bitmap(job->copy_bitmap, start, job->cluster_size); return ret; =20 } @@ -169,12 +171,14 @@ static int coroutine_fn backup_cow_with_offload(Backu= pBlockJob *job, assert(QEMU_IS_ALIGNED(start, job->cluster_size)); nbytes =3D MIN(job->copy_range_size, end - start); nr_clusters =3D DIV_ROUND_UP(nbytes, job->cluster_size); - hbitmap_reset(job->copy_bitmap, start, job->cluster_size * nr_clusters= ); + bdrv_reset_dirty_bitmap(job->copy_bitmap, start, + job->cluster_size * nr_clusters); ret =3D blk_co_copy_range(blk, start, job->target, start, nbytes, read_flags, write_flags); if (ret < 0) { trace_backup_do_cow_copy_range_fail(job, start, ret); - hbitmap_set(job->copy_bitmap, start, job->cluster_size * nr_cluste= rs); + bdrv_set_dirty_bitmap(job->copy_bitmap, start, + job->cluster_size * nr_clusters); return ret; } =20 @@ -204,13 +208,14 @@ static int coroutine_fn backup_do_cow(BackupBlockJob = *job, while (start < end) { int64_t dirty_end; =20 - if (!hbitmap_get(job->copy_bitmap, start)) { + if (!bdrv_dirty_bitmap_get(job->copy_bitmap, start)) { trace_backup_do_cow_skip(job, start); start +=3D job->cluster_size; continue; /* already copied */ } =20 - dirty_end =3D hbitmap_next_zero(job->copy_bitmap, start, (end - st= art)); + dirty_end =3D bdrv_dirty_bitmap_next_zero(job->copy_bitmap, start, + (end - start)); if (dirty_end < 0) { dirty_end =3D end; } @@ -307,14 +312,16 @@ static void backup_abort(Job *job) static void backup_clean(Job *job) { BackupBlockJob *s =3D container_of(job, BackupBlockJob, common.job); + BlockDriverState *bs =3D blk_bs(s->common.blk); + + if (s->copy_bitmap) { + bdrv_release_dirty_bitmap(bs, s->copy_bitmap); + s->copy_bitmap =3D NULL; + } + assert(s->target); blk_unref(s->target); s->target =3D NULL; - - if (s->copy_bitmap) { - hbitmap_free(s->copy_bitmap); - s->copy_bitmap =3D NULL; - } } =20 void backup_do_checkpoint(BlockJob *job, Error **errp) @@ -329,7 +336,7 @@ void backup_do_checkpoint(BlockJob *job, Error **errp) return; } =20 - hbitmap_set(backup_job->copy_bitmap, 0, backup_job->len); + bdrv_set_dirty_bitmap(backup_job->copy_bitmap, 0, backup_job->len); } =20 static void backup_drain(BlockJob *job) @@ -398,59 +405,52 @@ static bool bdrv_is_unallocated_range(BlockDriverStat= e *bs, =20 static int coroutine_fn backup_loop(BackupBlockJob *job) { - int ret; bool error_is_read; int64_t offset; - HBitmapIter hbi; + BdrvDirtyBitmapIter *bdbi; BlockDriverState *bs =3D blk_bs(job->common.blk); + int ret =3D 0; =20 - hbitmap_iter_init(&hbi, job->copy_bitmap, 0); - while ((offset =3D hbitmap_iter_next(&hbi)) !=3D -1) { + bdbi =3D bdrv_dirty_iter_new(job->copy_bitmap); + while ((offset =3D bdrv_dirty_iter_next(bdbi)) !=3D -1) { if (job->sync_mode =3D=3D MIRROR_SYNC_MODE_TOP && bdrv_is_unallocated_range(bs, offset, job->cluster_size)) { - hbitmap_reset(job->copy_bitmap, offset, job->cluster_size); + bdrv_reset_dirty_bitmap(job->copy_bitmap, offset, + job->cluster_size); continue; } =20 do { if (yield_and_check(job)) { - return 0; + goto out; } ret =3D backup_do_cow(job, offset, job->cluster_size, &error_is_read, false); if (ret < 0 && backup_error_action(job, error_is_read, -ret) = =3D=3D BLOCK_ERROR_ACTION_REPORT) { - return ret; + goto out; } } while (ret < 0); } =20 - return 0; + out: + bdrv_dirty_iter_free(bdbi); + return ret; } =20 /* init copy_bitmap from sync_bitmap */ static void backup_incremental_init_copy_bitmap(BackupBlockJob *job) { - uint64_t offset =3D 0; - uint64_t bytes =3D job->len; - - while (bdrv_dirty_bitmap_next_dirty_area(job->sync_bitmap, - &offset, &bytes)) - { - hbitmap_set(job->copy_bitmap, offset, bytes); - - offset +=3D bytes; - if (offset >=3D job->len) { - break; - } - bytes =3D job->len - offset; - } + bool ret =3D bdrv_dirty_bitmap_merge_internal(job->copy_bitmap, + job->sync_bitmap, + NULL, true); + assert(ret); =20 /* TODO job_progress_set_remaining() would make more sense */ job_progress_update(&job->common.job, - job->len - hbitmap_count(job->copy_bitmap)); + job->len - bdrv_get_dirty_count(job->copy_bitmap)); } =20 static int coroutine_fn backup_run(Job *job, Error **errp) @@ -467,7 +467,7 @@ static int coroutine_fn backup_run(Job *job, Error **er= rp) if (s->sync_mode =3D=3D MIRROR_SYNC_MODE_BITMAP) { backup_incremental_init_copy_bitmap(s); } else { - hbitmap_set(s->copy_bitmap, 0, s->len); + bdrv_set_dirty_bitmap(s->copy_bitmap, 0, s->len); } =20 s->before_write.notify =3D backup_before_write_notify; @@ -560,7 +560,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDr= iverState *bs, BackupBlockJob *job =3D NULL; int ret; int64_t cluster_size; - HBitmap *copy_bitmap =3D NULL; + BdrvDirtyBitmap *copy_bitmap =3D NULL; =20 assert(bs); assert(target); @@ -630,7 +630,11 @@ BlockJob *backup_job_create(const char *job_id, BlockD= riverState *bs, goto error; } =20 - copy_bitmap =3D hbitmap_alloc(len, ctz32(cluster_size)); + copy_bitmap =3D bdrv_create_dirty_bitmap(bs, cluster_size, NULL, errp); + if (!copy_bitmap) { + goto error; + } + bdrv_disable_dirty_bitmap(copy_bitmap); =20 /* job->len is fixed, so we can't allow resize */ job =3D block_job_create(job_id, &backup_job_driver, txn, bs, @@ -682,7 +686,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDr= iverState *bs, error: if (copy_bitmap) { assert(!job || !job->copy_bitmap); - hbitmap_free(copy_bitmap); + bdrv_release_dirty_bitmap(bs, copy_bitmap); } if (sync_bitmap) { bdrv_reclaim_dirty_bitmap(bs, sync_bitmap, NULL); --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565997766; cv=none; d=zoho.com; s=zohoarc; b=ecwqhjDrI+PlbIidA/HdxnaLVGbG5coJRq34krpPEt7yrcFossThYH4OkmZLpj8bMqsJhhONysBi1Sk/s/w7n0Lei1AuMWG+HUjLBNj67VSPfmIJaBtsIfX6BEYK9QeL2NzsR5hTvP9ClFYuCeMDbacDVuouK62NETVlq3b5aAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565997766; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=vbGxroM8CLiUAQqNoccjrL9UKl4/3y2/7jCGzJoO6QY=; b=c+4fPyGsV2kNIc3fKynDQ75sRvAcFgA0789asFXnCCHhvT2yscfY8tfZtTP7HzJukfOb970Qr2upDRJ3RqrGMrvUACbEbxtWYF9B7eNRHKX4q0AVD1xwuKyb+76J0lnHuHrx51K1wvZlEsGXP6wX4BKJY2wUhvn9xafOdPikJng= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565997766700520.1026569036728; Fri, 16 Aug 2019 16:22:46 -0700 (PDT) Received: from localhost ([::1]:33176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylYR-0000PL-4a for importer@patchew.org; Fri, 16 Aug 2019 19:22:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46344) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPf-0006NU-Py for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPd-0005rK-Gh for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55612) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPZ-0005k5-J2; Fri, 16 Aug 2019 19:13:33 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D327830860C5; Fri, 16 Aug 2019 23:13:32 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2611B19C6A; Fri, 16 Aug 2019 23:13:32 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:54 -0400 Message-Id: <20190816231318.8650-13-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 16 Aug 2019 23:13:32 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 12/36] block/backup: add 'always' bitmap sync policy X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This adds an "always" policy for bitmap synchronization. Regardless of if the job succeeds or fails, the bitmap is *always* synchronized. This means that for backups that fail part-way through, the bitmap retains a record of which sectors need to be copied out to accomplish a new backup using the old, partial result. In effect, this allows us to "resume" a failed backup; however the new back= up will be from the new point in time, so it isn't a "resume" as much as it is an "incremental retry." This can be useful in the case of extremely large backups that fail considerably through the operation and we'd like to not w= aste the work that was already performed. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-13-jsnow@redhat.com Signed-off-by: John Snow --- block/backup.c | 27 +++++++++++++++++++-------- qapi/block-core.json | 5 ++++- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/block/backup.c b/block/backup.c index 474f8eeae29..2be570c0bfd 100644 --- a/block/backup.c +++ b/block/backup.c @@ -278,18 +278,29 @@ static void backup_cleanup_sync_bitmap(BackupBlockJob= *job, int ret) { BdrvDirtyBitmap *bm; BlockDriverState *bs =3D blk_bs(job->common.blk); + bool sync =3D (((ret =3D=3D 0) || (job->bitmap_mode =3D=3D BITMAP_SYNC= _MODE_ALWAYS)) \ + && (job->bitmap_mode !=3D BITMAP_SYNC_MODE_NEVER)); =20 - if (ret < 0 || job->bitmap_mode =3D=3D BITMAP_SYNC_MODE_NEVER) { + if (sync) { /* - * Failure, or we don't want to synchronize the bitmap. - * Merge the successor back into the parent, delete nothing. + * We succeeded, or we always intended to sync the bitmap. + * Delete this bitmap and install the child. */ - bm =3D bdrv_reclaim_dirty_bitmap(bs, job->sync_bitmap, NULL); - assert(bm); - } else { - /* Everything is fine, delete this bitmap and install the backup. = */ bm =3D bdrv_dirty_bitmap_abdicate(bs, job->sync_bitmap, NULL); - assert(bm); + } else { + /* + * We failed, or we never intended to sync the bitmap anyway. + * Merge the successor back into the parent, keeping all data. + */ + bm =3D bdrv_reclaim_dirty_bitmap(bs, job->sync_bitmap, NULL); + } + + assert(bm); + + if (ret < 0 && job->bitmap_mode =3D=3D BITMAP_SYNC_MODE_ALWAYS) { + /* If we failed and synced, merge in the bits we didn't copy: */ + bdrv_dirty_bitmap_merge_internal(bm, job->copy_bitmap, + NULL, true); } } =20 diff --git a/qapi/block-core.json b/qapi/block-core.json index 06e34488a30..8344fbe2030 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1149,10 +1149,13 @@ # @never: The bitmap is never synchronized with the operation, and is # treated solely as a read-only manifest of blocks to copy. # +# @always: The bitmap is always synchronized with the operation, +# regardless of whether or not the operation was successful. +# # Since: 4.2 ## { 'enum': 'BitmapSyncMode', - 'data': ['on-success', 'never'] } + 'data': ['on-success', 'never', 'always'] } =20 ## # @MirrorCopyMode: --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998113; cv=none; d=zoho.com; s=zohoarc; b=JO+RRulk/pWFc4Gc8IRpgk1H71GyqDUthKM4lZMllXiK3ud7J89Si8HU4gjwmwBPZvk861haPaCCWA4BlRWk7ywDa6Lic0lrMHatE2Ry1ihcEGTNt4Xcn7F6xDlLBwNZNejnO/V2mDUA05S2DOX4zLMsv76kXBapD/yZfkGVJKo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998113; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=GGel13w5QisFfVNpaRecq/sC0hQAqm+PCjZ8DT4mgB0=; b=T5ub+esi9VOR1qG1po871F91F9mO3nQ/dC5thfmsekFcYtPEPvvWR2BuaCWYmivz+AMcLs8dZ/pr2ZHP1ON9BnBzZZypcH5wo1+9syJnOSUBrBcrnozMq+nCAsw1Kal2gZiNtkO+R+aXKQIwTXbnR94oUc2kIjjnownjXesNY2Y= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565998113926200.96044358605297; Fri, 16 Aug 2019 16:28:33 -0700 (PDT) Received: from localhost ([::1]:33252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyle4-000101-6P for importer@patchew.org; Fri, 16 Aug 2019 19:28:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46457) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPj-0006T4-13 for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPg-0005ug-UA for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53694) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPb-0005mF-H3; Fri, 16 Aug 2019 19:13:35 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A4AC5800DE1; Fri, 16 Aug 2019 23:13:33 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1FB019C6A; Fri, 16 Aug 2019 23:13:32 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:55 -0400 Message-Id: <20190816231318.8650-14-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.67]); Fri, 16 Aug 2019 23:13:33 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 13/36] iotests: add testing shim for script-style python tests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Because the new-style python tests don't use the iotests.main() test launcher, we don't turn on the debugger logging for these scripts when invoked via ./check -d. Refactor the launcher shim into new and old style shims so that they share environmental configuration. Two cleanup notes: debug was not actually used as a global, and there was no reason to create a class in an inner scope just to achieve default variables; we can simply create an instance of the runner with the values we want instead. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-14-jsnow@redhat.com Signed-off-by: John Snow --- tests/qemu-iotests/iotests.py | 40 +++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 91172c39a52..7fc062cdcf4 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -61,7 +61,6 @@ cachemode =3D os.environ.get('CACHEMODE') qemu_default_machine =3D os.environ.get('QEMU_DEFAULT_MACHINE') =20 socket_scm_helper =3D os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_help= er') -debug =3D False =20 luks_default_secret_object =3D 'secret,id=3Dkeysec0,data=3D' + \ os.environ.get('IMGKEYSECRET', '') @@ -858,11 +857,22 @@ def skip_if_unsupported(required_formats=3D[], read_o= nly=3DFalse): return func_wrapper return skip_test_decorator =20 -def main(supported_fmts=3D[], supported_oses=3D['linux'], supported_cache_= modes=3D[], - unsupported_fmts=3D[]): - '''Run tests''' +def execute_unittest(output, verbosity, debug): + runner =3D unittest.TextTestRunner(stream=3Doutput, descriptions=3DTru= e, + verbosity=3Dverbosity) + try: + # unittest.main() will use sys.exit(); so expect a SystemExit + # exception + unittest.main(testRunner=3Drunner) + finally: + if not debug: + sys.stderr.write(re.sub(r'Ran (\d+) tests? in [\d.]+s', + r'Ran \1 tests', output.getvalue())) =20 - global debug +def execute_test(test_function=3DNone, + supported_fmts=3D[], supported_oses=3D['linux'], + supported_cache_modes=3D[], unsupported_fmts=3D[]): + """Run either unittest or script-style tests.""" =20 # We are using TEST_DIR and QEMU_DEFAULT_MACHINE as proxies to # indicate that we're not being run via "check". There may be @@ -894,13 +904,15 @@ def main(supported_fmts=3D[], supported_oses=3D['linu= x'], supported_cache_modes=3D[], =20 logging.basicConfig(level=3D(logging.DEBUG if debug else logging.WARN)) =20 - class MyTestRunner(unittest.TextTestRunner): - def __init__(self, stream=3Doutput, descriptions=3DTrue, verbosity= =3Dverbosity): - unittest.TextTestRunner.__init__(self, stream, descriptions, v= erbosity) + if not test_function: + execute_unittest(output, verbosity, debug) + else: + test_function() =20 - # unittest.main() will use sys.exit() so expect a SystemExit exception - try: - unittest.main(testRunner=3DMyTestRunner) - finally: - if not debug: - sys.stderr.write(re.sub(r'Ran (\d+) tests? in [\d.]+s', r'Ran = \1 tests', output.getvalue())) +def script_main(test_function, *args, **kwargs): + """Run script-style tests outside of the unittest framework""" + execute_test(test_function, *args, **kwargs) + +def main(*args, **kwargs): + """Run tests using the unittest framework""" + execute_test(None, *args, **kwargs) --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565997811; cv=none; d=zoho.com; s=zohoarc; b=Wpf7dAK9FLS3GNol4wGm27ZCjsU+/pNONjHg4GG8rk9hwaHxlwQxQ27e3N/ysy6Y280DGIIuunXmrV28RzZRgr7HxO8TDlKV6ZYxUDcPUyJ1WJqVSevIqJvHiTg+DQD8mpRRPc6Db99VdCf9ZXLSXeX0bZs4lORAgjgSnGbUf2Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565997811; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=hkjmeftRK3zEM6+l+xG8st/xz8hBwOJqeem/ufWK3lI=; b=XurwLkwSG44/JqIkSRXj4jNX51kFrkiBApa9+R/lAPG343bsdLpVYNLbsPqRdIxUK04XEmFtau5lmb7Uf/9xKF+xsG8ArEV2zANC8UPwyEf1vGa761JAfurwOWVquIr1kVJMeWX4pBKqCgBIkkQVcuTjYPf70l3xfzWwINj7Yew= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565997811748280.6941735998132; Fri, 16 Aug 2019 16:23:31 -0700 (PDT) Received: from localhost ([::1]:33188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylZC-0001kG-8y for importer@patchew.org; Fri, 16 Aug 2019 19:23:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46413) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPh-0006RZ-Sg for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPf-0005tb-Kg for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53698) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPb-0005m7-Dw; Fri, 16 Aug 2019 19:13:35 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7AF7F800DE3; Fri, 16 Aug 2019 23:13:34 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id C747E19C6A; Fri, 16 Aug 2019 23:13:33 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:56 -0400 Message-Id: <20190816231318.8650-15-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.67]); Fri, 16 Aug 2019 23:13:34 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 14/36] iotests: teach run_job to cancel pending jobs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" run_job can cancel pending jobs to simulate failure. This lets us use the pending callback to issue test commands while the job is open, but then still have the job fail in the end. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-15-jsnow@redhat.com [Maintainer edit: Merge conflict resolution in run_job] Signed-off-by: John Snow --- tests/qemu-iotests/iotests.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 7fc062cdcf4..81ae7b911ac 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -541,7 +541,23 @@ class VM(qtest.QEMUQtestMachine): =20 # Returns None on success, and an error string on failure def run_job(self, job, auto_finalize=3DTrue, auto_dismiss=3DFalse, - pre_finalize=3DNone, use_log=3DTrue, wait=3D60.0): + pre_finalize=3DNone, cancel=3DFalse, use_log=3DTrue, wait= =3D60.0): + """ + run_job moves a job from creation through to dismissal. + + :param job: String. ID of recently-launched job + :param auto_finalize: Bool. True if the job was launched with + auto_finalize. Defaults to True. + :param auto_dismiss: Bool. True if the job was launched with + auto_dismiss=3DTrue. Defaults to False. + :param pre_finalize: Callback. A callable that takes no arguments = to be + invoked prior to issuing job-finalize, if any. + :param cancel: Bool. When true, cancels the job after the pre_fina= lize + callback. + :param use_log: Bool. When false, does not log QMP messages. + :param wait: Float. Timeout value specifying how long to wait for = any + event, in seconds. Defaults to 60.0. + """ match_device =3D {'data': {'device': job}} match_id =3D {'data': {'id': job}} events =3D [ @@ -570,7 +586,11 @@ class VM(qtest.QEMUQtestMachine): elif status =3D=3D 'pending' and not auto_finalize: if pre_finalize: pre_finalize() - if use_log: + if cancel and use_log: + self.qmp_log('job-cancel', id=3Djob) + elif cancel: + self.qmp('job-cancel', id=3Djob) + elif use_log: self.qmp_log('job-finalize', id=3Djob) else: self.qmp('job-finalize', id=3Djob) --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998040; cv=none; d=zoho.com; s=zohoarc; b=kmbsNmOtL/n8C4GEWqQEOAgXOj/zKlcfQZZPj6I43yIAb7WrOLpNiGnKCYrkqtHTecCy1s1HJzXhnXGV2de6wiy5z6mZISzV8fW0hQuDQSUD6+YPSPnDur8bjdBFY8f3ZiZyZIdc3tePgGUIvyVnNXqZTULTByVJEW+AwZeBlNY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998040; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=2bGrvGNDmkvEjmxptl2WGDob1dHL9/fyK/KF2q/YwhM=; b=YvLr29A72pKcbYMCWY9UydhzXv1Y7rs44v7JGBFtU3nHDqXVc1N6b/M5zgLYqwPMvR63bly4MVvswk+rlIRTNaudtO6BhEKTIsSYoflhyGuBjy6lSn95McgyqVSmILfW2A3QoOATfyrbeyDspnlkFCUfj3oetDJIgHrYo30hHPw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565998040282886.3150939171107; Fri, 16 Aug 2019 16:27:20 -0700 (PDT) Received: from localhost ([::1]:33236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylck-0007fg-AE for importer@patchew.org; Fri, 16 Aug 2019 19:27:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46449) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPi-0006Su-Rq for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPh-0005ux-40 for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54366) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPc-0005ne-6a; Fri, 16 Aug 2019 19:13:36 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 51C5B300CB6C; Fri, 16 Aug 2019 23:13:35 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E57519C6A; Fri, 16 Aug 2019 23:13:34 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:57 -0400 Message-Id: <20190816231318.8650-16-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 16 Aug 2019 23:13:35 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 15/36] iotests: teach FilePath to produce multiple paths X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Use "FilePaths" instead of "FilePath" to request multiple files be cleaned up after we leave that object's scope. This is not crucial; but it saves a little typing. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-16-jsnow@redhat.com Signed-off-by: John Snow --- tests/qemu-iotests/iotests.py | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 81ae7b911ac..385dbad16ac 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -358,31 +358,45 @@ class Timeout: def timeout(self, signum, frame): raise Exception(self.errmsg) =20 +def file_pattern(name): + return "{0}-{1}".format(os.getpid(), name) =20 -class FilePath(object): - '''An auto-generated filename that cleans itself up. +class FilePaths(object): + """ + FilePaths is an auto-generated filename that cleans itself up. =20 Use this context manager to generate filenames and ensure that the file gets deleted:: =20 - with TestFilePath('test.img') as img_path: + with FilePaths(['test.img']) as img_path: qemu_img('create', img_path, '1G') # migration_sock_path is automatically deleted - ''' - def __init__(self, name): - filename =3D '{0}-{1}'.format(os.getpid(), name) - self.path =3D os.path.join(test_dir, filename) + """ + def __init__(self, names): + self.paths =3D [] + for name in names: + self.paths.append(os.path.join(test_dir, file_pattern(name))) =20 def __enter__(self): - return self.path + return self.paths =20 def __exit__(self, exc_type, exc_val, exc_tb): try: - os.remove(self.path) + for path in self.paths: + os.remove(path) except OSError: pass return False =20 +class FilePath(FilePaths): + """ + FilePath is a specialization of FilePaths that takes a single filename. + """ + def __init__(self, name): + super(FilePath, self).__init__([name]) + + def __enter__(self): + return self.paths[0] =20 def file_path_remover(): for path in reversed(file_path_remover.paths): @@ -407,7 +421,7 @@ def file_path(*names): =20 paths =3D [] for name in names: - filename =3D '{0}-{1}'.format(os.getpid(), name) + filename =3D file_pattern(name) path =3D os.path.join(test_dir, filename) file_path_remover.paths.append(path) paths.append(path) --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998267; cv=none; d=zoho.com; s=zohoarc; b=OtycVsx2eLElSuqT/YgcAcbrNj4XGyDxJxL/wHvlrNkQtIjaldTrXg+0k83T2Y642WaaWrwh3fgWRp6VL4DdFHD2Zz9kR4mioikg5nQZuielfdixd6HGPCak/csWlltVJMgEictxwKariaQZE/BPElhR5dJLwuomFFx41m8dJX8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998267; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=wFeuuCXPAecWVye4Me3evEFEQ/aszTejV5slm90lmEw=; b=Zl/M+RiaapUnqlpZybeRUiVeO3yuQAH9dvAmNlYcyqD2e0QDbZ/fMnskkQlLMxbwUh1jFkT6cZtR7WMV8NQSLua3UuhV25EDlJDLGPHU3grgUXLRD/DRISkVwEYhu4bIGAM9mka2V8SnpArsxseJskdZ1HjSAs1QkvbWmmfX0kg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565998267752195.56132535929976; Fri, 16 Aug 2019 16:31:07 -0700 (PDT) Received: from localhost ([::1]:33272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylgY-0003db-J8 for importer@patchew.org; Fri, 16 Aug 2019 19:31:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46497) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPk-0006V5-4N for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPi-0005w6-B3 for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51230) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPc-0005ps-Ur; Fri, 16 Aug 2019 19:13:37 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 28926308427C; Fri, 16 Aug 2019 23:13:36 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74B65165D8; Fri, 16 Aug 2019 23:13:35 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:58 -0400 Message-Id: <20190816231318.8650-17-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 16 Aug 2019 23:13:36 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 16/36] iotests: Add virtio-scsi device helper X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Seems that it comes up enough. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-17-jsnow@redhat.com Signed-off-by: John Snow --- tests/qemu-iotests/040 | 6 +----- tests/qemu-iotests/093 | 6 ++---- tests/qemu-iotests/139 | 7 ++----- tests/qemu-iotests/238 | 5 +---- tests/qemu-iotests/iotests.py | 4 ++++ 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 index aa0b1847e30..6db9abf8e6e 100755 --- a/tests/qemu-iotests/040 +++ b/tests/qemu-iotests/040 @@ -85,11 +85,7 @@ class TestSingleDrive(ImageCommitTestCase): qemu_io('-f', 'raw', '-c', 'write -P 0xab 0 524288', backing_img) qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xef 524288 524288',= mid_img) self.vm =3D iotests.VM().add_drive(test_img, "node-name=3Dtop,back= ing.node-name=3Dmid,backing.backing.node-name=3Dbase", interface=3D"none") - if iotests.qemu_default_machine =3D=3D 's390-ccw-virtio': - self.vm.add_device("virtio-scsi-ccw") - else: - self.vm.add_device("virtio-scsi-pci") - + self.vm.add_device(iotests.get_virtio_scsi_device()) self.vm.add_device("scsi-hd,id=3Dscsi0,drive=3Ddrive0") self.vm.launch() self.has_quit =3D False diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093 index 4b2cac1d0c6..3c4f5173cea 100755 --- a/tests/qemu-iotests/093 +++ b/tests/qemu-iotests/093 @@ -367,10 +367,8 @@ class ThrottleTestGroupNames(iotests.QMPTestCase): class ThrottleTestRemovableMedia(iotests.QMPTestCase): def setUp(self): self.vm =3D iotests.VM() - if iotests.qemu_default_machine =3D=3D 's390-ccw-virtio': - self.vm.add_device("virtio-scsi-ccw,id=3Dvirtio-scsi") - else: - self.vm.add_device("virtio-scsi-pci,id=3Dvirtio-scsi") + self.vm.add_device("{},id=3Dvirtio-scsi".format( + iotests.get_virtio_scsi_device())) self.vm.launch() =20 def tearDown(self): diff --git a/tests/qemu-iotests/139 b/tests/qemu-iotests/139 index 933b45121a9..2176ea51ba8 100755 --- a/tests/qemu-iotests/139 +++ b/tests/qemu-iotests/139 @@ -35,11 +35,8 @@ class TestBlockdevDel(iotests.QMPTestCase): def setUp(self): iotests.qemu_img('create', '-f', iotests.imgfmt, base_img, '1M') self.vm =3D iotests.VM() - if iotests.qemu_default_machine =3D=3D 's390-ccw-virtio': - self.vm.add_device("virtio-scsi-ccw,id=3Dvirtio-scsi") - else: - self.vm.add_device("virtio-scsi-pci,id=3Dvirtio-scsi") - + self.vm.add_device("{},id=3Dvirtio-scsi".format( + iotests.get_virtio_scsi_device())) self.vm.launch() =20 def tearDown(self): diff --git a/tests/qemu-iotests/238 b/tests/qemu-iotests/238 index 08bc7e6b4be..e5ac2b2ff84 100755 --- a/tests/qemu-iotests/238 +++ b/tests/qemu-iotests/238 @@ -23,10 +23,7 @@ import os import iotests from iotests import log =20 -if iotests.qemu_default_machine =3D=3D 's390-ccw-virtio': - virtio_scsi_device =3D 'virtio-scsi-ccw' -else: - virtio_scsi_device =3D 'virtio-scsi-pci' +virtio_scsi_device =3D iotests.get_virtio_scsi_device() =20 vm =3D iotests.VM() vm.launch() diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 385dbad16ac..84438e837cb 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -164,6 +164,10 @@ def qemu_io_silent(*args): (-exitcode, ' '.join(args))) return exitcode =20 +def get_virtio_scsi_device(): + if qemu_default_machine =3D=3D 's390-ccw-virtio': + return 'virtio-scsi-ccw' + return 'virtio-scsi-pci' =20 class QemuIoInteractive: def __init__(self, *args): --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565999254; cv=none; d=zoho.com; s=zohoarc; b=Pl6869GP8tAFsHjrQ25q7oMW9nvmNVo5G8+Mju7HDgKZNzElhPE1GSiQjyGFKvfqEN2E7QEj98lijxZxnsCXrjJzONtTwJT8z6ukWJa67pAgcY0jiM2uZTmWTMLaEhTbgy2pCZ4w/OsgdfiKEBAZziuTNwJuD8RSd1HbaxrCnXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565999254; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=D6TQM8gHZOY1pHuw9vSJV3giLJbAvZIAGTw0FDNDBwA=; b=FOCKxR+oWASdv2nlyEpqRQDtmz5dLuylny+uZwxy9ksx3jmwor5WwILvRKmzkFD/rwdmTBGBMV42+AgSpTJrWYKbhbtxRI/aOWkh+E9v6zMPDcNms5ynwEZbUGb5PfBwe2uJV9Yld1BGl4qMUDk9uF8sjjzRz7j8CuiPoH3CzSI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565999254938579.0094456256131; Fri, 16 Aug 2019 16:47:34 -0700 (PDT) Received: from localhost ([::1]:33528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylwS-0007vO-H1 for importer@patchew.org; Fri, 16 Aug 2019 19:47:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47338) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylQ7-0007F3-UX for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPz-0006KO-5S for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37224) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPf-0005sN-3N; Fri, 16 Aug 2019 19:13:39 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37E72190C019; Fri, 16 Aug 2019 23:13:37 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4EC6D1C92C; Fri, 16 Aug 2019 23:13:36 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:12:59 -0400 Message-Id: <20190816231318.8650-18-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.70]); Fri, 16 Aug 2019 23:13:37 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 17/36] iotests: add test 257 for bitmap-mode backups X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-18-jsnow@redhat.com [Removed 'auto' group, as per new testing config guidelines --js] Signed-off-by: John Snow --- tests/qemu-iotests/257 | 416 +++++++ tests/qemu-iotests/257.out | 2247 ++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 2664 insertions(+) create mode 100755 tests/qemu-iotests/257 create mode 100644 tests/qemu-iotests/257.out diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 new file mode 100755 index 00000000000..39526837499 --- /dev/null +++ b/tests/qemu-iotests/257 @@ -0,0 +1,416 @@ +#!/usr/bin/env python +# +# Test bitmap-sync backups (incremental, differential, and partials) +# +# Copyright (c) 2019 John Snow for Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# owner=3Djsnow@redhat.com + +from collections import namedtuple +import math +import os + +import iotests +from iotests import log, qemu_img + +SIZE =3D 64 * 1024 * 1024 +GRANULARITY =3D 64 * 1024 + +Pattern =3D namedtuple('Pattern', ['byte', 'offset', 'size']) +def mkpattern(byte, offset, size=3DGRANULARITY): + """Constructor for Pattern() with default size""" + return Pattern(byte, offset, size) + +class PatternGroup: + """Grouping of Pattern objects. Initialize with an iterable of Pattern= s.""" + def __init__(self, patterns): + self.patterns =3D patterns + + def bits(self, granularity): + """Calculate the unique bits dirtied by this pattern grouping""" + res =3D set() + for pattern in self.patterns: + lower =3D pattern.offset // granularity + upper =3D (pattern.offset + pattern.size - 1) // granularity + res =3D res | set(range(lower, upper + 1)) + return res + +GROUPS =3D [ + PatternGroup([ + # Batch 0: 4 clusters + mkpattern('0x49', 0x0000000), + mkpattern('0x6c', 0x0100000), # 1M + mkpattern('0x6f', 0x2000000), # 32M + mkpattern('0x76', 0x3ff0000)]), # 64M - 64K + PatternGroup([ + # Batch 1: 6 clusters (3 new) + mkpattern('0x65', 0x0000000), # Full overwrite + mkpattern('0x77', 0x00f8000), # Partial-left (1M-32K) + mkpattern('0x72', 0x2008000), # Partial-right (32M+32K) + mkpattern('0x69', 0x3fe0000)]), # Adjacent-left (64M - 128K) + PatternGroup([ + # Batch 2: 7 clusters (3 new) + mkpattern('0x74', 0x0010000), # Adjacent-right + mkpattern('0x69', 0x00e8000), # Partial-left (1M-96K) + mkpattern('0x6e', 0x2018000), # Partial-right (32M+96K) + mkpattern('0x67', 0x3fe0000, + 2*GRANULARITY)]), # Overwrite [(64M-128K)-64M) + PatternGroup([ + # Batch 3: 8 clusters (5 new) + # Carefully chosen such that nothing re-dirties the one cluster + # that copies out successfully before failure in Group #1. + mkpattern('0xaa', 0x0010000, + 3*GRANULARITY), # Overwrite and 2x Adjacent-right + mkpattern('0xbb', 0x00d8000), # Partial-left (1M-160K) + mkpattern('0xcc', 0x2028000), # Partial-right (32M+160K) + mkpattern('0xdd', 0x3fc0000)]), # New; leaving a gap to the right +] + +class Drive: + """Represents, vaguely, a drive attached to a VM. + Includes format, graph, and device information.""" + + def __init__(self, path, vm=3DNone): + self.path =3D path + self.vm =3D vm + self.fmt =3D None + self.size =3D None + self.node =3D None + self.device =3D None + + @property + def name(self): + return self.node or self.device + + def img_create(self, fmt, size): + self.fmt =3D fmt + self.size =3D size + iotests.qemu_img_create('-f', self.fmt, self.path, str(self.size)) + + def create_target(self, name, fmt, size): + basename =3D os.path.basename(self.path) + file_node_name =3D "file_{}".format(basename) + vm =3D self.vm + + log(vm.command('blockdev-create', job_id=3D'bdc-file-job', + options=3D{ + 'driver': 'file', + 'filename': self.path, + 'size': 0, + })) + vm.run_job('bdc-file-job') + log(vm.command('blockdev-add', driver=3D'file', + node_name=3Dfile_node_name, filename=3Dself.path)) + + log(vm.command('blockdev-create', job_id=3D'bdc-fmt-job', + options=3D{ + 'driver': fmt, + 'file': file_node_name, + 'size': size, + })) + vm.run_job('bdc-fmt-job') + log(vm.command('blockdev-add', driver=3Dfmt, + node_name=3Dname, + file=3Dfile_node_name)) + self.fmt =3D fmt + self.size =3D size + self.node =3D name + +def query_bitmaps(vm): + res =3D vm.qmp("query-block") + return {"bitmaps": {device['device'] or device['qdev']: + device.get('dirty-bitmaps', []) for + device in res['return']}} + +def get_bitmap(bitmaps, drivename, name, recording=3DNone): + """ + get a specific bitmap from the object returned by query_bitmaps. + :param recording: If specified, filter results by the specified value. + """ + for bitmap in bitmaps['bitmaps'][drivename]: + if bitmap.get('name', '') =3D=3D name: + if recording is None: + return bitmap + elif bitmap.get('recording') =3D=3D recording: + return bitmap + return None + +def reference_backup(drive, n, filepath): + log("--- Reference Backup #{:d} ---\n".format(n)) + target_id =3D "ref_target_{:d}".format(n) + job_id =3D "ref_backup_{:d}".format(n) + target_drive =3D Drive(filepath, vm=3Ddrive.vm) + + target_drive.create_target(target_id, drive.fmt, drive.size) + drive.vm.qmp_log("blockdev-backup", + job_id=3Djob_id, device=3Ddrive.name, + target=3Dtarget_id, sync=3D"full") + drive.vm.run_job(job_id, auto_dismiss=3DTrue) + log('') + +def bitmap_backup(drive, n, filepath, bitmap, bitmap_mode): + log("--- Bitmap Backup #{:d} ---\n".format(n)) + target_id =3D "bitmap_target_{:d}".format(n) + job_id =3D "bitmap_backup_{:d}".format(n) + target_drive =3D Drive(filepath, vm=3Ddrive.vm) + + target_drive.create_target(target_id, drive.fmt, drive.size) + drive.vm.qmp_log("blockdev-backup", job_id=3Djob_id, device=3Ddrive.na= me, + target=3Dtarget_id, sync=3D"bitmap", + bitmap_mode=3Dbitmap_mode, + bitmap=3Dbitmap, + auto_finalize=3DFalse) + return job_id + +def perform_writes(drive, n): + log("--- Write #{:d} ---\n".format(n)) + for pattern in GROUPS[n].patterns: + cmd =3D "write -P{:s} 0x{:07x} 0x{:x}".format( + pattern.byte, + pattern.offset, + pattern.size) + log(cmd) + log(drive.vm.hmp_qemu_io(drive.name, cmd)) + bitmaps =3D query_bitmaps(drive.vm) + log(bitmaps, indent=3D2) + log('') + return bitmaps + +def calculate_bits(groups=3DNone): + """Calculate how many bits we expect to see dirtied.""" + if groups: + bits =3D set.union(*(GROUPS[group].bits(GRANULARITY) for group in = groups)) + return len(bits) + return 0 + +def bitmap_comparison(bitmap, groups=3DNone, want=3D0): + """ + Print a nice human-readable message checking that this bitmap has as + many bits set as we expect it to. + """ + log("=3D Checking Bitmap {:s} =3D".format(bitmap.get('name', '(anonymo= us)'))) + + if groups: + want =3D calculate_bits(groups) + have =3D bitmap['count'] // bitmap['granularity'] + + log("expecting {:d} dirty sectors; have {:d}. {:s}".format( + want, have, "OK!" if want =3D=3D have else "ERROR!")) + log('') + +def compare_images(image, reference, baseimg=3DNone, expected_match=3DTrue= ): + """ + Print a nice human-readable message comparing these images. + """ + expected_ret =3D 0 if expected_match else 1 + if baseimg: + assert qemu_img("rebase", "-u", "-b", baseimg, image) =3D=3D 0 + ret =3D qemu_img("compare", image, reference) + log('qemu_img compare "{:s}" "{:s}" =3D=3D> {:s}, {:s}'.format( + image, reference, + "Identical" if ret =3D=3D 0 else "Mismatch", + "OK!" if ret =3D=3D expected_ret else "ERROR!"), + filters=3D[iotests.filter_testfiles]) + +def test_bitmap_sync(bsync_mode, failure=3DNone): + """ + Test bitmap backup routines. + + :param bsync_mode: Is the Bitmap Sync mode, and can be any of: + - on-success: This is the "incremental" style mode. Bitmaps are + synchronized to what was copied out only on success. + (Partial images must be discarded.) + - never: This is the "differential" style mode. + Bitmaps are never synchronized. + - always: This is a "best effort" style mode. + Bitmaps are always synchronized, regardless of failu= re. + (Partial images must be kept.) + + :param failure: Is the (optional) failure mode, and can be any of: + - None: No failure. Test the normative path. Default. + - simulated: Cancel the job right before it completes. + This also tests writes "during" the job. + - intermediate: This tests a job that fails mid-process and produc= es + an incomplete backup. Testing limitations prevent + testing competing writes. + """ + with iotests.FilePaths(['img', 'bsync1', 'bsync2', + 'fbackup0', 'fbackup1', 'fbackup2']) as \ + (img_path, bsync1, bsync2, + fbackup0, fbackup1, fbackup2), \ + iotests.VM() as vm: + + mode =3D "Bitmap Sync Mode {:s}".format(bsync_mode) + preposition =3D "with" if failure else "without" + cond =3D "{:s} {:s}".format(preposition, + "{:s} failure".format(failure) if failure + else "failure") + log("\n=3D=3D=3D {:s} {:s} =3D=3D=3D\n".format(mode, cond)) + + log('--- Preparing image & VM ---\n') + drive0 =3D Drive(img_path, vm=3Dvm) + drive0.img_create(iotests.imgfmt, SIZE) + vm.add_device("{},id=3Dscsi0".format(iotests.get_virtio_scsi_devic= e())) + vm.launch() + + file_config =3D { + 'driver': 'file', + 'filename': drive0.path + } + + if failure =3D=3D 'intermediate': + file_config =3D { + 'driver': 'blkdebug', + 'image': file_config, + 'set-state': [{ + 'event': 'flush_to_disk', + 'state': 1, + 'new_state': 2 + }, { + 'event': 'read_aio', + 'state': 2, + 'new_state': 3 + }], + 'inject-error': [{ + 'event': 'read_aio', + 'errno': 5, + 'state': 3, + 'immediately': False, + 'once': True + }] + } + + vm.qmp_log('blockdev-add', + filters=3D[iotests.filter_qmp_testfiles], + node_name=3D"drive0", + driver=3Ddrive0.fmt, + file=3Dfile_config) + drive0.node =3D 'drive0' + drive0.device =3D 'device0' + # Use share-rw to allow writes directly to the node; + # The anonymous block-backend for this configuration prevents us + # from using HMP's qemu-io commands to address the device. + vm.qmp_log("device_add", id=3Ddrive0.device, + drive=3Ddrive0.name, driver=3D"scsi-hd", + share_rw=3DTrue) + log('') + + # 0 - Writes and Reference Backup + perform_writes(drive0, 0) + reference_backup(drive0, 0, fbackup0) + log('--- Add Bitmap ---\n') + vm.qmp_log("block-dirty-bitmap-add", node=3Ddrive0.name, + name=3D"bitmap0", granularity=3DGRANULARITY) + log('') + + # 1 - Writes and Reference Backup + bitmaps =3D perform_writes(drive0, 1) + dirty_groups =3D {1} + bitmap =3D get_bitmap(bitmaps, drive0.device, 'bitmap0') + bitmap_comparison(bitmap, groups=3Ddirty_groups) + reference_backup(drive0, 1, fbackup1) + + # 1 - Bitmap Backup (Optional induced failure) + if failure =3D=3D 'intermediate': + # Activate blkdebug induced failure for second-to-next read + log(vm.hmp_qemu_io(drive0.name, 'flush')) + log('') + job =3D bitmap_backup(drive0, 1, bsync1, "bitmap0", bsync_mode) + + def _callback(): + """Issue writes while the job is open to test bitmap divergenc= e.""" + # Note: when `failure` is 'intermediate', this isn't called. + log('') + bitmaps =3D perform_writes(drive0, 2) + # Named bitmap (static, should be unchanged) + bitmap_comparison(get_bitmap(bitmaps, drive0.device, 'bitmap0'= ), + groups=3Ddirty_groups) + # Anonymous bitmap (dynamic, shows new writes) + bitmap_comparison(get_bitmap(bitmaps, drive0.device, '', + recording=3DTrue), groups=3D{2}) + dirty_groups.add(2) + + vm.run_job(job, auto_dismiss=3DTrue, auto_finalize=3DFalse, + pre_finalize=3D_callback, + cancel=3D(failure =3D=3D 'simulated')) + bitmaps =3D query_bitmaps(vm) + bitmap =3D get_bitmap(bitmaps, drive0.device, 'bitmap0') + log(bitmaps, indent=3D2) + log('') + + if ((bsync_mode =3D=3D 'on-success' and not failure) or + (bsync_mode =3D=3D 'always' and failure !=3D 'intermediate= ')): + dirty_groups.remove(1) + + if bsync_mode =3D=3D 'always' and failure =3D=3D 'intermediate': + # We manage to copy one sector (one bit) before the error. + bitmap_comparison(bitmap, + want=3Dcalculate_bits(groups=3Ddirty_groups)= - 1) + else: + bitmap_comparison(bitmap, groups=3Ddirty_groups) + + # 2 - Writes and Reference Backup + bitmaps =3D perform_writes(drive0, 3) + dirty_groups.add(3) + bitmap =3D get_bitmap(bitmaps, drive0.device, 'bitmap0') + if bsync_mode =3D=3D 'always' and failure =3D=3D 'intermediate': + # We're one bit short, still. + bitmap_comparison(bitmap, + want=3Dcalculate_bits(groups=3Ddirty_groups)= - 1) + else: + bitmap_comparison(bitmap, groups=3Ddirty_groups) + reference_backup(drive0, 2, fbackup2) + + # 2 - Bitmap Backup (In failure modes, this is a recovery.) + job =3D bitmap_backup(drive0, 2, bsync2, "bitmap0", bsync_mode) + vm.run_job(job, auto_dismiss=3DTrue, auto_finalize=3DFalse) + bitmaps =3D query_bitmaps(vm) + bitmap =3D get_bitmap(bitmaps, drive0.device, 'bitmap0') + log(bitmaps, indent=3D2) + log('') + bitmap_comparison(bitmap, groups=3D{} + if bsync_mode !=3D 'never' + else dirty_groups) + + log('--- Cleanup ---\n') + vm.qmp_log("block-dirty-bitmap-remove", + node=3Ddrive0.name, name=3D"bitmap0") + log(query_bitmaps(vm), indent=3D2) + vm.shutdown() + log('') + + log('--- Verification ---\n') + # 'simulated' failures will actually all pass here because we canc= eled + # while "pending". This is actually undefined behavior, + # don't rely on this to be true! + compare_images(bsync1, fbackup1, baseimg=3Dfbackup0, + expected_match=3Dfailure !=3D 'intermediate') + if not failure or bsync_mode =3D=3D 'always': + # Always keep the last backup on success or when using 'always' + base =3D bsync1 + else: + base =3D fbackup0 + compare_images(bsync2, fbackup2, baseimg=3Dbase) + compare_images(img_path, fbackup2) + log('') + +def main(): + for bsync_mode in ("never", "on-success", "always"): + for failure in ("simulated", "intermediate", None): + test_bitmap_sync(bsync_mode, failure) + +if __name__ =3D=3D '__main__': + iotests.script_main(main, supported_fmts=3D['qcow2']) diff --git a/tests/qemu-iotests/257.out b/tests/qemu-iotests/257.out new file mode 100644 index 00000000000..e0775d4815b --- /dev/null +++ b/tests/qemu-iotests/257.out @@ -0,0 +1,2247 @@ + +=3D=3D=3D Bitmap Sync Mode never with simulated failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Bitmap Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "bitm= ap_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"return": {}} + +--- Write #2 --- + +write -P0x74 0x0010000 0x10000 +{"return": ""} +write -P0x69 0x00e8000 0x10000 +{"return": ""} +write -P0x6e 0x2018000 0x10000 +{"return": ""} +write -P0x67 0x3fe0000 0x20000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "persistent": false, + "recording": false, + "status": "disabled" + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": true, + "status": "active" + }, + { + "busy": true, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "frozen" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +=3D Checking Bitmap (anonymous) =3D +expecting 7 dirty sectors; have 7. OK! + +{"execute": "job-cancel", "arguments": {"id": "bitmap_backup_1"}} +{"return": {}} +{"data": {"id": "bitmap_backup_1", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "bitmap_backup_1", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 655360, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 10 dirty sectors; have 10. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 983040, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 15 dirty sectors; have 15. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Bitmap Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "bitm= ap_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"return": {}} +{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 983040, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 15 dirty sectors; have 15. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Bitmap Sync Mode never with intermediate failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img= "}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false= , "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new= -state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]= }, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +{"return": ""} + +--- Bitmap Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "bitm= ap_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"return": {}} +{"data": {"action": "report", "device": "bitmap_backup_1", "operation": "r= ead"}, "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "= seconds": "SECS"}} +{"data": {"device": "bitmap_backup_1", "error": "Input/output error", "len= ": 67108864, "offset": 66781184, "speed": 0, "type": "backup"}, "event": "B= LOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SEC= S"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 917504, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 14 dirty sectors; have 14. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Bitmap Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "bitm= ap_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"return": {}} +{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 917504, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 14 dirty sectors; have 14. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Mis= match, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Bitmap Sync Mode never without failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Bitmap Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "bitm= ap_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"return": {}} + +--- Write #2 --- + +write -P0x74 0x0010000 0x10000 +{"return": ""} +write -P0x69 0x00e8000 0x10000 +{"return": ""} +write -P0x6e 0x2018000 0x10000 +{"return": ""} +write -P0x67 0x3fe0000 0x20000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "persistent": false, + "recording": false, + "status": "disabled" + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": true, + "status": "active" + }, + { + "busy": true, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "frozen" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +=3D Checking Bitmap (anonymous) =3D +expecting 7 dirty sectors; have 7. OK! + +{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_1"}} +{"return": {}} +{"data": {"id": "bitmap_backup_1", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "bitmap_backup_1", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 655360, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 10 dirty sectors; have 10. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 983040, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 15 dirty sectors; have 15. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Bitmap Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "bitm= ap_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"return": {}} +{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 983040, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 15 dirty sectors; have 15. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Bitmap Sync Mode on-success with simulated failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Bitmap Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "bitmap_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"return": {}} + +--- Write #2 --- + +write -P0x74 0x0010000 0x10000 +{"return": ""} +write -P0x69 0x00e8000 0x10000 +{"return": ""} +write -P0x6e 0x2018000 0x10000 +{"return": ""} +write -P0x67 0x3fe0000 0x20000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "persistent": false, + "recording": false, + "status": "disabled" + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": true, + "status": "active" + }, + { + "busy": true, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "frozen" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +=3D Checking Bitmap (anonymous) =3D +expecting 7 dirty sectors; have 7. OK! + +{"execute": "job-cancel", "arguments": {"id": "bitmap_backup_1"}} +{"return": {}} +{"data": {"id": "bitmap_backup_1", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "bitmap_backup_1", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 655360, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 10 dirty sectors; have 10. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 983040, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 15 dirty sectors; have 15. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Bitmap Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "bitmap_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"return": {}} +{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Bitmap Sync Mode on-success with intermediate failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img= "}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false= , "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new= -state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]= }, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +{"return": ""} + +--- Bitmap Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "bitmap_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"return": {}} +{"data": {"action": "report", "device": "bitmap_backup_1", "operation": "r= ead"}, "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "= seconds": "SECS"}} +{"data": {"device": "bitmap_backup_1", "error": "Input/output error", "len= ": 67108864, "offset": 66781184, "speed": 0, "type": "backup"}, "event": "B= LOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SEC= S"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 917504, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 14 dirty sectors; have 14. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Bitmap Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "bitmap_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"return": {}} +{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Mis= match, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Bitmap Sync Mode on-success without failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Bitmap Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "bitmap_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"return": {}} + +--- Write #2 --- + +write -P0x74 0x0010000 0x10000 +{"return": ""} +write -P0x69 0x00e8000 0x10000 +{"return": ""} +write -P0x6e 0x2018000 0x10000 +{"return": ""} +write -P0x67 0x3fe0000 0x20000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "persistent": false, + "recording": false, + "status": "disabled" + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": true, + "status": "active" + }, + { + "busy": true, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "frozen" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +=3D Checking Bitmap (anonymous) =3D +expecting 7 dirty sectors; have 7. OK! + +{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_1"}} +{"return": {}} +{"data": {"id": "bitmap_backup_1", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "bitmap_backup_1", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 458752, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 7 dirty sectors; have 7. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 786432, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 12 dirty sectors; have 12. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Bitmap Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "bitmap_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"return": {}} +{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Bitmap Sync Mode always with simulated failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Bitmap Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bit= map_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"return": {}} + +--- Write #2 --- + +write -P0x74 0x0010000 0x10000 +{"return": ""} +write -P0x69 0x00e8000 0x10000 +{"return": ""} +write -P0x6e 0x2018000 0x10000 +{"return": ""} +write -P0x67 0x3fe0000 0x20000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "persistent": false, + "recording": false, + "status": "disabled" + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": true, + "status": "active" + }, + { + "busy": true, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "frozen" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +=3D Checking Bitmap (anonymous) =3D +expecting 7 dirty sectors; have 7. OK! + +{"execute": "job-cancel", "arguments": {"id": "bitmap_backup_1"}} +{"return": {}} +{"data": {"id": "bitmap_backup_1", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "bitmap_backup_1", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 458752, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 7 dirty sectors; have 7. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 786432, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 12 dirty sectors; have 12. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Bitmap Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bit= map_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"return": {}} +{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Bitmap Sync Mode always with intermediate failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img= "}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false= , "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new= -state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]= }, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +{"return": ""} + +--- Bitmap Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bit= map_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"return": {}} +{"data": {"action": "report", "device": "bitmap_backup_1", "operation": "r= ead"}, "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "= seconds": "SECS"}} +{"data": {"device": "bitmap_backup_1", "error": "Input/output error", "len= ": 67108864, "offset": 66781184, "speed": 0, "type": "backup"}, "event": "B= LOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SEC= S"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 327680, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 5 dirty sectors; have 5. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 851968, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 13 dirty sectors; have 13. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Bitmap Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bit= map_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"return": {}} +{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Mis= match, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Bitmap Sync Mode always without failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Bitmap Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bit= map_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"return": {}} + +--- Write #2 --- + +write -P0x74 0x0010000 0x10000 +{"return": ""} +write -P0x69 0x00e8000 0x10000 +{"return": ""} +write -P0x6e 0x2018000 0x10000 +{"return": ""} +write -P0x67 0x3fe0000 0x20000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "persistent": false, + "recording": false, + "status": "disabled" + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": true, + "status": "active" + }, + { + "busy": true, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "frozen" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +=3D Checking Bitmap (anonymous) =3D +expecting 7 dirty sectors; have 7. OK! + +{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_1"}} +{"return": {}} +{"data": {"id": "bitmap_backup_1", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "bitmap_backup_1", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 458752, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 7 dirty sectors; have 7. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 786432, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 12 dirty sectors; have 12. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Bitmap Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bit= map_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"return": {}} +{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 5a37839e35a..d95d5564147 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -271,5 +271,6 @@ 254 rw backing quick 255 rw quick 256 rw quick +257 rw 258 rw quick 262 rw quick migration --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565997950; cv=none; d=zoho.com; s=zohoarc; b=Be7db0JMf/6QyiDE09czuhtZcPhk9CnZIAE23tyn02Ss56dCwTNwQGIC9mITe/kIjRYMORp6FrbxhGZFxcJl7G00/38FHky6EIOSs3v9Ews+2FHELGXZILFFtJQQ+5qDhBw1hguH6HZPmhPCFb1LCBhu1/TjMHIGPgZK3TaURv4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565997950; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ofCglghcyCAvFMCl+B6gesZFJDBQ+M1TYYlU82C8Kro=; b=lpwoyczyxAgB9FidOjHewZW32ar9bKRGq4hBkkAvXbWta58aFgfSkmfzjVwTPVnc0x3KX/sMDX6U6oYhQe90Iw7b8mESWAgXVgKnuLFRaypaVGL7BiqZxw13bz0Bd/s2YceZaemSmdZQx4kWKyJUOW7NGW8TJFRzB3DhwZs6bOE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565997950717860.9787579066008; Fri, 16 Aug 2019 16:25:50 -0700 (PDT) Received: from localhost ([::1]:33218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylbR-0005P8-7p for importer@patchew.org; Fri, 16 Aug 2019 19:25:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46505) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPk-0006Vi-3w for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPi-0005wg-R2 for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53708) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPe-0005s8-VN; Fri, 16 Aug 2019 19:13:39 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0FA8F800DE0; Fri, 16 Aug 2019 23:13:38 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B83119C6A; Fri, 16 Aug 2019 23:13:37 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:00 -0400 Message-Id: <20190816231318.8650-19-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.67]); Fri, 16 Aug 2019 23:13:38 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 18/36] block/backup: loosen restriction on readonly bitmaps X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" With the "never" sync policy, we actually can utilize readonly bitmaps now. Loosen the check at the QMP level, and tighten it based on provided arguments down at the job creation level instead. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190709232550.10724-19-jsnow@redhat.com Signed-off-by: John Snow --- block/backup.c | 6 ++++++ blockdev.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/block/backup.c b/block/backup.c index 2be570c0bfd..f8309be01b3 100644 --- a/block/backup.c +++ b/block/backup.c @@ -617,6 +617,12 @@ BlockJob *backup_job_create(const char *job_id, BlockD= riverState *bs, return NULL; } =20 + /* If we need to write to this bitmap, check that we can: */ + if (bitmap_mode !=3D BITMAP_SYNC_MODE_NEVER && + bdrv_dirty_bitmap_check(sync_bitmap, BDRV_BITMAP_DEFAULT, errp= )) { + return NULL; + } + /* Create a new bitmap, and freeze/disable this one. */ if (bdrv_dirty_bitmap_create_successor(bs, sync_bitmap, errp) < 0)= { return NULL; diff --git a/blockdev.c b/blockdev.c index 985b6cd75c0..a44ab1f709e 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3491,7 +3491,7 @@ static BlockJob *do_backup_common(BackupCommon *backu= p, "when providing a bitmap"); return NULL; } - if (bdrv_dirty_bitmap_check(bmap, BDRV_BITMAP_DEFAULT, errp)) { + if (bdrv_dirty_bitmap_check(bmap, BDRV_BITMAP_ALLOW_RO, errp)) { return NULL; } } --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998410; cv=none; d=zoho.com; s=zohoarc; b=GKDLb/oYA/g0NJIdhag1HLcGfwT3T4ErxH5D60if3loUG9evSsnXQHM8o8VyHlNfRbORnin7xn5ulRjJ02jx+NecvpOIF4J7lInDcyPGfv+UzORWvgsMjFDXh5jz3AorDw1N7R7j8EM28FYD2YRJwrH9Zy/Q/crK4PvPeXj6RHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998410; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=VUkatBp/4EuNl67aaWOH/h/D1gi5hyCCUi1t0G5sO8k=; b=lxmVlkx/f20wKkcCdIz08JqU1/TE7XwqpmrkJGYlP1YfenlDCX5nBcVyow0EXVA1JbEugjTrcQLZAmE5N33yo6B0pufrn6F1KTPKxIQR+blru6MZEJu3WdxhiFxJLwMvlAechdGdfPzUyf1H+TzOPuyiPmgIsT0HBCpXCm3b6kc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15659984102591018.8607312849186; Fri, 16 Aug 2019 16:33:30 -0700 (PDT) Received: from localhost ([::1]:33320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyliq-00069k-Gk for importer@patchew.org; Fri, 16 Aug 2019 19:33:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46677) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPn-0006cm-Sb for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPm-00062u-En for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36046) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPj-0005wP-5P; Fri, 16 Aug 2019 19:13:43 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5DD002CD811; Fri, 16 Aug 2019 23:13:41 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3245A19C6A; Fri, 16 Aug 2019 23:13:38 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:01 -0400 Message-Id: <20190816231318.8650-20-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 16 Aug 2019 23:13:41 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 19/36] blockdev: reduce aio_context locked sections in bitmap add/remove X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, qemu-stable@nongnu.org, Max Reitz , jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Commit 0a6c86d024c52 returned these locks back to add/remove functionality, to protect from intersection of persistent bitmap related IO with other IO. But other bitmap-related functions called here are unrelated to the problem, and there are no needs to keep these calls inside critical sections. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190708220502.12977-2-jsnow@redhat.com Signed-off-by: John Snow --- blockdev.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/blockdev.c b/blockdev.c index a44ab1f709e..bcd766a1a24 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2813,7 +2813,6 @@ void qmp_block_dirty_bitmap_add(const char *node, con= st char *name, { BlockDriverState *bs; BdrvDirtyBitmap *bitmap; - AioContext *aio_context =3D NULL; =20 if (!name || name[0] =3D=3D '\0') { error_setg(errp, "Bitmap name cannot be empty"); @@ -2849,16 +2848,20 @@ void qmp_block_dirty_bitmap_add(const char *node, c= onst char *name, } =20 if (persistent) { - aio_context =3D bdrv_get_aio_context(bs); + AioContext *aio_context =3D bdrv_get_aio_context(bs); + bool ok; + aio_context_acquire(aio_context); - if (!bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp))= { - goto out; + ok =3D bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp= ); + aio_context_release(aio_context); + if (!ok) { + return; } } =20 bitmap =3D bdrv_create_dirty_bitmap(bs, granularity, name, errp); if (bitmap =3D=3D NULL) { - goto out; + return; } =20 if (disabled) { @@ -2866,10 +2869,6 @@ void qmp_block_dirty_bitmap_add(const char *node, co= nst char *name, } =20 bdrv_dirty_bitmap_set_persistence(bitmap, persistent); - out: - if (aio_context) { - aio_context_release(aio_context); - } } =20 void qmp_block_dirty_bitmap_remove(const char *node, const char *name, @@ -2877,8 +2876,6 @@ void qmp_block_dirty_bitmap_remove(const char *node, = const char *name, { BlockDriverState *bs; BdrvDirtyBitmap *bitmap; - Error *local_err =3D NULL; - AioContext *aio_context =3D NULL; =20 bitmap =3D block_dirty_bitmap_lookup(node, name, &bs, errp); if (!bitmap || !bs) { @@ -2891,20 +2888,19 @@ void qmp_block_dirty_bitmap_remove(const char *node= , const char *name, } =20 if (bdrv_dirty_bitmap_get_persistence(bitmap)) { - aio_context =3D bdrv_get_aio_context(bs); + AioContext *aio_context =3D bdrv_get_aio_context(bs); + Error *local_err =3D NULL; + aio_context_acquire(aio_context); bdrv_remove_persistent_dirty_bitmap(bs, name, &local_err); + aio_context_release(aio_context); if (local_err !=3D NULL) { error_propagate(errp, local_err); - goto out; + return; } } =20 bdrv_release_dirty_bitmap(bs, bitmap); - out: - if (aio_context) { - aio_context_release(aio_context); - } } =20 /** --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998167; cv=none; d=zoho.com; s=zohoarc; b=AKSy8EIuMBRhGXx0vhGSaq0mx2mXxz3OodMnHZdik2k9GEpEJMj7mEhYYC4DSmilou1EpgH2n0mpsuQN8AdpJFXCLCwaqUQfla5BoRK/5tBPqmacrfZokKpRJs6oSVbrHm41g2i1xgURy4HpDqwuMgflAPbM2ZufvGvYUgVZ0Eo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998167; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=S8SjaIwwYS+yg7qbeo24uClWBjXgR8sz6lftjZEXzTE=; b=AH0z59ZWS/kV0ohxLhPdn6n2azsOSCeSIk5BBl8GB7upplqVDNhs4YnL6YZ9eCkHd0QKfvBH7jmlvjgsRMlgZipaIn8Q41Yecs487v34oEzPZ2Gu1oiKuM3IFql4HKG3jCfktVn0Ai7xrmNuILl4zWl4go8vRaINcEfr1fDgMsA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565998167872786.9591247340572; Fri, 16 Aug 2019 16:29:27 -0700 (PDT) Received: from localhost ([::1]:33264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylet-00025W-AA for importer@patchew.org; Fri, 16 Aug 2019 19:29:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46775) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPq-0006hL-Bb for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPo-00067Y-M2 for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40930) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPk-0005yH-0O; Fri, 16 Aug 2019 19:13:44 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 48831309BF21; Fri, 16 Aug 2019 23:13:42 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 813B419C6A; Fri, 16 Aug 2019 23:13:41 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:02 -0400 Message-Id: <20190816231318.8650-21-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 16 Aug 2019 23:13:42 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 20/36] qapi: implement block-dirty-bitmap-remove transaction action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, qemu-stable@nongnu.org, Max Reitz , jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" It is used to do transactional movement of the bitmap (which is possible in conjunction with merge command). Transactional bitmap movement is needed in scenarios with external snapshot, when we don't want to leave copy of the bitmap in the base image. Signed-off-by: Vladimir Sementsov-Ogievskiy Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190708220502.12977-3-jsnow@redhat.com [Edited "since" version to 4.2 --js] Signed-off-by: John Snow --- block.c | 2 +- block/dirty-bitmap.c | 15 +++---- blockdev.c | 79 +++++++++++++++++++++++++++++++--- include/block/dirty-bitmap.h | 2 +- migration/block-dirty-bitmap.c | 2 +- qapi/transaction.json | 2 + 6 files changed, 85 insertions(+), 17 deletions(-) diff --git a/block.c b/block.c index 2a2d0696672..3e698e9cabd 100644 --- a/block.c +++ b/block.c @@ -5346,7 +5346,7 @@ static void coroutine_fn bdrv_co_invalidate_cache(Blo= ckDriverState *bs, for (bm =3D bdrv_dirty_bitmap_next(bs, NULL); bm; bm =3D bdrv_dirty_bitmap_next(bs, bm)) { - bdrv_dirty_bitmap_set_migration(bm, false); + bdrv_dirty_bitmap_skip_store(bm, false); } =20 ret =3D refresh_total_sectors(bs, bs->total_sectors); diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 75a5daf116f..134e0c9a0c8 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -48,10 +48,9 @@ struct BdrvDirtyBitmap { bool inconsistent; /* bitmap is persistent, but inconsistent. It cannot be used at all in any way, ex= cept a QMP user can remove it. */ - bool migration; /* Bitmap is selected for migration, it sh= ould - not be stored on the next inactivation - (persistent flag doesn't matter until n= ext - invalidation).*/ + bool skip_store; /* We are either migrating or deleting this + * bitmap; it should not be stored on the = next + * inactivation. */ QLIST_ENTRY(BdrvDirtyBitmap) list; }; =20 @@ -762,16 +761,16 @@ void bdrv_dirty_bitmap_set_inconsistent(BdrvDirtyBitm= ap *bitmap) } =20 /* Called with BQL taken. */ -void bdrv_dirty_bitmap_set_migration(BdrvDirtyBitmap *bitmap, bool migrati= on) +void bdrv_dirty_bitmap_skip_store(BdrvDirtyBitmap *bitmap, bool skip) { qemu_mutex_lock(bitmap->mutex); - bitmap->migration =3D migration; + bitmap->skip_store =3D skip; qemu_mutex_unlock(bitmap->mutex); } =20 bool bdrv_dirty_bitmap_get_persistence(BdrvDirtyBitmap *bitmap) { - return bitmap->persistent && !bitmap->migration; + return bitmap->persistent && !bitmap->skip_store; } =20 bool bdrv_dirty_bitmap_inconsistent(const BdrvDirtyBitmap *bitmap) @@ -783,7 +782,7 @@ bool bdrv_has_changed_persistent_bitmaps(BlockDriverSta= te *bs) { BdrvDirtyBitmap *bm; QLIST_FOREACH(bm, &bs->dirty_bitmaps, list) { - if (bm->persistent && !bm->readonly && !bm->migration) { + if (bm->persistent && !bm->readonly && !bm->skip_store) { return true; } } diff --git a/blockdev.c b/blockdev.c index bcd766a1a24..210226d8290 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2136,6 +2136,51 @@ static void block_dirty_bitmap_merge_prepare(BlkActi= onState *common, errp); } =20 +static BdrvDirtyBitmap *do_block_dirty_bitmap_remove( + const char *node, const char *name, bool release, + BlockDriverState **bitmap_bs, Error **errp); + +static void block_dirty_bitmap_remove_prepare(BlkActionState *common, + Error **errp) +{ + BlockDirtyBitmap *action; + BlockDirtyBitmapState *state =3D DO_UPCAST(BlockDirtyBitmapState, + common, common); + + if (action_check_completion_mode(common, errp) < 0) { + return; + } + + action =3D common->action->u.block_dirty_bitmap_remove.data; + + state->bitmap =3D do_block_dirty_bitmap_remove(action->node, action->n= ame, + false, &state->bs, errp); + if (state->bitmap) { + bdrv_dirty_bitmap_skip_store(state->bitmap, true); + bdrv_dirty_bitmap_set_busy(state->bitmap, true); + } +} + +static void block_dirty_bitmap_remove_abort(BlkActionState *common) +{ + BlockDirtyBitmapState *state =3D DO_UPCAST(BlockDirtyBitmapState, + common, common); + + if (state->bitmap) { + bdrv_dirty_bitmap_skip_store(state->bitmap, false); + bdrv_dirty_bitmap_set_busy(state->bitmap, false); + } +} + +static void block_dirty_bitmap_remove_commit(BlkActionState *common) +{ + BlockDirtyBitmapState *state =3D DO_UPCAST(BlockDirtyBitmapState, + common, common); + + bdrv_dirty_bitmap_set_busy(state->bitmap, false); + bdrv_release_dirty_bitmap(state->bs, state->bitmap); +} + static void abort_prepare(BlkActionState *common, Error **errp) { error_setg(errp, "Transaction aborted using Abort action"); @@ -2213,6 +2258,12 @@ static const BlkActionOps actions[] =3D { .commit =3D block_dirty_bitmap_free_backup, .abort =3D block_dirty_bitmap_restore, }, + [TRANSACTION_ACTION_KIND_BLOCK_DIRTY_BITMAP_REMOVE] =3D { + .instance_size =3D sizeof(BlockDirtyBitmapState), + .prepare =3D block_dirty_bitmap_remove_prepare, + .commit =3D block_dirty_bitmap_remove_commit, + .abort =3D block_dirty_bitmap_remove_abort, + }, /* Where are transactions for MIRROR, COMMIT and STREAM? * Although these blockjobs use transaction callbacks like the backup = job, * these jobs do not necessarily adhere to transaction semantics. @@ -2871,20 +2922,21 @@ void qmp_block_dirty_bitmap_add(const char *node, c= onst char *name, bdrv_dirty_bitmap_set_persistence(bitmap, persistent); } =20 -void qmp_block_dirty_bitmap_remove(const char *node, const char *name, - Error **errp) +static BdrvDirtyBitmap *do_block_dirty_bitmap_remove( + const char *node, const char *name, bool release, + BlockDriverState **bitmap_bs, Error **errp) { BlockDriverState *bs; BdrvDirtyBitmap *bitmap; =20 bitmap =3D block_dirty_bitmap_lookup(node, name, &bs, errp); if (!bitmap || !bs) { - return; + return NULL; } =20 if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_BUSY | BDRV_BITMAP_RO, errp)) { - return; + return NULL; } =20 if (bdrv_dirty_bitmap_get_persistence(bitmap)) { @@ -2894,13 +2946,28 @@ void qmp_block_dirty_bitmap_remove(const char *node= , const char *name, aio_context_acquire(aio_context); bdrv_remove_persistent_dirty_bitmap(bs, name, &local_err); aio_context_release(aio_context); + if (local_err !=3D NULL) { error_propagate(errp, local_err); - return; + return NULL; } } =20 - bdrv_release_dirty_bitmap(bs, bitmap); + if (release) { + bdrv_release_dirty_bitmap(bs, bitmap); + } + + if (bitmap_bs) { + *bitmap_bs =3D bs; + } + + return release ? NULL : bitmap; +} + +void qmp_block_dirty_bitmap_remove(const char *node, const char *name, + Error **errp) +{ + do_block_dirty_bitmap_remove(node, name, true, NULL, errp); } =20 /** diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h index 0120ef3f05a..4b4b731b469 100644 --- a/include/block/dirty-bitmap.h +++ b/include/block/dirty-bitmap.h @@ -83,7 +83,7 @@ void bdrv_dirty_bitmap_set_inconsistent(BdrvDirtyBitmap *= bitmap); void bdrv_dirty_bitmap_set_busy(BdrvDirtyBitmap *bitmap, bool busy); void bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, const BdrvDirtyBitmap = *src, HBitmap **backup, Error **errp); -void bdrv_dirty_bitmap_set_migration(BdrvDirtyBitmap *bitmap, bool migrati= on); +void bdrv_dirty_bitmap_skip_store(BdrvDirtyBitmap *bitmap, bool skip); bool bdrv_dirty_bitmap_get(BdrvDirtyBitmap *bitmap, int64_t offset); =20 /* Functions that require manual locking. */ diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index a09a893c023..dd40724b9e5 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -326,7 +326,7 @@ static int init_dirty_bitmap_migration(void) =20 /* unset migration flags here, to not roll back it */ QSIMPLEQ_FOREACH(dbms, &dirty_bitmap_mig_state.dbms_list, entry) { - bdrv_dirty_bitmap_set_migration(dbms->bitmap, true); + bdrv_dirty_bitmap_skip_store(dbms->bitmap, true); } =20 if (QSIMPLEQ_EMPTY(&dirty_bitmap_mig_state.dbms_list)) { diff --git a/qapi/transaction.json b/qapi/transaction.json index 95edb782278..0590dbcd1ae 100644 --- a/qapi/transaction.json +++ b/qapi/transaction.json @@ -45,6 +45,7 @@ # # - @abort: since 1.6 # - @block-dirty-bitmap-add: since 2.5 +# - @block-dirty-bitmap-remove: since 4.2 # - @block-dirty-bitmap-clear: since 2.5 # - @block-dirty-bitmap-enable: since 4.0 # - @block-dirty-bitmap-disable: since 4.0 @@ -61,6 +62,7 @@ 'data': { 'abort': 'Abort', 'block-dirty-bitmap-add': 'BlockDirtyBitmapAdd', + 'block-dirty-bitmap-remove': 'BlockDirtyBitmap', 'block-dirty-bitmap-clear': 'BlockDirtyBitmap', 'block-dirty-bitmap-enable': 'BlockDirtyBitmap', 'block-dirty-bitmap-disable': 'BlockDirtyBitmap', --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998039; cv=none; d=zoho.com; s=zohoarc; b=RSpQnuTSw4+TOSwUBXPdltG8Xb7hv9NhCP6kWvKWRH4SnG7b8Ydbv1OQUaubBIij/8C5ZRjvEiuD5A6YPSD1xJebA8XUDEOBuV3uPxit69dgNKuPFSL4qQeCKgm4JDQ69EzJ4GrytpQQGC2dubqYrAavfc2JypmD95ZHL6O70bw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998039; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=w9OjXyJGY8RCExoPtZY+jYo6C27170vpzY02gUWYxSo=; b=oKJoP5BVAoqe10MstPgB1IOcHCwjOcBptizMG1al/UpjRaS0x0cF7HziKvCVlaZzEYO/YcVKwbSW/ZUL0wMQ5kXqC7tGOO2sPUxUE5XBc0CKyexunhJT5oafufz8gBIo8cpEFogdmbPghTK7Xv9TbqC5kBD8uoWq1Pvq7vn5nO4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565998039036622.0854607749535; Fri, 16 Aug 2019 16:27:19 -0700 (PDT) Received: from localhost ([::1]:33240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylcp-0007nR-Bm for importer@patchew.org; Fri, 16 Aug 2019 19:27:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46744) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPp-0006g1-H4 for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPn-00066S-VZ for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55244) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPj-0005xu-VL; Fri, 16 Aug 2019 19:13:44 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 31561301A3E3; Fri, 16 Aug 2019 23:13:43 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A5C019C6A; Fri, 16 Aug 2019 23:13:42 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:03 -0400 Message-Id: <20190816231318.8650-22-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 16 Aug 2019 23:13:43 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 21/36] iotests: test bitmap moving inside 254 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, qemu-stable@nongnu.org, Max Reitz , jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Test persistent bitmap copying with and without removal of original bitmap. Signed-off-by: Vladimir Sementsov-Ogievskiy Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190708220502.12977-4-jsnow@redhat.com [Edited comment "bitmap1" --> "bitmap2" as per review. --js] Signed-off-by: John Snow --- tests/qemu-iotests/254 | 30 +++++++++++++- tests/qemu-iotests/254.out | 82 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/254 b/tests/qemu-iotests/254 index 8edba91c5d4..09584f3f7de 100755 --- a/tests/qemu-iotests/254 +++ b/tests/qemu-iotests/254 @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Test external snapshot with bitmap copying. +# Test external snapshot with bitmap copying and moving. # # Copyright (c) 2019 Virtuozzo International GmbH. All rights reserved. # @@ -32,6 +32,10 @@ vm =3D iotests.VM().add_drive(disk, opts=3D'node-name=3D= base') vm.launch() =20 vm.qmp_log('block-dirty-bitmap-add', node=3D'drive0', name=3D'bitmap0') +vm.qmp_log('block-dirty-bitmap-add', node=3D'drive0', name=3D'bitmap1', + persistent=3DTrue) +vm.qmp_log('block-dirty-bitmap-add', node=3D'drive0', name=3D'bitmap2', + persistent=3DTrue) =20 vm.hmp_qemu_io('drive0', 'write 0 512K') =20 @@ -39,16 +43,38 @@ vm.qmp_log('transaction', indent=3D2, actions=3D[ {'type': 'blockdev-snapshot-sync', 'data': {'device': 'drive0', 'snapshot-file': top, 'snapshot-node-name': 'snap'}}, + + # copy non-persistent bitmap0 {'type': 'block-dirty-bitmap-add', 'data': {'node': 'snap', 'name': 'bitmap0'}}, {'type': 'block-dirty-bitmap-merge', 'data': {'node': 'snap', 'target': 'bitmap0', - 'bitmaps': [{'node': 'base', 'name': 'bitmap0'}]}} + 'bitmaps': [{'node': 'base', 'name': 'bitmap0'}]}}, + + # copy persistent bitmap1, original will be saved to base image + {'type': 'block-dirty-bitmap-add', + 'data': {'node': 'snap', 'name': 'bitmap1', 'persistent': True}}, + {'type': 'block-dirty-bitmap-merge', + 'data': {'node': 'snap', 'target': 'bitmap1', + 'bitmaps': [{'node': 'base', 'name': 'bitmap1'}]}}, + + # move persistent bitmap2, original will be removed and not saved + # to base image + {'type': 'block-dirty-bitmap-add', + 'data': {'node': 'snap', 'name': 'bitmap2', 'persistent': True}}, + {'type': 'block-dirty-bitmap-merge', + 'data': {'node': 'snap', 'target': 'bitmap2', + 'bitmaps': [{'node': 'base', 'name': 'bitmap2'}]}}, + {'type': 'block-dirty-bitmap-remove', + 'data': {'node': 'base', 'name': 'bitmap2'}} ], filters=3D[iotests.filter_qmp_testfiles]) =20 result =3D vm.qmp('query-block')['return'][0] log("query-block: device =3D {}, node-name =3D {}, dirty-bitmaps:".format( result['device'], result['inserted']['node-name'])) log(result['dirty-bitmaps'], indent=3D2) +log("\nbitmaps in backing image:") +log(result['inserted']['image']['backing-image']['format-specific'] \ + ['data']['bitmaps'], indent=3D2) =20 vm.shutdown() diff --git a/tests/qemu-iotests/254.out b/tests/qemu-iotests/254.out index d7394cf0026..d185c0532f6 100644 --- a/tests/qemu-iotests/254.out +++ b/tests/qemu-iotests/254.out @@ -1,5 +1,9 @@ {"execute": "block-dirty-bitmap-add", "arguments": {"name": "bitmap0", "no= de": "drive0"}} {"return": {}} +{"execute": "block-dirty-bitmap-add", "arguments": {"name": "bitmap1", "no= de": "drive0", "persistent": true}} +{"return": {}} +{"execute": "block-dirty-bitmap-add", "arguments": {"name": "bitmap2", "no= de": "drive0", "persistent": true}} +{"return": {}} { "execute": "transaction", "arguments": { @@ -31,6 +35,55 @@ "target": "bitmap0" }, "type": "block-dirty-bitmap-merge" + }, + { + "data": { + "name": "bitmap1", + "node": "snap", + "persistent": true + }, + "type": "block-dirty-bitmap-add" + }, + { + "data": { + "bitmaps": [ + { + "name": "bitmap1", + "node": "base" + } + ], + "node": "snap", + "target": "bitmap1" + }, + "type": "block-dirty-bitmap-merge" + }, + { + "data": { + "name": "bitmap2", + "node": "snap", + "persistent": true + }, + "type": "block-dirty-bitmap-add" + }, + { + "data": { + "bitmaps": [ + { + "name": "bitmap2", + "node": "base" + } + ], + "node": "snap", + "target": "bitmap2" + }, + "type": "block-dirty-bitmap-merge" + }, + { + "data": { + "name": "bitmap2", + "node": "base" + }, + "type": "block-dirty-bitmap-remove" } ] } @@ -40,6 +93,24 @@ } query-block: device =3D drive0, node-name =3D snap, dirty-bitmaps: [ + { + "busy": false, + "count": 524288, + "granularity": 65536, + "name": "bitmap2", + "persistent": true, + "recording": true, + "status": "active" + }, + { + "busy": false, + "count": 524288, + "granularity": 65536, + "name": "bitmap1", + "persistent": true, + "recording": true, + "status": "active" + }, { "busy": false, "count": 524288, @@ -50,3 +121,14 @@ query-block: device =3D drive0, node-name =3D snap, dir= ty-bitmaps: "status": "active" } ] + +bitmaps in backing image: +[ + { + "flags": [ + "auto" + ], + "granularity": 65536, + "name": "bitmap1" + } +] --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998565; cv=none; d=zoho.com; s=zohoarc; b=YOB1aklJZyISAkpybtxh8rzPz9wulVw6OL+ssIRXzo4uNIr8erHD0WYIyvYMcGXb2frN4FpfCvMjgqoS+4dYprjrDT9erH6Nl10J6fqIIGGJf15ZogzjlAqVj2aGfa6cDhngIr9FAqT4ZZCTp/TRYYFVizNrfSBb5ahCoEHKZuY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998565; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=IUSHPQCo0fLbhpA3Stk8mGfcfjRIVpMLBm6VE55PakA=; b=GKPNFoOgkk6HmGXaX79FgXWhUStlK9LyMoubCuSMdWeAVQGlUkNmgYD5TOBYjWI3ujfCX8pX5AFcDQsfQTJxEa3FqtGgO2rMIEyf16+YOW8A1C6b7gthMmuJ1I6X9SuBIacChgLez7jYMlbPoxQ/gZq9Y7QaNH03Fq88WdQQjco= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565998565975599.0465302007298; Fri, 16 Aug 2019 16:36:05 -0700 (PDT) Received: from localhost ([::1]:33368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyllM-00022H-EE for importer@patchew.org; Fri, 16 Aug 2019 19:36:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46781) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPq-0006hd-GN for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPp-00068G-8f for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43836) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPl-0005zI-Tg; Fri, 16 Aug 2019 19:13:46 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 07C44307D941; Fri, 16 Aug 2019 23:13:44 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53EBB19C6A; Fri, 16 Aug 2019 23:13:43 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:04 -0400 Message-Id: <20190816231318.8650-23-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 16 Aug 2019 23:13:44 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 22/36] iotests/257: add Pattern class X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Just kidding, this is easier to manage with a full class instead of a namedtuple. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190716000117.25219-2-jsnow@redhat.com Signed-off-by: John Snow --- tests/qemu-iotests/257 | 58 +++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index 39526837499..02f9ae06490 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -19,7 +19,6 @@ # # owner=3Djsnow@redhat.com =20 -from collections import namedtuple import math import os =20 @@ -29,10 +28,18 @@ from iotests import log, qemu_img SIZE =3D 64 * 1024 * 1024 GRANULARITY =3D 64 * 1024 =20 -Pattern =3D namedtuple('Pattern', ['byte', 'offset', 'size']) -def mkpattern(byte, offset, size=3DGRANULARITY): - """Constructor for Pattern() with default size""" - return Pattern(byte, offset, size) + +class Pattern: + def __init__(self, byte, offset, size=3DGRANULARITY): + self.byte =3D byte + self.offset =3D offset + self.size =3D size + + def bits(self, granularity): + lower =3D self.offset // granularity + upper =3D (self.offset + self.size - 1) // granularity + return set(range(lower, upper + 1)) + =20 class PatternGroup: """Grouping of Pattern objects. Initialize with an iterable of Pattern= s.""" @@ -43,40 +50,39 @@ class PatternGroup: """Calculate the unique bits dirtied by this pattern grouping""" res =3D set() for pattern in self.patterns: - lower =3D pattern.offset // granularity - upper =3D (pattern.offset + pattern.size - 1) // granularity - res =3D res | set(range(lower, upper + 1)) + res |=3D pattern.bits(granularity) return res =20 + GROUPS =3D [ PatternGroup([ # Batch 0: 4 clusters - mkpattern('0x49', 0x0000000), - mkpattern('0x6c', 0x0100000), # 1M - mkpattern('0x6f', 0x2000000), # 32M - mkpattern('0x76', 0x3ff0000)]), # 64M - 64K + Pattern('0x49', 0x0000000), + Pattern('0x6c', 0x0100000), # 1M + Pattern('0x6f', 0x2000000), # 32M + Pattern('0x76', 0x3ff0000)]), # 64M - 64K PatternGroup([ # Batch 1: 6 clusters (3 new) - mkpattern('0x65', 0x0000000), # Full overwrite - mkpattern('0x77', 0x00f8000), # Partial-left (1M-32K) - mkpattern('0x72', 0x2008000), # Partial-right (32M+32K) - mkpattern('0x69', 0x3fe0000)]), # Adjacent-left (64M - 128K) + Pattern('0x65', 0x0000000), # Full overwrite + Pattern('0x77', 0x00f8000), # Partial-left (1M-32K) + Pattern('0x72', 0x2008000), # Partial-right (32M+32K) + Pattern('0x69', 0x3fe0000)]), # Adjacent-left (64M - 128K) PatternGroup([ # Batch 2: 7 clusters (3 new) - mkpattern('0x74', 0x0010000), # Adjacent-right - mkpattern('0x69', 0x00e8000), # Partial-left (1M-96K) - mkpattern('0x6e', 0x2018000), # Partial-right (32M+96K) - mkpattern('0x67', 0x3fe0000, - 2*GRANULARITY)]), # Overwrite [(64M-128K)-64M) + Pattern('0x74', 0x0010000), # Adjacent-right + Pattern('0x69', 0x00e8000), # Partial-left (1M-96K) + Pattern('0x6e', 0x2018000), # Partial-right (32M+96K) + Pattern('0x67', 0x3fe0000, + 2*GRANULARITY)]), # Overwrite [(64M-128K)-64M) PatternGroup([ # Batch 3: 8 clusters (5 new) # Carefully chosen such that nothing re-dirties the one cluster # that copies out successfully before failure in Group #1. - mkpattern('0xaa', 0x0010000, - 3*GRANULARITY), # Overwrite and 2x Adjacent-right - mkpattern('0xbb', 0x00d8000), # Partial-left (1M-160K) - mkpattern('0xcc', 0x2028000), # Partial-right (32M+160K) - mkpattern('0xdd', 0x3fc0000)]), # New; leaving a gap to the right + Pattern('0xaa', 0x0010000, + 3*GRANULARITY), # Overwrite and 2x Adjacent-right + Pattern('0xbb', 0x00d8000), # Partial-left (1M-160K) + Pattern('0xcc', 0x2028000), # Partial-right (32M+160K) + Pattern('0xdd', 0x3fc0000)]), # New; leaving a gap to the right ] =20 class Drive: --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998566; cv=none; d=zoho.com; s=zohoarc; b=iXCasCgnQD1Z+OLhKG97kIw/j6NUC1plPnJj987fylQ+3dHHGEapO1WcyxL1lQWmLN9YCBz5GCDovn4g2rITLJ6xBqpOrYcmNZHoOniOp9ps0CnF+QEPvzkzEiVfT2EyuptQHjFlqBznw/kMmCVDfyP4aNMlNrHGd3hGdjXIjmU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998566; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=X7YEVVlf5/SNmWtyjkwdw96zT2qhOD2lKxu6j7W/RVA=; b=cHVvMFt9GIsZ6FRVJB1HGWo46neGyr3zxZc2g4BBs4vkDK66EbY/JzLznUxhE0Yj4Ou64VRCBvT7GF1FCme1XhDYE4mdFDs0eTidzTtAwaf09lcXI7PV7zLlMVMRGd8sA/Nl8hqmpKFQ632inA1JGELg2h8Tu2n6DvxIoAOi4hg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156599856637748.80128955397561; Fri, 16 Aug 2019 16:36:06 -0700 (PDT) Received: from localhost ([::1]:33370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyllM-00024c-SD for importer@patchew.org; Fri, 16 Aug 2019 19:36:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46844) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPs-0006lC-Bf for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPq-00069j-Mt for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56398) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPn-00060e-7B; Fri, 16 Aug 2019 19:13:47 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D13517FDE9; Fri, 16 Aug 2019 23:13:44 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27C1D19C6A; Fri, 16 Aug 2019 23:13:44 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:05 -0400 Message-Id: <20190816231318.8650-24-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 16 Aug 2019 23:13:44 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 23/36] iotests/257: add EmulatedBitmap class X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Represent a bitmap with an object that we can mark and clear bits in. This makes it easier to manage partial writes when we don't write a full group's worth of patterns before an error. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190716000117.25219-3-jsnow@redhat.com Signed-off-by: John Snow --- tests/qemu-iotests/257 | 124 +++++++++++++++++++++++++---------------- 1 file changed, 75 insertions(+), 49 deletions(-) diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index 02f9ae06490..bc66ea03b24 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -85,6 +85,59 @@ GROUPS =3D [ Pattern('0xdd', 0x3fc0000)]), # New; leaving a gap to the right ] =20 + +class EmulatedBitmap: + def __init__(self, granularity=3DGRANULARITY): + self._bits =3D set() + self.granularity =3D granularity + + def dirty_bits(self, bits): + self._bits |=3D set(bits) + + def dirty_group(self, n): + self.dirty_bits(GROUPS[n].bits(self.granularity)) + + def clear(self): + self._bits =3D set() + + def clear_bits(self, bits): + self._bits -=3D set(bits) + + def clear_bit(self, bit): + self.clear_bits({bit}) + + def clear_group(self, n): + self.clear_bits(GROUPS[n].bits(self.granularity)) + + @property + def first_bit(self): + return sorted(self.bits)[0] + + @property + def bits(self): + return self._bits + + @property + def count(self): + return len(self.bits) + + def compare(self, qmp_bitmap): + """ + Print a nice human-readable message checking that a bitmap as repo= rted + by the QMP interface has as many bits set as we expect it to. + """ + + name =3D qmp_bitmap.get('name', '(anonymous)') + log("=3D Checking Bitmap {:s} =3D".format(name)) + + want =3D self.count + have =3D qmp_bitmap['count'] // qmp_bitmap['granularity'] + + log("expecting {:d} dirty sectors; have {:d}. {:s}".format( + want, have, "OK!" if want =3D=3D have else "ERROR!")) + log('') + + class Drive: """Represents, vaguely, a drive attached to a VM. Includes format, graph, and device information.""" @@ -195,27 +248,6 @@ def perform_writes(drive, n): log('') return bitmaps =20 -def calculate_bits(groups=3DNone): - """Calculate how many bits we expect to see dirtied.""" - if groups: - bits =3D set.union(*(GROUPS[group].bits(GRANULARITY) for group in = groups)) - return len(bits) - return 0 - -def bitmap_comparison(bitmap, groups=3DNone, want=3D0): - """ - Print a nice human-readable message checking that this bitmap has as - many bits set as we expect it to. - """ - log("=3D Checking Bitmap {:s} =3D".format(bitmap.get('name', '(anonymo= us)'))) - - if groups: - want =3D calculate_bits(groups) - have =3D bitmap['count'] // bitmap['granularity'] - - log("expecting {:d} dirty sectors; have {:d}. {:s}".format( - want, have, "OK!" if want =3D=3D have else "ERROR!")) - log('') =20 def compare_images(image, reference, baseimg=3DNone, expected_match=3DTrue= ): """ @@ -321,12 +353,13 @@ def test_bitmap_sync(bsync_mode, failure=3DNone): vm.qmp_log("block-dirty-bitmap-add", node=3Ddrive0.name, name=3D"bitmap0", granularity=3DGRANULARITY) log('') + ebitmap =3D EmulatedBitmap() =20 # 1 - Writes and Reference Backup bitmaps =3D perform_writes(drive0, 1) - dirty_groups =3D {1} + ebitmap.dirty_group(1) bitmap =3D get_bitmap(bitmaps, drive0.device, 'bitmap0') - bitmap_comparison(bitmap, groups=3Ddirty_groups) + ebitmap.compare(bitmap) reference_backup(drive0, 1, fbackup1) =20 # 1 - Bitmap Backup (Optional induced failure) @@ -342,54 +375,47 @@ def test_bitmap_sync(bsync_mode, failure=3DNone): log('') bitmaps =3D perform_writes(drive0, 2) # Named bitmap (static, should be unchanged) - bitmap_comparison(get_bitmap(bitmaps, drive0.device, 'bitmap0'= ), - groups=3Ddirty_groups) + ebitmap.compare(get_bitmap(bitmaps, drive0.device, 'bitmap0')) # Anonymous bitmap (dynamic, shows new writes) - bitmap_comparison(get_bitmap(bitmaps, drive0.device, '', - recording=3DTrue), groups=3D{2}) - dirty_groups.add(2) + anonymous =3D EmulatedBitmap() + anonymous.dirty_group(2) + anonymous.compare(get_bitmap(bitmaps, drive0.device, '', + recording=3DTrue)) + + # Simulate the order in which this will happen: + # group 1 gets cleared first, then group two gets written. + if ((bsync_mode =3D=3D 'on-success' and not failure) or + (bsync_mode =3D=3D 'always')): + ebitmap.clear_group(1) + ebitmap.dirty_group(2) =20 vm.run_job(job, auto_dismiss=3DTrue, auto_finalize=3DFalse, pre_finalize=3D_callback, cancel=3D(failure =3D=3D 'simulated')) bitmaps =3D query_bitmaps(vm) - bitmap =3D get_bitmap(bitmaps, drive0.device, 'bitmap0') log(bitmaps, indent=3D2) log('') =20 - if ((bsync_mode =3D=3D 'on-success' and not failure) or - (bsync_mode =3D=3D 'always' and failure !=3D 'intermediate= ')): - dirty_groups.remove(1) - if bsync_mode =3D=3D 'always' and failure =3D=3D 'intermediate': # We manage to copy one sector (one bit) before the error. - bitmap_comparison(bitmap, - want=3Dcalculate_bits(groups=3Ddirty_groups)= - 1) - else: - bitmap_comparison(bitmap, groups=3Ddirty_groups) + ebitmap.clear_bit(ebitmap.first_bit) + ebitmap.compare(get_bitmap(bitmaps, drive0.device, 'bitmap0')) =20 # 2 - Writes and Reference Backup bitmaps =3D perform_writes(drive0, 3) - dirty_groups.add(3) - bitmap =3D get_bitmap(bitmaps, drive0.device, 'bitmap0') - if bsync_mode =3D=3D 'always' and failure =3D=3D 'intermediate': - # We're one bit short, still. - bitmap_comparison(bitmap, - want=3Dcalculate_bits(groups=3Ddirty_groups)= - 1) - else: - bitmap_comparison(bitmap, groups=3Ddirty_groups) + ebitmap.dirty_group(3) + ebitmap.compare(get_bitmap(bitmaps, drive0.device, 'bitmap0')) reference_backup(drive0, 2, fbackup2) =20 # 2 - Bitmap Backup (In failure modes, this is a recovery.) job =3D bitmap_backup(drive0, 2, bsync2, "bitmap0", bsync_mode) vm.run_job(job, auto_dismiss=3DTrue, auto_finalize=3DFalse) bitmaps =3D query_bitmaps(vm) - bitmap =3D get_bitmap(bitmaps, drive0.device, 'bitmap0') log(bitmaps, indent=3D2) log('') - bitmap_comparison(bitmap, groups=3D{} - if bsync_mode !=3D 'never' - else dirty_groups) + if bsync_mode !=3D 'never': + ebitmap.clear() + ebitmap.compare(get_bitmap(bitmaps, drive0.device, 'bitmap0')) =20 log('--- Cleanup ---\n') vm.qmp_log("block-dirty-bitmap-remove", --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565999142; cv=none; d=zoho.com; s=zohoarc; b=D5UYLzsK0pkbp3ClQ/sfzTGh4pLG1etOEeKblNvO7hr8YarSlsPgvh/UpRVgg5yXUcCR/S18BIBBPp34VkA/pwYLJHCTOky2DmZ+gFVYHzJ3ZFUhGUEoj6rwfQWp8IO9RXvLIlGBP3qQL0a65gFtkMiUVkDTFK73hNIvq1P68y4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565999142; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=wUliNXPDIc5F3DDOQeCKL928iz5xos/TbKHJpPCyyIc=; b=g1vgl5PfRADwpzgCJq2n0EqLMnYZFTuOSINzi2XH6sNPL72VJbm7b/LYDIGnW9H7SUaTAxKi6XUDL5KTGG4wdj7zlepA1mYblj3IThAeiF+K70+Vt69orQzG8C5eNVzQ31xQ2is0CV0tGgw7ZGGoI9q194GPJVT/aXN9HhXCa70= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565999142159985.0201685759748; Fri, 16 Aug 2019 16:45:42 -0700 (PDT) Received: from localhost ([::1]:33498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylue-0005PF-8R for importer@patchew.org; Fri, 16 Aug 2019 19:45:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47211) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylQ3-00077a-Om for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPy-0006Im-73 for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43742) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPn-00063y-E7; Fri, 16 Aug 2019 19:13:47 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A72D7C049E1A; Fri, 16 Aug 2019 23:13:45 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id F341E19C6A; Fri, 16 Aug 2019 23:13:44 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:06 -0400 Message-Id: <20190816231318.8650-25-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 16 Aug 2019 23:13:45 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 24/36] iotests/257: Refactor backup helpers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This test needs support for non-bitmap backups and missing or unspecified bitmap sync modes, so rewrite the helpers to be a little more generic. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190716000117.25219-4-jsnow@redhat.com Signed-off-by: John Snow --- tests/qemu-iotests/257 | 56 ++++++----- tests/qemu-iotests/257.out | 192 ++++++++++++++++++------------------- 2 files changed, 128 insertions(+), 120 deletions(-) diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index bc66ea03b24..aaa8f595043 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -207,31 +207,37 @@ def get_bitmap(bitmaps, drivename, name, recording=3D= None): return bitmap return None =20 +def blockdev_backup(vm, device, target, sync, **kwargs): + # Strip any arguments explicitly nulled by the caller: + kwargs =3D {key: val for key, val in kwargs.items() if val is not None} + result =3D vm.qmp_log('blockdev-backup', + device=3Ddevice, + target=3Dtarget, + sync=3Dsync, + **kwargs) + return result + +def blockdev_backup_mktarget(drive, target_id, filepath, sync, **kwargs): + target_drive =3D Drive(filepath, vm=3Ddrive.vm) + target_drive.create_target(target_id, drive.fmt, drive.size) + blockdev_backup(drive.vm, drive.name, target_id, sync, **kwargs) + def reference_backup(drive, n, filepath): log("--- Reference Backup #{:d} ---\n".format(n)) target_id =3D "ref_target_{:d}".format(n) job_id =3D "ref_backup_{:d}".format(n) - target_drive =3D Drive(filepath, vm=3Ddrive.vm) - - target_drive.create_target(target_id, drive.fmt, drive.size) - drive.vm.qmp_log("blockdev-backup", - job_id=3Djob_id, device=3Ddrive.name, - target=3Dtarget_id, sync=3D"full") + blockdev_backup_mktarget(drive, target_id, filepath, "full", + job_id=3Djob_id) drive.vm.run_job(job_id, auto_dismiss=3DTrue) log('') =20 -def bitmap_backup(drive, n, filepath, bitmap, bitmap_mode): - log("--- Bitmap Backup #{:d} ---\n".format(n)) - target_id =3D "bitmap_target_{:d}".format(n) - job_id =3D "bitmap_backup_{:d}".format(n) - target_drive =3D Drive(filepath, vm=3Ddrive.vm) - - target_drive.create_target(target_id, drive.fmt, drive.size) - drive.vm.qmp_log("blockdev-backup", job_id=3Djob_id, device=3Ddrive.na= me, - target=3Dtarget_id, sync=3D"bitmap", - bitmap_mode=3Dbitmap_mode, - bitmap=3Dbitmap, - auto_finalize=3DFalse) +def backup(drive, n, filepath, sync, **kwargs): + log("--- Test Backup #{:d} ---\n".format(n)) + target_id =3D "backup_target_{:d}".format(n) + job_id =3D "backup_{:d}".format(n) + kwargs.setdefault('auto-finalize', False) + blockdev_backup_mktarget(drive, target_id, filepath, sync, + job_id=3Djob_id, **kwargs) return job_id =20 def perform_writes(drive, n): @@ -263,7 +269,7 @@ def compare_images(image, reference, baseimg=3DNone, ex= pected_match=3DTrue): "OK!" if ret =3D=3D expected_ret else "ERROR!"), filters=3D[iotests.filter_testfiles]) =20 -def test_bitmap_sync(bsync_mode, failure=3DNone): +def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap', failure=3DNone): """ Test bitmap backup routines. =20 @@ -291,7 +297,7 @@ def test_bitmap_sync(bsync_mode, failure=3DNone): fbackup0, fbackup1, fbackup2), \ iotests.VM() as vm: =20 - mode =3D "Bitmap Sync Mode {:s}".format(bsync_mode) + mode =3D "Mode {:s}; Bitmap Sync {:s}".format(msync_mode, bsync_mo= de) preposition =3D "with" if failure else "without" cond =3D "{:s} {:s}".format(preposition, "{:s} failure".format(failure) if failure @@ -362,12 +368,13 @@ def test_bitmap_sync(bsync_mode, failure=3DNone): ebitmap.compare(bitmap) reference_backup(drive0, 1, fbackup1) =20 - # 1 - Bitmap Backup (Optional induced failure) + # 1 - Test Backup (w/ Optional induced failure) if failure =3D=3D 'intermediate': # Activate blkdebug induced failure for second-to-next read log(vm.hmp_qemu_io(drive0.name, 'flush')) log('') - job =3D bitmap_backup(drive0, 1, bsync1, "bitmap0", bsync_mode) + job =3D backup(drive0, 1, bsync1, msync_mode, + bitmap=3D"bitmap0", bitmap_mode=3Dbsync_mode) =20 def _callback(): """Issue writes while the job is open to test bitmap divergenc= e.""" @@ -408,7 +415,8 @@ def test_bitmap_sync(bsync_mode, failure=3DNone): reference_backup(drive0, 2, fbackup2) =20 # 2 - Bitmap Backup (In failure modes, this is a recovery.) - job =3D bitmap_backup(drive0, 2, bsync2, "bitmap0", bsync_mode) + job =3D backup(drive0, 2, bsync2, "bitmap", + bitmap=3D"bitmap0", bitmap_mode=3Dbsync_mode) vm.run_job(job, auto_dismiss=3DTrue, auto_finalize=3DFalse) bitmaps =3D query_bitmaps(vm) log(bitmaps, indent=3D2) @@ -442,7 +450,7 @@ def test_bitmap_sync(bsync_mode, failure=3DNone): def main(): for bsync_mode in ("never", "on-success", "always"): for failure in ("simulated", "intermediate", None): - test_bitmap_sync(bsync_mode, failure) + test_bitmap_sync(bsync_mode, "bitmap", failure) =20 if __name__ =3D=3D '__main__': iotests.script_main(main, supported_fmts=3D['qcow2']) diff --git a/tests/qemu-iotests/257.out b/tests/qemu-iotests/257.out index e0775d4815b..0abc96acd36 100644 --- a/tests/qemu-iotests/257.out +++ b/tests/qemu-iotests/257.out @@ -1,5 +1,5 @@ =20 -=3D=3D=3D Bitmap Sync Mode never with simulated failure =3D=3D=3D +=3D=3D=3D Mode bitmap; Bitmap Sync never with simulated failure =3D=3D=3D =20 --- Preparing image & VM --- =20 @@ -86,7 +86,7 @@ expecting 6 dirty sectors; have 6. OK! {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 ---- Bitmap Backup #1 --- +--- Test Backup #1 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -96,7 +96,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "bitm= ap_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "back= up_1", "sync": "bitmap", "target": "backup_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -147,10 +147,10 @@ expecting 6 dirty sectors; have 6. OK! =3D Checking Bitmap (anonymous) =3D expecting 7 dirty sectors; have 7. OK! =20 -{"execute": "job-cancel", "arguments": {"id": "bitmap_backup_1"}} +{"execute": "job-cancel", "arguments": {"id": "backup_1"}} {"return": {}} -{"data": {"id": "bitmap_backup_1", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "bitmap_backup_1", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -213,7 +213,7 @@ expecting 15 dirty sectors; have 15. OK! {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 ---- Bitmap Backup #2 --- +--- Test Backup #2 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -223,12 +223,12 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "bitm= ap_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "back= up_2", "sync": "bitmap", "target": "backup_target_2"}} {"return": {}} -{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} -{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -265,7 +265,7 @@ qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fb= ackup2" =3D=3D> Identical, OK qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! =20 =20 -=3D=3D=3D Bitmap Sync Mode never with intermediate failure =3D=3D=3D +=3D=3D=3D Mode bitmap; Bitmap Sync never with intermediate failure =3D=3D= =3D =20 --- Preparing image & VM --- =20 @@ -354,7 +354,7 @@ expecting 6 dirty sectors; have 6. OK! =20 {"return": ""} =20 ---- Bitmap Backup #1 --- +--- Test Backup #1 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -364,10 +364,10 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "bitm= ap_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "back= up_1", "sync": "bitmap", "target": "backup_target_1"}} {"return": {}} -{"data": {"action": "report", "device": "bitmap_backup_1", "operation": "r= ead"}, "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "= seconds": "SECS"}} -{"data": {"device": "bitmap_backup_1", "error": "Input/output error", "len= ": 67108864, "offset": 66781184, "speed": 0, "type": "backup"}, "event": "B= LOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SEC= S"}} +{"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} +{"data": {"device": "backup_1", "error": "Input/output error", "len": 6710= 8864, "offset": 66781184, "speed": 0, "type": "backup"}, "event": "BLOCK_JO= B_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -430,7 +430,7 @@ expecting 14 dirty sectors; have 14. OK! {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 ---- Bitmap Backup #2 --- +--- Test Backup #2 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -440,12 +440,12 @@ expecting 14 dirty sectors; have 14. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "bitm= ap_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "back= up_2", "sync": "bitmap", "target": "backup_target_2"}} {"return": {}} -{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} -{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -482,7 +482,7 @@ qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fb= ackup2" =3D=3D> Identical, OK qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! =20 =20 -=3D=3D=3D Bitmap Sync Mode never without failure =3D=3D=3D +=3D=3D=3D Mode bitmap; Bitmap Sync never without failure =3D=3D=3D =20 --- Preparing image & VM --- =20 @@ -569,7 +569,7 @@ expecting 6 dirty sectors; have 6. OK! {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 ---- Bitmap Backup #1 --- +--- Test Backup #1 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -579,7 +579,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "bitm= ap_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "back= up_1", "sync": "bitmap", "target": "backup_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -630,10 +630,10 @@ expecting 6 dirty sectors; have 6. OK! =3D Checking Bitmap (anonymous) =3D expecting 7 dirty sectors; have 7. OK! =20 -{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_1"}} +{"execute": "job-finalize", "arguments": {"id": "backup_1"}} {"return": {}} -{"data": {"id": "bitmap_backup_1", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "bitmap_backup_1", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -696,7 +696,7 @@ expecting 15 dirty sectors; have 15. OK! {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 ---- Bitmap Backup #2 --- +--- Test Backup #2 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -706,12 +706,12 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "bitm= ap_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "back= up_2", "sync": "bitmap", "target": "backup_target_2"}} {"return": {}} -{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} -{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -748,7 +748,7 @@ qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fb= ackup2" =3D=3D> Identical, OK qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! =20 =20 -=3D=3D=3D Bitmap Sync Mode on-success with simulated failure =3D=3D=3D +=3D=3D=3D Mode bitmap; Bitmap Sync on-success with simulated failure =3D= =3D=3D =20 --- Preparing image & VM --- =20 @@ -835,7 +835,7 @@ expecting 6 dirty sectors; have 6. OK! {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 ---- Bitmap Backup #1 --- +--- Test Backup #1 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -845,7 +845,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "bitmap_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "bitmap", "target": "backup_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -896,10 +896,10 @@ expecting 6 dirty sectors; have 6. OK! =3D Checking Bitmap (anonymous) =3D expecting 7 dirty sectors; have 7. OK! =20 -{"execute": "job-cancel", "arguments": {"id": "bitmap_backup_1"}} +{"execute": "job-cancel", "arguments": {"id": "backup_1"}} {"return": {}} -{"data": {"id": "bitmap_backup_1", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "bitmap_backup_1", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -962,7 +962,7 @@ expecting 15 dirty sectors; have 15. OK! {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 ---- Bitmap Backup #2 --- +--- Test Backup #2 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -972,12 +972,12 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "bitmap_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} {"return": {}} -{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} -{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1014,7 +1014,7 @@ qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-= fbackup2" =3D=3D> Identical, OK qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! =20 =20 -=3D=3D=3D Bitmap Sync Mode on-success with intermediate failure =3D=3D=3D +=3D=3D=3D Mode bitmap; Bitmap Sync on-success with intermediate failure = =3D=3D=3D =20 --- Preparing image & VM --- =20 @@ -1103,7 +1103,7 @@ expecting 6 dirty sectors; have 6. OK! =20 {"return": ""} =20 ---- Bitmap Backup #1 --- +--- Test Backup #1 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -1113,10 +1113,10 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "bitmap_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "bitmap", "target": "backup_target_1"}} {"return": {}} -{"data": {"action": "report", "device": "bitmap_backup_1", "operation": "r= ead"}, "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "= seconds": "SECS"}} -{"data": {"device": "bitmap_backup_1", "error": "Input/output error", "len= ": 67108864, "offset": 66781184, "speed": 0, "type": "backup"}, "event": "B= LOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SEC= S"}} +{"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} +{"data": {"device": "backup_1", "error": "Input/output error", "len": 6710= 8864, "offset": 66781184, "speed": 0, "type": "backup"}, "event": "BLOCK_JO= B_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1179,7 +1179,7 @@ expecting 14 dirty sectors; have 14. OK! {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 ---- Bitmap Backup #2 --- +--- Test Backup #2 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -1189,12 +1189,12 @@ expecting 14 dirty sectors; have 14. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "bitmap_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} {"return": {}} -{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} -{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1231,7 +1231,7 @@ qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-= fbackup2" =3D=3D> Identical, OK qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! =20 =20 -=3D=3D=3D Bitmap Sync Mode on-success without failure =3D=3D=3D +=3D=3D=3D Mode bitmap; Bitmap Sync on-success without failure =3D=3D=3D =20 --- Preparing image & VM --- =20 @@ -1318,7 +1318,7 @@ expecting 6 dirty sectors; have 6. OK! {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 ---- Bitmap Backup #1 --- +--- Test Backup #1 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -1328,7 +1328,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "bitmap_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "bitmap", "target": "backup_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -1379,10 +1379,10 @@ expecting 6 dirty sectors; have 6. OK! =3D Checking Bitmap (anonymous) =3D expecting 7 dirty sectors; have 7. OK! =20 -{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_1"}} +{"execute": "job-finalize", "arguments": {"id": "backup_1"}} {"return": {}} -{"data": {"id": "bitmap_backup_1", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "bitmap_backup_1", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1445,7 +1445,7 @@ expecting 12 dirty sectors; have 12. OK! {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 ---- Bitmap Backup #2 --- +--- Test Backup #2 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -1455,12 +1455,12 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "bitmap_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} {"return": {}} -{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} -{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1497,7 +1497,7 @@ qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-= fbackup2" =3D=3D> Identical, OK qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! =20 =20 -=3D=3D=3D Bitmap Sync Mode always with simulated failure =3D=3D=3D +=3D=3D=3D Mode bitmap; Bitmap Sync always with simulated failure =3D=3D=3D =20 --- Preparing image & VM --- =20 @@ -1584,7 +1584,7 @@ expecting 6 dirty sectors; have 6. OK! {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 ---- Bitmap Backup #1 --- +--- Test Backup #1 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -1594,7 +1594,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bit= map_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "bitmap", "target": "backup_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -1645,10 +1645,10 @@ expecting 6 dirty sectors; have 6. OK! =3D Checking Bitmap (anonymous) =3D expecting 7 dirty sectors; have 7. OK! =20 -{"execute": "job-cancel", "arguments": {"id": "bitmap_backup_1"}} +{"execute": "job-cancel", "arguments": {"id": "backup_1"}} {"return": {}} -{"data": {"id": "bitmap_backup_1", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "bitmap_backup_1", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1711,7 +1711,7 @@ expecting 12 dirty sectors; have 12. OK! {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 ---- Bitmap Backup #2 --- +--- Test Backup #2 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -1721,12 +1721,12 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bit= map_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} {"return": {}} -{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} -{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1763,7 +1763,7 @@ qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-= fbackup2" =3D=3D> Identical, OK qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! =20 =20 -=3D=3D=3D Bitmap Sync Mode always with intermediate failure =3D=3D=3D +=3D=3D=3D Mode bitmap; Bitmap Sync always with intermediate failure =3D=3D= =3D =20 --- Preparing image & VM --- =20 @@ -1852,7 +1852,7 @@ expecting 6 dirty sectors; have 6. OK! =20 {"return": ""} =20 ---- Bitmap Backup #1 --- +--- Test Backup #1 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -1862,10 +1862,10 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bit= map_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "bitmap", "target": "backup_target_1"}} {"return": {}} -{"data": {"action": "report", "device": "bitmap_backup_1", "operation": "r= ead"}, "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "= seconds": "SECS"}} -{"data": {"device": "bitmap_backup_1", "error": "Input/output error", "len= ": 67108864, "offset": 66781184, "speed": 0, "type": "backup"}, "event": "B= LOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SEC= S"}} +{"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} +{"data": {"device": "backup_1", "error": "Input/output error", "len": 6710= 8864, "offset": 66781184, "speed": 0, "type": "backup"}, "event": "BLOCK_JO= B_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1928,7 +1928,7 @@ expecting 13 dirty sectors; have 13. OK! {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 ---- Bitmap Backup #2 --- +--- Test Backup #2 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -1938,12 +1938,12 @@ expecting 13 dirty sectors; have 13. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bit= map_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} {"return": {}} -{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} -{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1980,7 +1980,7 @@ qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-= fbackup2" =3D=3D> Identical, OK qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! =20 =20 -=3D=3D=3D Bitmap Sync Mode always without failure =3D=3D=3D +=3D=3D=3D Mode bitmap; Bitmap Sync always without failure =3D=3D=3D =20 --- Preparing image & VM --- =20 @@ -2067,7 +2067,7 @@ expecting 6 dirty sectors; have 6. OK! {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 ---- Bitmap Backup #1 --- +--- Test Backup #1 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -2077,7 +2077,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bit= map_backup_1", "sync": "bitmap", "target": "bitmap_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "bitmap", "target": "backup_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -2128,10 +2128,10 @@ expecting 6 dirty sectors; have 6. OK! =3D Checking Bitmap (anonymous) =3D expecting 7 dirty sectors; have 7. OK! =20 -{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_1"}} +{"execute": "job-finalize", "arguments": {"id": "backup_1"}} {"return": {}} -{"data": {"id": "bitmap_backup_1", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "bitmap_backup_1", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -2194,7 +2194,7 @@ expecting 12 dirty sectors; have 12. OK! {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 ---- Bitmap Backup #2 --- +--- Test Backup #2 --- =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} @@ -2204,12 +2204,12 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bit= map_backup_2", "sync": "bitmap", "target": "bitmap_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} {"return": {}} -{"execute": "job-finalize", "arguments": {"id": "bitmap_backup_2"}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} -{"data": {"id": "bitmap_backup_2", "type": "backup"}, "event": "BLOCK_JOB_= PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "bitmap_backup_2", "len": 67108864, "offset": 67108864= , "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp= ": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998217; cv=none; d=zoho.com; s=zohoarc; b=Jb++4zoy5ACoyuVjlx/v3ibIqD3IniKHjXd7snFsGTPoX/x54ibzfFlE6ykYSU+EBzwbQvxr8MVnVlI0XEN4iQUqTMcZBZO6TgXAwDXDqYYi/OeiVG+yECL0TlBn6nH/MbWffFDs3m/LWzy1+BZFdmOjJfkKqAABTsO7s7aOkdk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998217; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=KLS7AFyotZL3M+gmD5W6RvDP297lrei1fMovhYtQSQU=; b=JWwJcAehUmkVe7M6FfANhQFGqYqd6XF+pDH+c0zgIQDocxBlJk+wpFJ7cMEL4DWAXsWHBpEnNuB2RMUFKxLVF5XOxiaN5U+0YMVlznJ1JIq87Qki36PjrC7T2epEXXIR5B9Jfy1tO0VwTSPBq/MlJpwKDqrRVb+Ug+86aJW51tk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565998217490664.4150291123809; Fri, 16 Aug 2019 16:30:17 -0700 (PDT) Received: from localhost ([::1]:33270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylfj-00039W-FK for importer@patchew.org; Fri, 16 Aug 2019 19:30:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46824) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPr-0006k6-TO for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPq-00069f-NA for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60198) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPo-00065o-8E; Fri, 16 Aug 2019 19:13:48 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E7A12A41; Fri, 16 Aug 2019 23:13:46 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA8A719C6A; Fri, 16 Aug 2019 23:13:45 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:07 -0400 Message-Id: <20190816231318.8650-26-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 16 Aug 2019 23:13:46 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 25/36] block/backup: hoist bitmap check into QMP interface X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This is nicer to do in the unified QMP interface that we have now, because it lets us use the right terminology back at the user. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190716000117.25219-5-jsnow@redhat.com Signed-off-by: John Snow --- block/backup.c | 13 ++++--------- blockdev.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/block/backup.c b/block/backup.c index f8309be01b3..f704c83a98f 100644 --- a/block/backup.c +++ b/block/backup.c @@ -576,6 +576,10 @@ BlockJob *backup_job_create(const char *job_id, BlockD= riverState *bs, assert(bs); assert(target); =20 + /* QMP interface protects us from these cases */ + assert(sync_mode !=3D MIRROR_SYNC_MODE_INCREMENTAL); + assert(sync_bitmap || sync_mode !=3D MIRROR_SYNC_MODE_BITMAP); + if (bs =3D=3D target) { error_setg(errp, "Source and target cannot be the same"); return NULL; @@ -607,16 +611,7 @@ BlockJob *backup_job_create(const char *job_id, BlockD= riverState *bs, return NULL; } =20 - /* QMP interface should have handled translating this to bitmap mode */ - assert(sync_mode !=3D MIRROR_SYNC_MODE_INCREMENTAL); - if (sync_mode =3D=3D MIRROR_SYNC_MODE_BITMAP) { - if (!sync_bitmap) { - error_setg(errp, "must provide a valid bitmap name for " - "'%s' sync mode", MirrorSyncMode_str(sync_mode)); - return NULL; - } - /* If we need to write to this bitmap, check that we can: */ if (bitmap_mode !=3D BITMAP_SYNC_MODE_NEVER && bdrv_dirty_bitmap_check(sync_bitmap, BDRV_BITMAP_DEFAULT, errp= )) { diff --git a/blockdev.c b/blockdev.c index 210226d8290..f889da0b427 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3529,6 +3529,16 @@ static BlockJob *do_backup_common(BackupCommon *back= up, return NULL; } =20 + if ((backup->sync =3D=3D MIRROR_SYNC_MODE_BITMAP) || + (backup->sync =3D=3D MIRROR_SYNC_MODE_INCREMENTAL)) { + /* done before desugaring 'incremental' to print the right message= */ + if (!backup->has_bitmap) { + error_setg(errp, "must provide a valid bitmap name for " + "'%s' sync mode", MirrorSyncMode_str(backup->sync)); + return NULL; + } + } + if (backup->sync =3D=3D MIRROR_SYNC_MODE_INCREMENTAL) { if (backup->has_bitmap_mode && backup->bitmap_mode !=3D BITMAP_SYNC_MODE_ON_SUCCESS) { --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998507; cv=none; d=zoho.com; s=zohoarc; b=TPt/o4B82Sk4jCklCt7l3X2Uw88qKDinMSadcxK01m7kNtvA/haLh6mY+Kvle4m4zgtkZAhm6nTVcMqY4xS9O7ULxVP3Z3Yox9BV7IEmFPtvcyoHm8BX97yzSvCBhzJ3eDoiockxzaCui6765MLFkSrGZNGIBnGDZ3/Hwypru3E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998507; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=toRjF0UIVxTnO7w7srKvpISL6MYg3QncOTa77qpndYA=; b=Q5DcfYxx9S5b59UkFtHbmVLxcphaBGRYWU+Kn08N8SgrcjhEk7EKjMurSmkmJndD2NqITAJmMPCm/n8thUI7vJBNNMBFCZcVVK9Zws7/ku0Hfq1QS1CexWRHnutfitjRq+1wLk/iazuRb4WK1xkvi6PNepvbetUTAI2Fc7aVg8o= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565998507198170.57949934616101; Fri, 16 Aug 2019 16:35:07 -0700 (PDT) Received: from localhost ([::1]:33360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylkP-0000T5-LY for importer@patchew.org; Fri, 16 Aug 2019 19:35:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47112) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylQ0-000727-Jz for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPy-0006JD-Da for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51258) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPt-0006CC-9w; Fri, 16 Aug 2019 19:13:53 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5476C308427C; Fri, 16 Aug 2019 23:13:47 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id A120C19C6A; Fri, 16 Aug 2019 23:13:46 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:08 -0400 Message-Id: <20190816231318.8650-27-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 16 Aug 2019 23:13:47 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 26/36] iotests/257: test API failures X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190716000117.25219-6-jsnow@redhat.com Signed-off-by: John Snow --- tests/qemu-iotests/257 | 67 ++++++++++++++++++++++++++++++ tests/qemu-iotests/257.out | 85 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+) diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index aaa8f595043..53ab31c92e1 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -447,10 +447,77 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap= ', failure=3DNone): compare_images(img_path, fbackup2) log('') =20 +def test_backup_api(): + """ + Test malformed and prohibited invocations of the backup API. + """ + with iotests.FilePaths(['img', 'bsync1']) as \ + (img_path, backup_path), \ + iotests.VM() as vm: + + log("\n=3D=3D=3D API failure tests =3D=3D=3D\n") + log('--- Preparing image & VM ---\n') + drive0 =3D Drive(img_path, vm=3Dvm) + drive0.img_create(iotests.imgfmt, SIZE) + vm.add_device("{},id=3Dscsi0".format(iotests.get_virtio_scsi_devic= e())) + vm.launch() + + file_config =3D { + 'driver': 'file', + 'filename': drive0.path + } + + vm.qmp_log('blockdev-add', + filters=3D[iotests.filter_qmp_testfiles], + node_name=3D"drive0", + driver=3Ddrive0.fmt, + file=3Dfile_config) + drive0.node =3D 'drive0' + drive0.device =3D 'device0' + vm.qmp_log("device_add", id=3Ddrive0.device, + drive=3Ddrive0.name, driver=3D"scsi-hd") + log('') + + target0 =3D Drive(backup_path, vm=3Dvm) + target0.create_target("backup_target", drive0.fmt, drive0.size) + log('') + + vm.qmp_log("block-dirty-bitmap-add", node=3Ddrive0.name, + name=3D"bitmap0", granularity=3DGRANULARITY) + log('') + + log('-- Testing invalid QMP commands --\n') + + error_cases =3D { + 'incremental': { + None: ['on-success', 'always', 'never', None], + 'bitmap404': ['on-success', 'always', 'never', None], + 'bitmap0': ['always', 'never'] + }, + 'bitmap': { + None: ['on-success', 'always', 'never', None], + 'bitmap404': ['on-success', 'always', 'never', None], + 'bitmap0': [None], + }, + } + + # Dicts, as always, are not stably-ordered prior to 3.7, so use tu= ples: + for sync_mode in ('incremental', 'bitmap'): + log("-- Sync mode {:s} tests --\n".format(sync_mode)) + for bitmap in (None, 'bitmap404', 'bitmap0'): + for policy in error_cases[sync_mode][bitmap]: + blockdev_backup(drive0.vm, drive0.name, "backup_target= ", + sync_mode, job_id=3D'api_job', + bitmap=3Dbitmap, bitmap_mode=3Dpolicy) + log('') + + def main(): for bsync_mode in ("never", "on-success", "always"): for failure in ("simulated", "intermediate", None): test_bitmap_sync(bsync_mode, "bitmap", failure) =20 + test_backup_api() + if __name__ =3D=3D '__main__': iotests.script_main(main, supported_fmts=3D['qcow2']) diff --git a/tests/qemu-iotests/257.out b/tests/qemu-iotests/257.out index 0abc96acd36..43f2e0f9c99 100644 --- a/tests/qemu-iotests/257.out +++ b/tests/qemu-iotests/257.out @@ -2245,3 +2245,88 @@ qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID= -fbackup1" =3D=3D> Identical, OK qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! =20 + +=3D=3D=3D API failure tests =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0"}} +{"return": {}} + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +-- Testing invalid QMP commands -- + +-- Sync mode incremental tests -- + +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", = "device": "drive0", "job-id": "api_job", "sync": "incremental", "target": "= backup_target"}} +{"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'incremental' sync mode"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "dev= ice": "drive0", "job-id": "api_job", "sync": "incremental", "target": "back= up_target"}} +{"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'incremental' sync mode"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "devi= ce": "drive0", "job-id": "api_job", "sync": "incremental", "target": "backu= p_target"}} +{"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'incremental' sync mode"}} + +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "api_job", "sync": "incremental", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'incremental' sync mode"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "in= cremental", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "increm= ental", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be 'on-= success' when using sync mode 'incremental'"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "increme= ntal", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be 'on-= success' when using sync mode 'incremental'"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "devic= e": "drive0", "job-id": "api_job", "sync": "incremental", "target": "backup= _target"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "always", "device": "drive0", "job-id": "api_job", "sync": "incremen= tal", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be 'on-= success' when using sync mode 'incremental'"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "never", "device": "drive0", "job-id": "api_job", "sync": "increment= al", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be 'on-= success' when using sync mode 'incremental'"}} + +-- Sync mode bitmap tests -- + +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", = "device": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backu= p_target"}} +{"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'bitmap' sync mode"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "dev= ice": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_ta= rget"}} +{"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'bitmap' sync mode"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "devi= ce": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_tar= get"}} +{"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'bitmap' sync mode"}} + +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "api_job", "sync": "bitmap", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'bitmap' sync mode"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "bi= tmap", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "bitmap= ", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "bitmap"= , "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "devic= e": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_targ= et"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device"= : "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_target= "}} +{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be give= n when providing a bitmap"}} + --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998676; cv=none; d=zoho.com; s=zohoarc; b=WXvB6NSYJRMjMA7dy2w+YxFA/IX/6pZME723I9GZP2dggHkKEJ4FZBrXrvTkHBwygPz8VGXeO8jz7VNfrQlTILnr2vN40fh+hRyHyB8Dyd2KCYUqF5XFzt1ZjLHJvzEULg8fHpF17TsQSpgbBa+brp8IGqUyl8eCehVTVdHJbbg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998676; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=5OnM2JlU41yyUVXxffo+xC/ogCY6frq0x2uCC6PGync=; b=Yc/wOeHFtY6KAzlkWOVyEemoWet1hFuEjHuFJlejHYIUzwe2kY/LQldw0FFQuvazbYRoxDi1YeIwgiavxm33NRNHa+ospBEqe4VSeEk4HFNzrt4Y4T0Q9gkhEn9IRbH5yem0RrbZ1gv5kn8IalFU8xTVNgZKU6Gt703jZV3ve/o= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565998676409106.38902750898365; Fri, 16 Aug 2019 16:37:56 -0700 (PDT) Received: from localhost ([::1]:33388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyln3-0004A4-T5 for importer@patchew.org; Fri, 16 Aug 2019 19:37:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47106) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylQ0-00071q-Bs for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPx-0006IN-N6 for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43746) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPr-0006AX-TW; Fri, 16 Aug 2019 19:13:52 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 296B5C049E1A; Fri, 16 Aug 2019 23:13:48 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 76A5619C6A; Fri, 16 Aug 2019 23:13:47 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:09 -0400 Message-Id: <20190816231318.8650-28-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 16 Aug 2019 23:13:48 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 27/36] block/backup: improve sync=bitmap work estimates X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" When making backups based on bitmaps, the work estimate can be more accurate. Update iotests to reflect the new strategy. TOP work estimates are broken, but do not get worse with this commit. That issue is addressed in the following commits instead. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190716000117.25219-7-jsnow@redhat.com Signed-off-by: John Snow --- block/backup.c | 8 +++----- tests/qemu-iotests/256.out | 4 ++-- tests/qemu-iotests/257.out | 36 ++++++++++++++++++------------------ 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/block/backup.c b/block/backup.c index f704c83a98f..b04ab2d5f0c 100644 --- a/block/backup.c +++ b/block/backup.c @@ -459,9 +459,8 @@ static void backup_incremental_init_copy_bitmap(BackupB= lockJob *job) NULL, true); assert(ret); =20 - /* TODO job_progress_set_remaining() would make more sense */ - job_progress_update(&job->common.job, - job->len - bdrv_get_dirty_count(job->copy_bitmap)); + job_progress_set_remaining(&job->common.job, + bdrv_get_dirty_count(job->copy_bitmap)); } =20 static int coroutine_fn backup_run(Job *job, Error **errp) @@ -473,12 +472,11 @@ static int coroutine_fn backup_run(Job *job, Error **= errp) QLIST_INIT(&s->inflight_reqs); qemu_co_rwlock_init(&s->flush_rwlock); =20 - job_progress_set_remaining(job, s->len); - if (s->sync_mode =3D=3D MIRROR_SYNC_MODE_BITMAP) { backup_incremental_init_copy_bitmap(s); } else { bdrv_set_dirty_bitmap(s->copy_bitmap, 0, s->len); + job_progress_set_remaining(job, s->len); } =20 s->before_write.notify =3D backup_before_write_notify; diff --git a/tests/qemu-iotests/256.out b/tests/qemu-iotests/256.out index eec38614ec4..f18ecb0f912 100644 --- a/tests/qemu-iotests/256.out +++ b/tests/qemu-iotests/256.out @@ -113,7 +113,7 @@ { "return": {} } -{"data": {"device": "j2", "len": 67108864, "offset": 67108864, "speed": 0,= "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microsec= onds": "USECS", "seconds": "SECS"}} -{"data": {"device": "j3", "len": 67108864, "offset": 67108864, "speed": 0,= "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microsec= onds": "USECS", "seconds": "SECS"}} +{"data": {"device": "j2", "len": 0, "offset": 0, "speed": 0, "type": "back= up"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS"= , "seconds": "SECS"}} +{"data": {"device": "j3", "len": 0, "offset": 0, "speed": 0, "type": "back= up"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS"= , "seconds": "SECS"}} =20 --- Done --- diff --git a/tests/qemu-iotests/257.out b/tests/qemu-iotests/257.out index 43f2e0f9c99..811b1b11f19 100644 --- a/tests/qemu-iotests/257.out +++ b/tests/qemu-iotests/257.out @@ -150,7 +150,7 @@ expecting 7 dirty sectors; have 7. OK! {"execute": "job-cancel", "arguments": {"id": "backup_1"}} {"return": {}} {"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -228,7 +228,7 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} {"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 983040, "offset": 983040, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -367,7 +367,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "back= up_1", "sync": "bitmap", "target": "backup_target_1"}} {"return": {}} {"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} -{"data": {"device": "backup_1", "error": "Input/output error", "len": 6710= 8864, "offset": 66781184, "speed": 0, "type": "backup"}, "event": "BLOCK_JO= B_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "error": "Input/output error", "len": 3932= 16, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COM= PLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -445,7 +445,7 @@ expecting 14 dirty sectors; have 14. OK! {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} {"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 917504, "offset": 917504, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -633,7 +633,7 @@ expecting 7 dirty sectors; have 7. OK! {"execute": "job-finalize", "arguments": {"id": "backup_1"}} {"return": {}} {"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -711,7 +711,7 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} {"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 983040, "offset": 983040, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -899,7 +899,7 @@ expecting 7 dirty sectors; have 7. OK! {"execute": "job-cancel", "arguments": {"id": "backup_1"}} {"return": {}} {"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -977,7 +977,7 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} {"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 983040, "offset": 983040, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1116,7 +1116,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "bitmap", "target": "backup_target_1"}} {"return": {}} {"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} -{"data": {"device": "backup_1", "error": "Input/output error", "len": 6710= 8864, "offset": 66781184, "speed": 0, "type": "backup"}, "event": "BLOCK_JO= B_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "error": "Input/output error", "len": 3932= 16, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COM= PLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1194,7 +1194,7 @@ expecting 14 dirty sectors; have 14. OK! {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} {"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 917504, "offset": 917504, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1382,7 +1382,7 @@ expecting 7 dirty sectors; have 7. OK! {"execute": "job-finalize", "arguments": {"id": "backup_1"}} {"return": {}} {"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1460,7 +1460,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} {"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1648,7 +1648,7 @@ expecting 7 dirty sectors; have 7. OK! {"execute": "job-cancel", "arguments": {"id": "backup_1"}} {"return": {}} {"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1726,7 +1726,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} {"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1865,7 +1865,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "bitmap", "target": "backup_target_1"}} {"return": {}} {"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} -{"data": {"device": "backup_1", "error": "Input/output error", "len": 6710= 8864, "offset": 66781184, "speed": 0, "type": "backup"}, "event": "BLOCK_JO= B_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "error": "Input/output error", "len": 3932= 16, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COM= PLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -1943,7 +1943,7 @@ expecting 13 dirty sectors; have 13. OK! {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} {"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 851968, "offset": 851968, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -2131,7 +2131,7 @@ expecting 7 dirty sectors; have 7. OK! {"execute": "job-finalize", "arguments": {"id": "backup_1"}} {"return": {}} {"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ @@ -2209,7 +2209,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} {"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} -{"data": {"device": "backup_2", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { "device0": [ --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998756; cv=none; d=zoho.com; s=zohoarc; b=fP/X2Hu0XXYVw8Sy8UIRZLSnEVTdqY780Xb3pQomKNLn8YR8vFFDUawF+R9KfsuRQ7N9/nIi728fFbuhDq9OySvwTbIlg5uL5sNNShUnz6UXldWd/jQrYJkgcP2y+ol4Lye6LWCc5USs0h/q0yvBSZODtfHEft5JAJdXKzDaM9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998756; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=kkHmnsS4uEu3Fpm8ztwwfKFhX7eTf2XTWCzcVSRup5M=; b=E90JdcvCk2WDFyIuo/baoLOD5Dn1qV9Coj/hLPGqa5Gb+XcM7vLoS+5iiGZ+54SrUyzD4tsfiXB2ulD5sPbfBOUwIJ5d4ZThHm7CfqTzPysyQg/mSWM9I7anmpcYqFV+gLbbu5M3d1+DigXHgW/vnwfun3jCbFWZgjWdg8FjWwc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565998756480823.2317828870085; Fri, 16 Aug 2019 16:39:16 -0700 (PDT) Received: from localhost ([::1]:33406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyloN-00065V-Qe for importer@patchew.org; Fri, 16 Aug 2019 19:39:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46972) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPw-0006tA-23 for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPu-0006Fb-TN for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37370) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPs-0006Ag-1p; Fri, 16 Aug 2019 19:13:52 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 058CC882EA; Fri, 16 Aug 2019 23:13:49 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B44019C6A; Fri, 16 Aug 2019 23:13:48 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:10 -0400 Message-Id: <20190816231318.8650-29-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 16 Aug 2019 23:13:49 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 28/36] block/backup: centralize copy_bitmap initialization X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Just a few housekeeping changes that keeps the following commit easier to read; perform the initial copy_bitmap initialization in one place. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190716000117.25219-8-jsnow@redhat.com Signed-off-by: John Snow --- block/backup.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/block/backup.c b/block/backup.c index b04ab2d5f0c..305f9b3468b 100644 --- a/block/backup.c +++ b/block/backup.c @@ -451,16 +451,22 @@ static int coroutine_fn backup_loop(BackupBlockJob *j= ob) return ret; } =20 -/* init copy_bitmap from sync_bitmap */ -static void backup_incremental_init_copy_bitmap(BackupBlockJob *job) +static void backup_init_copy_bitmap(BackupBlockJob *job) { - bool ret =3D bdrv_dirty_bitmap_merge_internal(job->copy_bitmap, - job->sync_bitmap, - NULL, true); - assert(ret); + bool ret; + uint64_t estimate; =20 - job_progress_set_remaining(&job->common.job, - bdrv_get_dirty_count(job->copy_bitmap)); + if (job->sync_mode =3D=3D MIRROR_SYNC_MODE_BITMAP) { + ret =3D bdrv_dirty_bitmap_merge_internal(job->copy_bitmap, + job->sync_bitmap, + NULL, true); + assert(ret); + } else { + bdrv_set_dirty_bitmap(job->copy_bitmap, 0, job->len); + } + + estimate =3D bdrv_get_dirty_count(job->copy_bitmap); + job_progress_set_remaining(&job->common.job, estimate); } =20 static int coroutine_fn backup_run(Job *job, Error **errp) @@ -472,12 +478,7 @@ static int coroutine_fn backup_run(Job *job, Error **e= rrp) QLIST_INIT(&s->inflight_reqs); qemu_co_rwlock_init(&s->flush_rwlock); =20 - if (s->sync_mode =3D=3D MIRROR_SYNC_MODE_BITMAP) { - backup_incremental_init_copy_bitmap(s); - } else { - bdrv_set_dirty_bitmap(s->copy_bitmap, 0, s->len); - job_progress_set_remaining(job, s->len); - } + backup_init_copy_bitmap(s); =20 s->before_write.notify =3D backup_before_write_notify; bdrv_add_before_write_notifier(bs, &s->before_write); --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998782; cv=none; d=zoho.com; s=zohoarc; b=F2O5H74++R89U67GbvTETHxVTJEGGQXaP3lD8PqTM8WqvwXtX4vjsHNgbdDW6XuKhq3aq/+8l169gSMYEbeai8h13041GxgvCzBGGFBpGD8RMaoLgmwGer2fqVbiK8/EpStbtA0WcF1VdDGZzlN1uUp3tUaM+xe6kUNiXDlQ6cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998782; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=PdKjcmcPFNngjGKGgFStBODddxERAMemDA2Z9WmvE/M=; b=C4NN/TXZiwp2F+tBefBYBrvkqcKjahB6YGP3+bksxHKm04reS3HoMSnJQLft83h/v8x3oFeH1zMdfli0FsCvUnykYfslWXMZinWcVhpdwvLmaocT9SbeBodr4sUPhE4aZYGMlNb3Es8WYdWurbOjEBN4OtTPCHR4KeJMd90zl9I= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565998782099344.5544335120999; Fri, 16 Aug 2019 16:39:42 -0700 (PDT) Received: from localhost ([::1]:33408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyloi-0006MQ-UI for importer@patchew.org; Fri, 16 Aug 2019 19:39:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46954) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPv-0006sN-Iz for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPu-0006EH-3t for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55642) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPq-00068s-FJ; Fri, 16 Aug 2019 19:13:50 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C82D230833B0; Fri, 16 Aug 2019 23:13:49 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2101519C6A; Fri, 16 Aug 2019 23:13:49 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:11 -0400 Message-Id: <20190816231318.8650-30-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 16 Aug 2019 23:13:49 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 29/36] block/backup: add backup_is_cluster_allocated X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Modify bdrv_is_unallocated_range to utilize the pnum return from bdrv_is_allocated, and in the process change the semantics from "is unallocated" to "is allocated." Optionally returns a full number of clusters that share the same allocation status. This will be used to carefully toggle bits in the bitmap for sync=3Dtop initialization in the following commits. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190716000117.25219-9-jsnow@redhat.com Signed-off-by: John Snow --- block/backup.c | 62 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/block/backup.c b/block/backup.c index 305f9b3468b..f6bf32c9438 100644 --- a/block/backup.c +++ b/block/backup.c @@ -185,6 +185,48 @@ static int coroutine_fn backup_cow_with_offload(Backup= BlockJob *job, return nbytes; } =20 +/* + * Check if the cluster starting at offset is allocated or not. + * return via pnum the number of contiguous clusters sharing this allocati= on. + */ +static int backup_is_cluster_allocated(BackupBlockJob *s, int64_t offset, + int64_t *pnum) +{ + BlockDriverState *bs =3D blk_bs(s->common.blk); + int64_t count, total_count =3D 0; + int64_t bytes =3D s->len - offset; + int ret; + + assert(QEMU_IS_ALIGNED(offset, s->cluster_size)); + + while (true) { + ret =3D bdrv_is_allocated(bs, offset, bytes, &count); + if (ret < 0) { + return ret; + } + + total_count +=3D count; + + if (ret || count =3D=3D 0) { + /* + * ret: partial segment(s) are considered allocated. + * otherwise: unallocated tail is treated as an entire segment. + */ + *pnum =3D DIV_ROUND_UP(total_count, s->cluster_size); + return ret; + } + + /* Unallocated segment(s) with uncertain following segment(s) */ + if (total_count >=3D s->cluster_size) { + *pnum =3D total_count / s->cluster_size; + return 0; + } + + offset +=3D count; + bytes -=3D count; + } +} + static int coroutine_fn backup_do_cow(BackupBlockJob *job, int64_t offset, uint64_t bytes, bool *error_is_read, @@ -398,34 +440,18 @@ static bool coroutine_fn yield_and_check(BackupBlockJ= ob *job) return false; } =20 -static bool bdrv_is_unallocated_range(BlockDriverState *bs, - int64_t offset, int64_t bytes) -{ - int64_t end =3D offset + bytes; - - while (offset < end && !bdrv_is_allocated(bs, offset, bytes, &bytes)) { - if (bytes =3D=3D 0) { - return true; - } - offset +=3D bytes; - bytes =3D end - offset; - } - - return offset >=3D end; -} - static int coroutine_fn backup_loop(BackupBlockJob *job) { bool error_is_read; int64_t offset; BdrvDirtyBitmapIter *bdbi; - BlockDriverState *bs =3D blk_bs(job->common.blk); int ret =3D 0; + int64_t dummy; =20 bdbi =3D bdrv_dirty_iter_new(job->copy_bitmap); while ((offset =3D bdrv_dirty_iter_next(bdbi)) !=3D -1) { if (job->sync_mode =3D=3D MIRROR_SYNC_MODE_TOP && - bdrv_is_unallocated_range(bs, offset, job->cluster_size)) + !backup_is_cluster_allocated(job, offset, &dummy)) { bdrv_reset_dirty_bitmap(job->copy_bitmap, offset, job->cluster_size); --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998476; cv=none; d=zoho.com; s=zohoarc; b=IqmipiKBkQ+BSb+VGBURW86wTuXnFRsH3+6uz7BDdjQYQwaGKmm4yrm37F0AQkPGmV9CWOPlGUMd+5h9LXFaA8zPdeBxok2AV5igWLW6KV6DelO82meuOpZScAzy/xxeDYvP2Ltu4MKbgKVf2L3myQjEf3NlBifcLtWUTfyaV3M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998476; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=/RpIbl/cBrQHQPvAJGsfdo1o3Y7Z9WAsRFI28dclJLQ=; b=LGxo3fm+e7MvkgSyAGQRel3baXJCEJALgd1/jbaUXaT5hB+74QMR271dm5vaFxin84HSBKOeveSiym109Z3AmL43SxulpnruUHeRkn4kY+AukBiuc+PQn+IVgo5YU5EzTIH4LVlBdFWFLnzeuyIO5Sdwy51/oLe3lMWVeToGAvE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565998476331366.59871326641803; Fri, 16 Aug 2019 16:34:36 -0700 (PDT) Received: from localhost ([::1]:33338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hyljr-0007wt-FH for importer@patchew.org; Fri, 16 Aug 2019 19:34:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47051) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylPy-0006xh-JO for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPw-0006HW-RK for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:13:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37242) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPs-0006Aw-Dw; Fri, 16 Aug 2019 19:13:52 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E8C6190C022; Fri, 16 Aug 2019 23:13:50 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBB0119C6A; Fri, 16 Aug 2019 23:13:49 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:12 -0400 Message-Id: <20190816231318.8650-31-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.70]); Fri, 16 Aug 2019 23:13:50 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 30/36] block/backup: teach TOP to never copy unallocated regions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Presently, If sync=3DTOP is selected, we mark the entire bitmap as dirty. In the write notifier handler, we dutifully copy out such regions. Fix this in three parts: 1. Mark the bitmap as being initialized before the first yield. 2. After the first yield but before the backup loop, interrogate the allocation status asynchronously and initialize the bitmap. 3. Teach the write notifier to interrogate allocation status if it is invoked during bitmap initialization. As an effect of this patch, the job progress for TOP backups now behaves like this: - total progress starts at bdrv_length. - As allocation status is interrogated, total progress decreases. - As blocks are copied, current progress increases. Taken together, the floor and ceiling move to meet each other. Signed-off-by: John Snow Message-id: 20190716000117.25219-10-jsnow@redhat.com [Remove ret =3D -ECANCELED change. --js] [Squash in conflict resolution based on Max's patch --js] Message-id: c8b0ab36-79c8-0b4b-3193-4e12ed8c848b@redhat.com Reviewed-by: Max Reitz Signed-off-by: John Snow --- block/backup.c | 79 ++++++++++++++++++++++++++++++++++++++++------ block/trace-events | 1 + 2 files changed, 71 insertions(+), 9 deletions(-) diff --git a/block/backup.c b/block/backup.c index f6bf32c9438..9e1382ec5c6 100644 --- a/block/backup.c +++ b/block/backup.c @@ -58,6 +58,7 @@ typedef struct BackupBlockJob { int64_t copy_range_size; =20 bool serialize_target_writes; + bool initializing_bitmap; } BackupBlockJob; =20 static const BlockJobDriver backup_job_driver; @@ -227,6 +228,35 @@ static int backup_is_cluster_allocated(BackupBlockJob = *s, int64_t offset, } } =20 +/** + * Reset bits in copy_bitmap starting at offset if they represent unalloca= ted + * data in the image. May reset subsequent contiguous bits. + * @return 0 when the cluster at @offset was unallocated, + * 1 otherwise, and -ret on error. + */ +static int64_t backup_bitmap_reset_unallocated(BackupBlockJob *s, + int64_t offset, int64_t *co= unt) +{ + int ret; + int64_t clusters, bytes, estimate; + + ret =3D backup_is_cluster_allocated(s, offset, &clusters); + if (ret < 0) { + return ret; + } + + bytes =3D clusters * s->cluster_size; + + if (!ret) { + bdrv_reset_dirty_bitmap(s->copy_bitmap, offset, bytes); + estimate =3D bdrv_get_dirty_count(s->copy_bitmap); + job_progress_set_remaining(&s->common.job, estimate); + } + + *count =3D bytes; + return ret; +} + static int coroutine_fn backup_do_cow(BackupBlockJob *job, int64_t offset, uint64_t bytes, bool *error_is_read, @@ -236,6 +266,7 @@ static int coroutine_fn backup_do_cow(BackupBlockJob *j= ob, int ret =3D 0; int64_t start, end; /* bytes */ void *bounce_buffer =3D NULL; + int64_t status_bytes; =20 qemu_co_rwlock_rdlock(&job->flush_rwlock); =20 @@ -262,6 +293,17 @@ static int coroutine_fn backup_do_cow(BackupBlockJob *= job, dirty_end =3D end; } =20 + if (job->initializing_bitmap) { + ret =3D backup_bitmap_reset_unallocated(job, start, &status_by= tes); + if (ret =3D=3D 0) { + trace_backup_do_cow_skip_range(job, start, status_bytes); + start +=3D status_bytes; + continue; + } + /* Clamp to known allocated region */ + dirty_end =3D MIN(dirty_end, start + status_bytes); + } + trace_backup_do_cow_process(job, start); =20 if (job->use_copy_range) { @@ -446,18 +488,9 @@ static int coroutine_fn backup_loop(BackupBlockJob *jo= b) int64_t offset; BdrvDirtyBitmapIter *bdbi; int ret =3D 0; - int64_t dummy; =20 bdbi =3D bdrv_dirty_iter_new(job->copy_bitmap); while ((offset =3D bdrv_dirty_iter_next(bdbi)) !=3D -1) { - if (job->sync_mode =3D=3D MIRROR_SYNC_MODE_TOP && - !backup_is_cluster_allocated(job, offset, &dummy)) - { - bdrv_reset_dirty_bitmap(job->copy_bitmap, offset, - job->cluster_size); - continue; - } - do { if (yield_and_check(job)) { goto out; @@ -488,6 +521,13 @@ static void backup_init_copy_bitmap(BackupBlockJob *jo= b) NULL, true); assert(ret); } else { + if (job->sync_mode =3D=3D MIRROR_SYNC_MODE_TOP) { + /* + * We can't hog the coroutine to initialize this thoroughly. + * Set a flag and resume work when we are able to yield safely. + */ + job->initializing_bitmap =3D true; + } bdrv_set_dirty_bitmap(job->copy_bitmap, 0, job->len); } =20 @@ -509,6 +549,26 @@ static int coroutine_fn backup_run(Job *job, Error **e= rrp) s->before_write.notify =3D backup_before_write_notify; bdrv_add_before_write_notifier(bs, &s->before_write); =20 + if (s->sync_mode =3D=3D MIRROR_SYNC_MODE_TOP) { + int64_t offset =3D 0; + int64_t count; + + for (offset =3D 0; offset < s->len; ) { + if (yield_and_check(s)) { + ret =3D -ECANCELED; + goto out; + } + + ret =3D backup_bitmap_reset_unallocated(s, offset, &count); + if (ret < 0) { + goto out; + } + + offset +=3D count; + } + s->initializing_bitmap =3D false; + } + if (s->sync_mode =3D=3D MIRROR_SYNC_MODE_NONE) { /* All bits are set in copy_bitmap to allow any cluster to be copi= ed. * This does not actually require them to be copied. */ @@ -521,6 +581,7 @@ static int coroutine_fn backup_run(Job *job, Error **er= rp) ret =3D backup_loop(s); } =20 + out: notifier_with_return_remove(&s->before_write); =20 /* wait until pending backup_do_cow() calls have completed */ diff --git a/block/trace-events b/block/trace-events index d724df0117d..04209f058d4 100644 --- a/block/trace-events +++ b/block/trace-events @@ -41,6 +41,7 @@ mirror_yield_in_flight(void *s, int64_t offset, int in_fl= ight) "s %p offset %" P backup_do_cow_enter(void *job, int64_t start, int64_t offset, uint64_t byt= es) "job %p start %" PRId64 " offset %" PRId64 " bytes %" PRIu64 backup_do_cow_return(void *job, int64_t offset, uint64_t bytes, int ret) "= job %p offset %" PRId64 " bytes %" PRIu64 " ret %d" backup_do_cow_skip(void *job, int64_t start) "job %p start %"PRId64 +backup_do_cow_skip_range(void *job, int64_t start, uint64_t bytes) "job %p= start %"PRId64" bytes %"PRId64 backup_do_cow_process(void *job, int64_t start) "job %p start %"PRId64 backup_do_cow_read_fail(void *job, int64_t start, int ret) "job %p start %= "PRId64" ret %d" backup_do_cow_write_fail(void *job, int64_t start, int ret) "job %p start = %"PRId64" ret %d" --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565999040; cv=none; d=zoho.com; s=zohoarc; b=Bkpfxhfzu/eJhH3yvcwuQkEsLOSS+V9DZqOKf+U5f3yHP9zMfYG7MjRNhK8IGg9CyhIAqh/0S3OWiMTbZONb5ldy/e7lCtIsVk7qqmkMMcb6uXqDO6hjhxB21OZT8RGpK8dIW7/QklcDGhJPvt2loruVlqxlEHG70/apBN7eioY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565999040; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ni8bOjxS+fY2sOrA5t7v4mjcV+oFLWiVPFXsDnKmh18=; b=jX6GkLR4x4ljqsoFxGlZZAx2C83oNny2CyPt/9yUmItE7WZEKH9LxzlYPKgT8wcj0YHJN53qsnt7xjA+Ucun7slrbO+x6ZBv9P41phVlmSmVijVcVP3YHp7zfRNErg6fGY2sS82FF+LC60nzjYK+mqSQR/w4PX+GK+maNxicmw8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565999040364400.80528075785276; Fri, 16 Aug 2019 16:44:00 -0700 (PDT) Received: from localhost ([::1]:33478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylsy-0003bp-57 for importer@patchew.org; Fri, 16 Aug 2019 19:43:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47238) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylQ4-00078e-9g for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylQ2-0006OK-Nw for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38642) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPz-0006Jq-7c; Fri, 16 Aug 2019 19:13:59 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 73FE8796FF; Fri, 16 Aug 2019 23:13:51 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id C15A119C6A; Fri, 16 Aug 2019 23:13:50 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:13 -0400 Message-Id: <20190816231318.8650-32-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 16 Aug 2019 23:13:51 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 31/36] block/backup: support bitmap sync modes for non-bitmap backups X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Accept bitmaps and sync policies for the other backup modes. This allows us to do things like create a bitmap synced to a full backup without a transaction, or start a resumable backup process. Some combinations don't make sense, though: - NEVER policy combined with any non-BITMAP mode doesn't do anything, because the bitmap isn't used for input or output. It's harmless, but is almost certainly never what the user wanted. - sync=3DNONE is more questionable. It can't use on-success because this job never completes with success anyway, and the resulting artifact of 'always' is suspect: because we start with a full bitmap and only copy out segments that get written to, the final output bitmap will always be ... a fully set bitmap. Maybe there's contexts in which bitmaps make sense for sync=3Dnone, but not without more severe changes to the current job, and omitting it here doesn't prevent us from adding it later. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190716000117.25219-11-jsnow@redhat.com Signed-off-by: John Snow --- block/backup.c | 8 +------- blockdev.c | 22 ++++++++++++++++++++++ qapi/block-core.json | 6 ++++-- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/block/backup.c b/block/backup.c index 9e1382ec5c6..a9be07258c1 100644 --- a/block/backup.c +++ b/block/backup.c @@ -697,7 +697,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDr= iverState *bs, return NULL; } =20 - if (sync_mode =3D=3D MIRROR_SYNC_MODE_BITMAP) { + if (sync_bitmap) { /* If we need to write to this bitmap, check that we can: */ if (bitmap_mode !=3D BITMAP_SYNC_MODE_NEVER && bdrv_dirty_bitmap_check(sync_bitmap, BDRV_BITMAP_DEFAULT, errp= )) { @@ -708,12 +708,6 @@ BlockJob *backup_job_create(const char *job_id, BlockD= riverState *bs, if (bdrv_dirty_bitmap_create_successor(bs, sync_bitmap, errp) < 0)= { return NULL; } - } else if (sync_bitmap) { - error_setg(errp, - "a bitmap was given to backup_job_create, " - "but it received an incompatible sync_mode (%s)", - MirrorSyncMode_str(sync_mode)); - return NULL; } =20 len =3D bdrv_getlength(bs); diff --git a/blockdev.c b/blockdev.c index f889da0b427..64d06d1f672 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3567,6 +3567,28 @@ static BlockJob *do_backup_common(BackupCommon *back= up, if (bdrv_dirty_bitmap_check(bmap, BDRV_BITMAP_ALLOW_RO, errp)) { return NULL; } + + /* This does not produce a useful bitmap artifact: */ + if (backup->sync =3D=3D MIRROR_SYNC_MODE_NONE) { + error_setg(errp, "sync mode '%s' does not produce meaningful b= itmap" + " outputs", MirrorSyncMode_str(backup->sync)); + return NULL; + } + + /* If the bitmap isn't used for input or output, this is useless: = */ + if (backup->bitmap_mode =3D=3D BITMAP_SYNC_MODE_NEVER && + backup->sync !=3D MIRROR_SYNC_MODE_BITMAP) { + error_setg(errp, "Bitmap sync mode '%s' has no meaningful effe= ct" + " when combined with sync mode '%s'", + BitmapSyncMode_str(backup->bitmap_mode), + MirrorSyncMode_str(backup->sync)); + return NULL; + } + } + + if (!backup->has_bitmap && backup->has_bitmap_mode) { + error_setg(errp, "Cannot specify bitmap sync mode without a bitmap= "); + return NULL; } =20 if (!backup->auto_finalize) { diff --git a/qapi/block-core.json b/qapi/block-core.json index 8344fbe2030..d72cf5f354b 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1352,13 +1352,15 @@ # @speed: the maximum speed, in bytes per second. The default is 0, # for unlimited. # -# @bitmap: the name of a dirty bitmap if sync is "bitmap" or "incremental". +# @bitmap: The name of a dirty bitmap to use. # Must be present if sync is "bitmap" or "incremental". +# Can be present if sync is "full" or "top". # Must not be present otherwise. # (Since 2.4 (drive-backup), 3.1 (blockdev-backup)) # # @bitmap-mode: Specifies the type of data the bitmap should contain after -# the operation concludes. Must be present if sync is "bitma= p". +# the operation concludes. +# Must be present if a bitmap was provided, # Must NOT be present otherwise. (Since 4.2) # # @compress: true to compress data, if the target format supports it. --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565999282; cv=none; d=zoho.com; s=zohoarc; b=EeSDQrGmSdKetjYCj75B1RwSYPpdHotJwNki896z6ePpS0yLf9P3hVcN2U61fwG+xlbjm+cLcdQwy+CEFE4bJPkSJPuqtVvuD+1ePHO1DVa9OtjfW+ugSFpQJO2eYoHdogpxq1plpBwtrhRk0KCJX0FCmHXDveYAtuJK8Gkvv1U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565999282; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Wy1MZyuZftnKJ8nB8rpQrwEDC9XAMj2aLr0ncFIeD/8=; b=F9r4T1npR7NIxYwg+UZjsuncHBXiX4tynBTj01msPO6D+i8gRhdJFMyK8I+PXGlsGFR/WoeYfzUETYE6HWgiGimESf7c9YeU3FZ02pem/r0I8gGZ+GCL0kdz17XwrrEBeCNBcg4QUErhtQRcbog9tyN7hCpi+qptsjtbmsg8KRo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565999282721369.00185019635205; Fri, 16 Aug 2019 16:48:02 -0700 (PDT) Received: from localhost ([::1]:33530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylwv-0000HN-CK for importer@patchew.org; Fri, 16 Aug 2019 19:48:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47400) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylQK-0007a9-T9 for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylQC-0006Yb-Nk for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51482) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPt-0006C4-76; Fri, 16 Aug 2019 19:13:53 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6116F1028BDB; Fri, 16 Aug 2019 23:13:52 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 99AA219C6A; Fri, 16 Aug 2019 23:13:51 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:14 -0400 Message-Id: <20190816231318.8650-33-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Fri, 16 Aug 2019 23:13:52 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 32/36] iotests/257: test traditional sync modes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20190716000117.25219-12-jsnow@redhat.com [Edit 'Bitmap' --> 'bitmap' in 257.out --js] Signed-off-by: John Snow --- tests/qemu-iotests/257 | 41 +- tests/qemu-iotests/257.out | 3089 ++++++++++++++++++++++++++++++++++++ 2 files changed, 3128 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index 53ab31c92e1..c2a72c577aa 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -283,6 +283,12 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap'= , failure=3DNone): Bitmaps are always synchronized, regardless of failu= re. (Partial images must be kept.) =20 + :param msync_mode: The mirror sync mode to use for the first backup. + Can be any one of: + - bitmap: Backups based on bitmap manifest. + - full: Full backups. + - top: Full backups of the top layer only. + :param failure: Is the (optional) failure mode, and can be any of: - None: No failure. Test the normative path. Default. - simulated: Cancel the job right before it completes. @@ -393,7 +399,7 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap',= failure=3DNone): # group 1 gets cleared first, then group two gets written. if ((bsync_mode =3D=3D 'on-success' and not failure) or (bsync_mode =3D=3D 'always')): - ebitmap.clear_group(1) + ebitmap.clear() ebitmap.dirty_group(2) =20 vm.run_job(job, auto_dismiss=3DTrue, auto_finalize=3DFalse, @@ -404,8 +410,19 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap'= , failure=3DNone): log('') =20 if bsync_mode =3D=3D 'always' and failure =3D=3D 'intermediate': + # TOP treats anything allocated as dirty, expect to see: + if msync_mode =3D=3D 'top': + ebitmap.dirty_group(0) + # We manage to copy one sector (one bit) before the error. ebitmap.clear_bit(ebitmap.first_bit) + + # Full returns all bits set except what was copied/skipped + if msync_mode =3D=3D 'full': + fail_bit =3D ebitmap.first_bit + ebitmap.clear() + ebitmap.dirty_bits(range(fail_bit, SIZE // GRANULARITY)) + ebitmap.compare(get_bitmap(bitmaps, drive0.device, 'bitmap0')) =20 # 2 - Writes and Reference Backup @@ -499,10 +516,25 @@ def test_backup_api(): 'bitmap404': ['on-success', 'always', 'never', None], 'bitmap0': [None], }, + 'full': { + None: ['on-success', 'always', 'never'], + 'bitmap404': ['on-success', 'always', 'never', None], + 'bitmap0': ['never', None], + }, + 'top': { + None: ['on-success', 'always', 'never'], + 'bitmap404': ['on-success', 'always', 'never', None], + 'bitmap0': ['never', None], + }, + 'none': { + None: ['on-success', 'always', 'never'], + 'bitmap404': ['on-success', 'always', 'never', None], + 'bitmap0': ['on-success', 'always', 'never', None], + } } =20 # Dicts, as always, are not stably-ordered prior to 3.7, so use tu= ples: - for sync_mode in ('incremental', 'bitmap'): + for sync_mode in ('incremental', 'bitmap', 'full', 'top', 'none'): log("-- Sync mode {:s} tests --\n".format(sync_mode)) for bitmap in (None, 'bitmap404', 'bitmap0'): for policy in error_cases[sync_mode][bitmap]: @@ -517,6 +549,11 @@ def main(): for failure in ("simulated", "intermediate", None): test_bitmap_sync(bsync_mode, "bitmap", failure) =20 + for sync_mode in ('full', 'top'): + for bsync_mode in ('on-success', 'always'): + for failure in ('simulated', 'intermediate', None): + test_bitmap_sync(bsync_mode, sync_mode, failure) + test_backup_api() =20 if __name__ =3D=3D '__main__': diff --git a/tests/qemu-iotests/257.out b/tests/qemu-iotests/257.out index 811b1b11f19..84b79d7bfe9 100644 --- a/tests/qemu-iotests/257.out +++ b/tests/qemu-iotests/257.out @@ -2246,6 +2246,3002 @@ qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/P= ID-fbackup2" =3D=3D> Identical, OK qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! =20 =20 +=3D=3D=3D Mode full; Bitmap Sync on-success with simulated failure =3D=3D= =3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "full", "target": "backup_target_1"}} +{"return": {}} + +--- Write #2 --- + +write -P0x74 0x0010000 0x10000 +{"return": ""} +write -P0x69 0x00e8000 0x10000 +{"return": ""} +write -P0x6e 0x2018000 0x10000 +{"return": ""} +write -P0x67 0x3fe0000 0x20000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "persistent": false, + "recording": false, + "status": "disabled" + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": true, + "status": "active" + }, + { + "busy": true, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "frozen" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +=3D Checking Bitmap (anonymous) =3D +expecting 7 dirty sectors; have 7. OK! + +{"execute": "job-cancel", "arguments": {"id": "backup_1"}} +{"return": {}} +{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 655360, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 10 dirty sectors; have 10. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 983040, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 15 dirty sectors; have 15. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} +{"return": {}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 983040, "offset": 983040, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Mode full; Bitmap Sync on-success with intermediate failure =3D= =3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img= "}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false= , "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new= -state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]= }, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +{"return": ""} + +--- Test Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "full", "target": "backup_target_1"}} +{"return": {}} +{"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} +{"data": {"device": "backup_1", "error": "Input/output error", "len": 6710= 8864, "offset": 983040, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_= COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 917504, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 14 dirty sectors; have 14. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} +{"return": {}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 917504, "offset": 917504, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Mis= match, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Mode full; Bitmap Sync on-success without failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "full", "target": "backup_target_1"}} +{"return": {}} + +--- Write #2 --- + +write -P0x74 0x0010000 0x10000 +{"return": ""} +write -P0x69 0x00e8000 0x10000 +{"return": ""} +write -P0x6e 0x2018000 0x10000 +{"return": ""} +write -P0x67 0x3fe0000 0x20000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "persistent": false, + "recording": false, + "status": "disabled" + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": true, + "status": "active" + }, + { + "busy": true, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "frozen" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +=3D Checking Bitmap (anonymous) =3D +expecting 7 dirty sectors; have 7. OK! + +{"execute": "job-finalize", "arguments": {"id": "backup_1"}} +{"return": {}} +{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 458752, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 7 dirty sectors; have 7. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 786432, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 12 dirty sectors; have 12. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} +{"return": {}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Mode full; Bitmap Sync always with simulated failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "full", "target": "backup_target_1"}} +{"return": {}} + +--- Write #2 --- + +write -P0x74 0x0010000 0x10000 +{"return": ""} +write -P0x69 0x00e8000 0x10000 +{"return": ""} +write -P0x6e 0x2018000 0x10000 +{"return": ""} +write -P0x67 0x3fe0000 0x20000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "persistent": false, + "recording": false, + "status": "disabled" + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": true, + "status": "active" + }, + { + "busy": true, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "frozen" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +=3D Checking Bitmap (anonymous) =3D +expecting 7 dirty sectors; have 7. OK! + +{"execute": "job-cancel", "arguments": {"id": "backup_1"}} +{"return": {}} +{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 458752, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 7 dirty sectors; have 7. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 786432, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 12 dirty sectors; have 12. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} +{"return": {}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Mode full; Bitmap Sync always with intermediate failure =3D=3D= =3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img= "}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false= , "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new= -state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]= }, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +{"return": ""} + +--- Test Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "full", "target": "backup_target_1"}} +{"return": {}} +{"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} +{"data": {"device": "backup_1", "error": "Input/output error", "len": 6710= 8864, "offset": 983040, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_= COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 66125824, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 1009 dirty sectors; have 1009. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 66453504, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 1014 dirty sectors; have 1014. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} +{"return": {}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 66453504, "offset": 66453504, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Mis= match, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Mode full; Bitmap Sync always without failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "full", "target": "backup_target_1"}} +{"return": {}} + +--- Write #2 --- + +write -P0x74 0x0010000 0x10000 +{"return": ""} +write -P0x69 0x00e8000 0x10000 +{"return": ""} +write -P0x6e 0x2018000 0x10000 +{"return": ""} +write -P0x67 0x3fe0000 0x20000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "persistent": false, + "recording": false, + "status": "disabled" + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": true, + "status": "active" + }, + { + "busy": true, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "frozen" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +=3D Checking Bitmap (anonymous) =3D +expecting 7 dirty sectors; have 7. OK! + +{"execute": "job-finalize", "arguments": {"id": "backup_1"}} +{"return": {}} +{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 458752, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 7 dirty sectors; have 7. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 786432, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 12 dirty sectors; have 12. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} +{"return": {}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Mode top; Bitmap Sync on-success with simulated failure =3D=3D= =3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "top", "target": "backup_target_1"}} +{"return": {}} + +--- Write #2 --- + +write -P0x74 0x0010000 0x10000 +{"return": ""} +write -P0x69 0x00e8000 0x10000 +{"return": ""} +write -P0x6e 0x2018000 0x10000 +{"return": ""} +write -P0x67 0x3fe0000 0x20000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "persistent": false, + "recording": false, + "status": "disabled" + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": true, + "status": "active" + }, + { + "busy": true, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "frozen" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +=3D Checking Bitmap (anonymous) =3D +expecting 7 dirty sectors; have 7. OK! + +{"execute": "job-cancel", "arguments": {"id": "backup_1"}} +{"return": {}} +{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 458752, "offset": 458752, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 655360, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 10 dirty sectors; have 10. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 983040, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 15 dirty sectors; have 15. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} +{"return": {}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 983040, "offset": 983040, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Mode top; Bitmap Sync on-success with intermediate failure =3D= =3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img= "}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false= , "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new= -state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]= }, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +{"return": ""} + +--- Test Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "top", "target": "backup_target_1"}} +{"return": {}} +{"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} +{"data": {"device": "backup_1", "error": "Input/output error", "len": 4587= 52, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COM= PLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 917504, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 14 dirty sectors; have 14. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} +{"return": {}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 917504, "offset": 917504, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Mis= match, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Mode top; Bitmap Sync on-success without failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "top", "target": "backup_target_1"}} +{"return": {}} + +--- Write #2 --- + +write -P0x74 0x0010000 0x10000 +{"return": ""} +write -P0x69 0x00e8000 0x10000 +{"return": ""} +write -P0x6e 0x2018000 0x10000 +{"return": ""} +write -P0x67 0x3fe0000 0x20000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "persistent": false, + "recording": false, + "status": "disabled" + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": true, + "status": "active" + }, + { + "busy": true, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "frozen" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +=3D Checking Bitmap (anonymous) =3D +expecting 7 dirty sectors; have 7. OK! + +{"execute": "job-finalize", "arguments": {"id": "backup_1"}} +{"return": {}} +{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 458752, "offset": 458752, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 458752, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 7 dirty sectors; have 7. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 786432, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 12 dirty sectors; have 12. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} +{"return": {}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Mode top; Bitmap Sync always with simulated failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "top", "target": "backup_target_1"}} +{"return": {}} + +--- Write #2 --- + +write -P0x74 0x0010000 0x10000 +{"return": ""} +write -P0x69 0x00e8000 0x10000 +{"return": ""} +write -P0x6e 0x2018000 0x10000 +{"return": ""} +write -P0x67 0x3fe0000 0x20000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "persistent": false, + "recording": false, + "status": "disabled" + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": true, + "status": "active" + }, + { + "busy": true, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "frozen" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +=3D Checking Bitmap (anonymous) =3D +expecting 7 dirty sectors; have 7. OK! + +{"execute": "job-cancel", "arguments": {"id": "backup_1"}} +{"return": {}} +{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 458752, "offset": 458752, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 458752, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 7 dirty sectors; have 7. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 786432, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 12 dirty sectors; have 12. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} +{"return": {}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Mode top; Bitmap Sync always with intermediate failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img= "}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false= , "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new= -state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]= }, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +{"return": ""} + +--- Test Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "top", "target": "backup_target_1"}} +{"return": {}} +{"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} +{"data": {"device": "backup_1", "error": "Input/output error", "len": 4587= 52, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COM= PLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 917504, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 14 dirty sectors; have 14. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} +{"return": {}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 917504, "offset": 917504, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Mis= match, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + +=3D=3D=3D Mode top; Bitmap Sync always without failure =3D=3D=3D + +--- Preparing image & VM --- + +{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} +{"return": {}} +{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} +{"return": {}} + +--- Write #0 --- + +write -P0x49 0x0000000 0x10000 +{"return": ""} +write -P0x6c 0x0100000 0x10000 +{"return": ""} +write -P0x6f 0x2000000 0x10000 +{"return": ""} +write -P0x76 0x3ff0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [] + } +} + +--- Reference Backup #0 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"return": {}} +{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Add Bitmap --- + +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, = "name": "bitmap0", "node": "drive0"}} +{"return": {}} + +--- Write #1 --- + +write -P0x65 0x0000000 0x10000 +{"return": ""} +write -P0x77 0x00f8000 0x10000 +{"return": ""} +write -P0x72 0x2008000 0x10000 +{"return": ""} +write -P0x69 0x3fe0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +--- Reference Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"return": {}} +{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #1 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "top", "target": "backup_target_1"}} +{"return": {}} + +--- Write #2 --- + +write -P0x74 0x0010000 0x10000 +{"return": ""} +write -P0x69 0x00e8000 0x10000 +{"return": ""} +write -P0x6e 0x2018000 0x10000 +{"return": ""} +write -P0x67 0x3fe0000 0x20000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "persistent": false, + "recording": false, + "status": "disabled" + }, + { + "busy": false, + "count": 458752, + "granularity": 65536, + "persistent": false, + "recording": true, + "status": "active" + }, + { + "busy": true, + "count": 393216, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "frozen" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 6 dirty sectors; have 6. OK! + +=3D Checking Bitmap (anonymous) =3D +expecting 7 dirty sectors; have 7. OK! + +{"execute": "job-finalize", "arguments": {"id": "backup_1"}} +{"return": {}} +{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_1", "len": 458752, "offset": 458752, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 458752, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 7 dirty sectors; have 7. OK! + +--- Write #3 --- + +write -P0xaa 0x0010000 0x30000 +{"return": ""} +write -P0xbb 0x00d8000 0x10000 +{"return": ""} +write -P0xcc 0x2028000 0x10000 +{"return": ""} +write -P0xdd 0x3fc0000 0x10000 +{"return": ""} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 786432, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 12 dirty sectors; have 12. OK! + +--- Reference Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"return": {}} +{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} + +--- Test Backup #2 --- + +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} +{"return": {}} +{} +{} +{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} +{"return": {}} +{} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"return": {}} +{"execute": "job-finalize", "arguments": {"id": "backup_2"}} +{"return": {}} +{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING= ", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} +{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} +{ + "bitmaps": { + "device0": [ + { + "busy": false, + "count": 0, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } + ] + } +} + +=3D Checking Bitmap bitmap0 =3D +expecting 0 dirty sectors; have 0. OK! + +--- Cleanup --- + +{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} +{"return": {}} +{ + "bitmaps": { + "device0": [] + } +} + +--- Verification --- + +qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" =3D=3D> Ide= ntical, OK! +qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" =3D=3D> Identi= cal, OK! + + =3D=3D=3D API failure tests =3D=3D=3D =20 --- Preparing image & VM --- @@ -2330,3 +5326,96 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fb= ackup2" =3D=3D> Identical, OK! {"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device"= : "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_target= "}} {"error": {"class": "GenericError", "desc": "Bitmap sync mode must be give= n when providing a bitmap"}} =20 +-- Sync mode full tests -- + +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", = "device": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_= target"}} +{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "dev= ice": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_targ= et"}} +{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "devi= ce": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_targe= t"}} +{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "fu= ll", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "full",= "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "full", = "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "devic= e": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_target= "}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "never", "device": "drive0", "job-id": "api_job", "sync": "full", "t= arget": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap sync mode 'never' has = no meaningful effect when combined with sync mode 'full'"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device"= : "drive0", "job-id": "api_job", "sync": "full", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be give= n when providing a bitmap"}} + +-- Sync mode top tests -- + +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", = "device": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_t= arget"}} +{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "dev= ice": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_targe= t"}} +{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "devi= ce": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_target= "}} +{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "to= p", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "top", = "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "top", "= target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "devic= e": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_target"= }} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "never", "device": "drive0", "job-id": "api_job", "sync": "top", "ta= rget": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap sync mode 'never' has = no meaningful effect when combined with sync mode 'top'"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device"= : "drive0", "job-id": "api_job", "sync": "top", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be give= n when providing a bitmap"}} + +-- Sync mode none tests -- + +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", = "device": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_= target"}} +{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "dev= ice": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_targ= et"}} +{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "devi= ce": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_targe= t"}} +{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "no= ne", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "none",= "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "none", = "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "devic= e": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_target= "}} +{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "none= ", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "sync mode 'none' does not pro= duce meaningful bitmap outputs"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "always", "device": "drive0", "job-id": "api_job", "sync": "none", "= target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "sync mode 'none' does not pro= duce meaningful bitmap outputs"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "never", "device": "drive0", "job-id": "api_job", "sync": "none", "t= arget": "backup_target"}} +{"error": {"class": "GenericError", "desc": "sync mode 'none' does not pro= duce meaningful bitmap outputs"}} + +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device"= : "drive0", "job-id": "api_job", "sync": "none", "target": "backup_target"}} +{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be give= n when providing a bitmap"}} + --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998610; cv=none; d=zoho.com; s=zohoarc; b=Cnck22D/VCz7VhJU5bwQ8Pf5iCjyHOIhLFXAkSptpXe3QbefvhDN008Qub/pcTsUI1Y8yaIIMTqyCmTwaWVJ78dzY1le3AKL2FcCyCl1dYzX5pig//HZe2rUqEsm3vZAxeozStcXcQz0I2FgKCN+JPYplFp7hd/diq0pklW+ctE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998610; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=vJLAB/wkO8ez6YNJa2saRo9LHwcMKLluhwXLCwmqwm4=; b=Pl2rJSw614OOEpXm4mD5Z+e5IxyxZCpWsM4byue51tAo/VNq59oRhSeV5ZSwaBMv/beomXAPZtX/n9nEQTj0ezvYuPJMUsO29OkeZHmLIJ12XYGz38XkYXJk89Oe96ohfuspWRzvusloJcirRiwwlUAnfVGSgo1V3J/F5MBP0/I= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565998610657273.34197455797107; Fri, 16 Aug 2019 16:36:50 -0700 (PDT) Received: from localhost ([::1]:33376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylm4-0003BG-Jd for importer@patchew.org; Fri, 16 Aug 2019 19:36:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47139) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylQ1-00073H-24 for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylPz-0006L5-OI for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46978) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPu-0006Da-BN; Fri, 16 Aug 2019 19:13:56 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 87BFA86668; Fri, 16 Aug 2019 23:13:53 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8374319C6A; Fri, 16 Aug 2019 23:13:52 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:15 -0400 Message-Id: <20190816231318.8650-34-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 16 Aug 2019 23:13:53 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 33/36] qapi: add dirty-bitmaps to query-named-block-nodes result X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Let's add a possibility to query dirty-bitmaps not only on root nodes. It is useful when dealing both with snapshots and incremental backups. Signed-off-by: Vladimir Sementsov-Ogievskiy Signed-off-by: John Snow Message-id: 20190717173937.18747-1-jsnow@redhat.com [Added deprecation information. --js] Signed-off-by: John Snow [Fixed spelling --js] --- block/qapi.c | 5 +++++ qapi/block-core.json | 6 +++++- qemu-deprecated.texi | 12 ++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/block/qapi.c b/block/qapi.c index 917435f0226..15f10302647 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -79,6 +79,11 @@ BlockDeviceInfo *bdrv_block_device_info(BlockBackend *bl= k, info->backing_file =3D g_strdup(bs->backing_file); } =20 + if (!QLIST_EMPTY(&bs->dirty_bitmaps)) { + info->has_dirty_bitmaps =3D true; + info->dirty_bitmaps =3D bdrv_query_dirty_bitmaps(bs); + } + info->detect_zeroes =3D bs->detect_zeroes; =20 if (blk && blk_get_public(blk)->throttle_group_member.throttle_state) { diff --git a/qapi/block-core.json b/qapi/block-core.json index d72cf5f354b..e9364a4a293 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -360,6 +360,9 @@ # @write_threshold: configured write threshold for the device. # 0 if disabled. (Since 2.3) # +# @dirty-bitmaps: dirty bitmaps information (only present if node +# has one or more dirty bitmaps) (Since 4.2) +# # Since: 0.14.0 # ## @@ -378,7 +381,7 @@ '*bps_wr_max_length': 'int', '*iops_max_length': 'int', '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int', '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheI= nfo', - 'write_threshold': 'int' } } + 'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo']= } } =20 ## # @BlockDeviceIoStatus: @@ -656,6 +659,7 @@ # # @dirty-bitmaps: dirty bitmaps information (only present if the # driver has one or more dirty bitmaps) (Since 2.0) +# Deprecated in 4.2; see BlockDeviceInfo instead. # # @io-status: @BlockDeviceIoStatus. Only present if the device # supports it and the VM is configured to stop on errors diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index f7680c08e10..00a4b6f3504 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -154,6 +154,18 @@ The ``status'' field of the ``BlockDirtyInfo'' structu= re, returned by the query-block command is deprecated. Two new boolean fields, ``recording'' and ``busy'' effectively replace it. =20 +@subsection query-block result field dirty-bitmaps (Since 4.2) + +The ``dirty-bitmaps`` field of the ``BlockInfo`` structure, returned by +the query-block command is itself now deprecated. The ``dirty-bitmaps`` +field of the ``BlockDeviceInfo`` struct should be used instead, which is t= he +type of the ``inserted`` field in query-block replies, as well as the +type of array items in query-named-block-nodes. + +Since the ``dirty-bitmaps`` field is optionally present in both the old and +new locations, clients must use introspection to learn where to anticipate +the field if/when it does appear in command output. + @subsection query-cpus (since 2.12.0) =20 The ``query-cpus'' command is replaced by the ``query-cpus-fast'' command. --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998800; cv=none; d=zoho.com; s=zohoarc; b=n0znzclR1hsvQ0KeK3zuIaba7ONKlfqpvylfGYvsMGqU0Fa/N33jYaheg2QfSDI76bfawlKxUMaqDnCW6JbRDn0cksksyvTNlE6FQcLVIjg94RmQYmkceeT3oD+Ngm6hDPNwfUA+6wQXrg58GSFQO99OF71gTSgiPdY3oLV+vks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998800; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=TtbGLuCU4Uh6e0QI7K3UP3FeUSWWPMg8zlNbPF7uPF8=; b=LN+eDlIJc/4mUyMs4GykLq1da2QPT2VzDyaO4Spct9de767kLtyHd5VngyMDXs6wx0xLpRqBqBBQ9N1OJ/JUPbtiLJxk+Jn7A+q3a/jflNRbI9ZV7re4XTdChg/+DCYKoashPYrA/Pu/Vg2ZmLlRORm23b86ttXo6YEFxAPnceg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565998800954837.5707722390281; Fri, 16 Aug 2019 16:40:00 -0700 (PDT) Received: from localhost ([::1]:33414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylp6-00074O-Bt for importer@patchew.org; Fri, 16 Aug 2019 19:39:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47192) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylQ3-000764-1V for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylQ1-0006MQ-6m for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40500) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPx-0006Hy-Tg; Fri, 16 Aug 2019 19:13:58 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 246813090FEE; Fri, 16 Aug 2019 23:13:54 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C9C710512; Fri, 16 Aug 2019 23:13:53 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:16 -0400 Message-Id: <20190816231318.8650-35-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 16 Aug 2019 23:13:54 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 34/36] block/backup: deal with zero detection X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, qemu-stable@nongnu.org, Max Reitz , jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy We have detect_zeroes option, so at least for blockdev-backup user should define it if zero-detection is needed. For drive-backup leave detection enabled by default but do it through existing option instead of open-coding. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow Reviewed-by: Max Reitz Message-id: 20190730163251.755248-2-vsementsov@virtuozzo.com Signed-off-by: John Snow --- block/backup.c | 15 ++++++--------- blockdev.c | 8 ++++---- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/block/backup.c b/block/backup.c index a9be07258c1..083fc189af9 100644 --- a/block/backup.c +++ b/block/backup.c @@ -113,7 +113,10 @@ static int coroutine_fn backup_cow_with_bounce_buffer(= BackupBlockJob *job, BlockBackend *blk =3D job->common.blk; int nbytes; int read_flags =3D is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; - int write_flags =3D job->serialize_target_writes ? BDRV_REQ_SERIALISIN= G : 0; + int write_flags =3D + (job->serialize_target_writes ? BDRV_REQ_SERIALISING : 0) | + (job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0); + =20 assert(QEMU_IS_ALIGNED(start, job->cluster_size)); bdrv_reset_dirty_bitmap(job->copy_bitmap, start, job->cluster_size); @@ -131,14 +134,8 @@ static int coroutine_fn backup_cow_with_bounce_buffer(= BackupBlockJob *job, goto fail; } =20 - if (buffer_is_zero(*bounce_buffer, nbytes)) { - ret =3D blk_co_pwrite_zeroes(job->target, start, - nbytes, write_flags | BDRV_REQ_MAY_UNMA= P); - } else { - ret =3D blk_co_pwrite(job->target, start, - nbytes, *bounce_buffer, write_flags | - (job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0= )); - } + ret =3D blk_co_pwrite(job->target, start, nbytes, *bounce_buffer, + write_flags); if (ret < 0) { trace_backup_do_cow_write_fail(job, start, ret); if (error_is_read) { diff --git a/blockdev.c b/blockdev.c index 64d06d1f672..2e536dde3e9 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3615,7 +3615,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup,= JobTxn *txn, BlockDriverState *source =3D NULL; BlockJob *job =3D NULL; AioContext *aio_context; - QDict *options =3D NULL; + QDict *options; Error *local_err =3D NULL; int flags; int64_t size; @@ -3688,10 +3688,10 @@ static BlockJob *do_drive_backup(DriveBackup *backu= p, JobTxn *txn, goto out; } =20 + options =3D qdict_new(); + qdict_put_str(options, "discard", "unmap"); + qdict_put_str(options, "detect-zeroes", "unmap"); if (backup->format) { - if (!options) { - options =3D qdict_new(); - } qdict_put_str(options, "driver", backup->format); } =20 --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565998969; cv=none; d=zoho.com; s=zohoarc; b=Y1J9UIwnloCd/aqYBGNbo0wFNggcQD0bVYoZUVAPaYHT+rzfCisAlaPmeJR/QAtcOdq9mVIzNZ3BLaiCcMgjnyVU3j7Udm38Q/mkKAGZEootJo5hN4BYkrl0ixhoTax60gKf0175VhsrnYf7R4xT1Ek6N6gh+B0MfDNzVqjGUfg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565998969; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=PLbKB0GpQIh7VXRNOnLc9E8ZQnojhwSsxdRMLPpx91w=; b=h+yM1GIiOlceFF32b9ykLxfoaDZ5BRC8N3vTzFL1xTqPMWELhvEDyogVkOLu7DKG0+Rrl1EBRA8W3pP0yv7VHi/W03KuyjeNXfF/HgxTluXbyJD5Z55gNKFy5UDdbuOZL8aQzCg8EqiRD0gyjp3eMuRd8xYOzXriF5GjbZaIpNk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565998969684176.93929508489668; Fri, 16 Aug 2019 16:42:49 -0700 (PDT) Received: from localhost ([::1]:33458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylrs-0001rL-Cr for importer@patchew.org; Fri, 16 Aug 2019 19:42:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47197) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylQ2-00076M-VW for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylQ1-0006MX-9n for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54840) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPy-0006I8-5K; Fri, 16 Aug 2019 19:13:58 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0D29E1E1E6F; Fri, 16 Aug 2019 23:13:55 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46F9D19C6A; Fri, 16 Aug 2019 23:13:54 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:17 -0400 Message-Id: <20190816231318.8650-36-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.71]); Fri, 16 Aug 2019 23:13:55 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 35/36] block/backup: refactor write_flags X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , qemu-block@nongnu.org, qemu-stable@nongnu.org, Max Reitz , jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy write flags are constant, let's store it in BackupBlockJob instead of recalculating. It also makes two boolean fields to be unused, so, drop them. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow Reviewed-by: Max Reitz Message-id: 20190730163251.755248-4-vsementsov@virtuozzo.com Signed-off-by: John Snow --- block/backup.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/block/backup.c b/block/backup.c index 083fc189af9..2baf7bed65a 100644 --- a/block/backup.c +++ b/block/backup.c @@ -50,14 +50,13 @@ typedef struct BackupBlockJob { uint64_t len; uint64_t bytes_read; int64_t cluster_size; - bool compress; NotifierWithReturn before_write; QLIST_HEAD(, CowRequest) inflight_reqs; =20 bool use_copy_range; int64_t copy_range_size; =20 - bool serialize_target_writes; + BdrvRequestFlags write_flags; bool initializing_bitmap; } BackupBlockJob; =20 @@ -113,10 +112,6 @@ static int coroutine_fn backup_cow_with_bounce_buffer(= BackupBlockJob *job, BlockBackend *blk =3D job->common.blk; int nbytes; int read_flags =3D is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; - int write_flags =3D - (job->serialize_target_writes ? BDRV_REQ_SERIALISING : 0) | - (job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0); - =20 assert(QEMU_IS_ALIGNED(start, job->cluster_size)); bdrv_reset_dirty_bitmap(job->copy_bitmap, start, job->cluster_size); @@ -135,7 +130,7 @@ static int coroutine_fn backup_cow_with_bounce_buffer(B= ackupBlockJob *job, } =20 ret =3D blk_co_pwrite(job->target, start, nbytes, *bounce_buffer, - write_flags); + job->write_flags); if (ret < 0) { trace_backup_do_cow_write_fail(job, start, ret); if (error_is_read) { @@ -163,7 +158,6 @@ static int coroutine_fn backup_cow_with_offload(BackupB= lockJob *job, BlockBackend *blk =3D job->common.blk; int nbytes; int read_flags =3D is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; - int write_flags =3D job->serialize_target_writes ? BDRV_REQ_SERIALISIN= G : 0; =20 assert(QEMU_IS_ALIGNED(job->copy_range_size, job->cluster_size)); assert(QEMU_IS_ALIGNED(start, job->cluster_size)); @@ -172,7 +166,7 @@ static int coroutine_fn backup_cow_with_offload(BackupB= lockJob *job, bdrv_reset_dirty_bitmap(job->copy_bitmap, start, job->cluster_size * nr_clusters); ret =3D blk_co_copy_range(blk, start, job->target, start, nbytes, - read_flags, write_flags); + read_flags, job->write_flags); if (ret < 0) { trace_backup_do_cow_copy_range_fail(job, start, ret); bdrv_set_dirty_bitmap(job->copy_bitmap, start, @@ -751,10 +745,16 @@ BlockJob *backup_job_create(const char *job_id, Block= DriverState *bs, job->sync_mode =3D sync_mode; job->sync_bitmap =3D sync_bitmap; job->bitmap_mode =3D bitmap_mode; - job->compress =3D compress; =20 - /* Detect image-fleecing (and similar) schemes */ - job->serialize_target_writes =3D bdrv_chain_contains(target, bs); + /* + * Set write flags: + * 1. Detect image-fleecing (and similar) schemes + * 2. Handle compression + */ + job->write_flags =3D + (bdrv_chain_contains(target, bs) ? BDRV_REQ_SERIALISING : 0) | + (compress ? BDRV_REQ_WRITE_COMPRESSED : 0); + job->cluster_size =3D cluster_size; job->copy_bitmap =3D copy_bitmap; copy_bitmap =3D NULL; --=20 2.21.0 From nobody Tue Nov 11 20:48:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565999025; cv=none; d=zoho.com; s=zohoarc; b=I+pbR1oHHrk3yw4eJKoxd7MEMoSrZcl/FuUFojVWgoZFnq3t2SAAzQDVLI1NbVA15MxoYHR6pJHNnSvU8W36KIiUk3ZkjL5PsBmY7m7QI2bVs8hHgjwvtp0qIblNePF3Bkq0uyvmHCCnKYmH7BZ380pmuUTRs1IHLEVCRmpdV60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565999025; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Cu669AmHlUNvR8MdzgU3aOQt2JKw7TQ2XRUdfYQVvnE=; b=Dej9b2Ch8+QrHD0s//Eck+a5hYv1lnPdSkRbzqpfduqroBzWH0h7Q9MgAabG7+B13V1VLPLIT26WTeHg3nhyAGocCZ5CSCce5JXjF0aErjgLouh2ive7svuXdyaNLmhekOO0b4v3TUb/6DppS8iX752tPYp8mTBZ0X6SHHuVcPY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565999025963614.468006443993; Fri, 16 Aug 2019 16:43:45 -0700 (PDT) Received: from localhost ([::1]:33474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylsm-0003MM-KD for importer@patchew.org; Fri, 16 Aug 2019 19:43:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47240) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylQ4-00078l-Jx for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylQ2-0006OP-OC for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60216) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPz-0006J4-5h; Fri, 16 Aug 2019 19:13:59 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D6C57CA1FE; Fri, 16 Aug 2019 23:13:55 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 311CB19C6A; Fri, 16 Aug 2019 23:13:55 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:18 -0400 Message-Id: <20190816231318.8650-37-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 16 Aug 2019 23:13:55 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 36/36] tests/test-hbitmap: test next_zero and _next_dirty_area after truncate X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Test that hbitmap_next_zero and hbitmap_next_dirty_area can find things after old bitmap end. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-id: 20190805164652.42409-1-vsementsov@virtuozzo.com Tested-by: John Snow Reviewed-by: John Snow Signed-off-by: John Snow --- tests/test-hbitmap.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c index 592d8219db2..eed5d288cbc 100644 --- a/tests/test-hbitmap.c +++ b/tests/test-hbitmap.c @@ -1004,6 +1004,15 @@ static void test_hbitmap_next_zero_4(TestHBitmapData= *data, const void *unused) test_hbitmap_next_zero_do(data, 4); } =20 +static void test_hbitmap_next_zero_after_truncate(TestHBitmapData *data, + const void *unused) +{ + hbitmap_test_init(data, L1, 0); + hbitmap_test_truncate_impl(data, L1 * 2); + hbitmap_set(data->hb, 0, L1); + test_hbitmap_next_zero_check(data, 0); +} + static void test_hbitmap_next_dirty_area_check(TestHBitmapData *data, uint64_t offset, uint64_t count) @@ -1104,6 +1113,15 @@ static void test_hbitmap_next_dirty_area_4(TestHBitm= apData *data, test_hbitmap_next_dirty_area_do(data, 4); } =20 +static void test_hbitmap_next_dirty_area_after_truncate(TestHBitmapData *d= ata, + const void *unused) +{ + hbitmap_test_init(data, L1, 0); + hbitmap_test_truncate_impl(data, L1 * 2); + hbitmap_set(data->hb, L1 + 1, 1); + test_hbitmap_next_dirty_area_check(data, 0, UINT64_MAX); +} + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); @@ -1169,6 +1187,8 @@ int main(int argc, char **argv) test_hbitmap_next_zero_0); hbitmap_test_add("/hbitmap/next_zero/next_zero_4", test_hbitmap_next_zero_4); + hbitmap_test_add("/hbitmap/next_zero/next_zero_after_truncate", + test_hbitmap_next_zero_after_truncate); =20 hbitmap_test_add("/hbitmap/next_dirty_area/next_dirty_area_0", test_hbitmap_next_dirty_area_0); @@ -1176,6 +1196,8 @@ int main(int argc, char **argv) test_hbitmap_next_dirty_area_1); hbitmap_test_add("/hbitmap/next_dirty_area/next_dirty_area_4", test_hbitmap_next_dirty_area_4); + hbitmap_test_add("/hbitmap/next_dirty_area/next_dirty_area_after_trunc= ate", + test_hbitmap_next_dirty_area_after_truncate); =20 g_test_run(); =20 --=20 2.21.0