From nobody Fri Dec 19 17:37:46 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592241142; cv=none; d=zohomail.com; s=zohoarc; b=POH9OEEZGQaV2NhmabcxRqmc1QngZ/pSapplOFKnrFRTo3KIjkgFJ+8jynoRM3wK/pgSFcAfwIVMoIqujZjE99YxIhMvKuOlyXoc5cJo3rpH8LDyxr82PMlHXmAjvbzcFG5rX5MCa0XpTbK6Kq4HXMkCkphpDxOZnNmcmwWY/TQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592241142; h=Content-Type:Content-Transfer-Encoding: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; bh=SmBGw8fsEYkOUuKZxwh0qFq2kx1N3596muFA0f6kyOw=; b=h9f5QVDzEHqoBnStP7JYCjPErog5cZGBgrAy03M1ImiNBuZ8lfsF2a1lmcjbTFqJuAjSqmY+pRLBpbuRvh7SPpWCe5p0IvNk53LKv4IeIuRTcqZZprp4dBzLG8VgKLZLPHXx9b2NZwsmg37AAwgKpjQuoy/Czmg9kERGLib7Rjk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1592241142778404.1045723588844; Mon, 15 Jun 2020 10:12:22 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-120-YLLPY3pyMZOHKTZv29PtxQ-1; Mon, 15 Jun 2020 13:11:13 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8C3C210059C2; Mon, 15 Jun 2020 17:11:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 668E71001901; Mon, 15 Jun 2020 17:11:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 36CF3180954D; Mon, 15 Jun 2020 17:11:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05FHAvkG004937 for ; Mon, 15 Jun 2020 13:10:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 72A76100164D; Mon, 15 Jun 2020 17:10:57 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id DED0F10027A6 for ; Mon, 15 Jun 2020 17:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592241141; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=SmBGw8fsEYkOUuKZxwh0qFq2kx1N3596muFA0f6kyOw=; b=bEhFdXN3/9LBbC2WGEej1FW3F5kx68YdB1pVlASsEE59xBGFpsIVbqFOPlBz2C+O2V4AXh 51DGwcYkbxfUUQuo0t1JeYTpsS56N82d7lJauvzMd2VmDK3SulraKdJnLhBYI7tVhtcE+y sv7yTzLcYnaxcg5XqOcxMaqWw9D1kz8= X-MC-Unique: YLLPY3pyMZOHKTZv29PtxQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 26/32] qemu: Rewrite bitmap handling for block commit Date: Mon, 15 Jun 2020 19:10:13 +0200 Message-Id: <11c26e4f87334ca4df3ed140fb0ff05eaff9c907.1592240635.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Reuse qemuBlockGetBitmapMergeActions which allows to remove the ad-hoc implementatio of bitmap merging for block commit. The new approach is way simpler and more robust and also allows us to get rid of the disabling of bitmaps done prior to the start as we actually do want to update the bitmaps in the base. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_block.c | 203 +----------------- src/qemu/qemu_block.h | 11 +- src/qemu/qemu_blockjob.c | 25 ++- src/qemu/qemu_driver.c | 56 +---- tests/qemublocktest.c | 18 +- .../qemublocktestdata/bitmapblockcommit/empty | 1 - 6 files changed, 42 insertions(+), 272 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 86f8410ce7..e958fb71fa 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -3209,117 +3209,7 @@ qemuBlockBitmapsHandleBlockcopy(virStorageSourcePtr= src, /** * @topsrc: virStorageSource representing 'top' of the job * @basesrc: virStorageSource representing 'base' of the job - * @blockNamedNodeData: hash table containing data about bitmaps - * @actions: filled with arguments for a 'transaction' command - * @disabledBitmapsBase: filled with a list of bitmap names which must be = disabled - * - * Prepares data for correctly handling bitmaps during the start of a comm= it - * job. The bitmaps in the 'base' image must be disabled, so that the writ= es - * done by the blockjob don't dirty the enabled bitmaps. - * - * @actions and @disabledBitmapsBase are untouched if no bitmaps need - * to be disabled. - */ -int -qemuBlockBitmapsHandleCommitStart(virStorageSourcePtr topsrc, - virStorageSourcePtr basesrc, - virHashTablePtr blockNamedNodeData, - virJSONValuePtr *actions, - char ***disabledBitmapsBase) -{ - g_autoptr(virJSONValue) act =3D virJSONValueNewArray(); - VIR_AUTOSTRINGLIST bitmaplist =3D NULL; - size_t curbitmapstr =3D 0; - qemuBlockNamedNodeDataPtr entry; - bool disable_bitmaps =3D false; - size_t i; - - if (!(entry =3D virHashLookup(blockNamedNodeData, basesrc->nodeformat)= )) - return 0; - - bitmaplist =3D g_new0(char *, entry->nbitmaps + 1); - - for (i =3D 0; i < entry->nbitmaps; i++) { - qemuBlockNamedNodeDataBitmapPtr bitmap =3D entry->bitmaps[i]; - - if (!bitmap->recording || bitmap->inconsistent || - !qemuBlockBitmapChainIsValid(topsrc, bitmap->name, blockNamedN= odeData)) - continue; - - disable_bitmaps =3D true; - - if (qemuMonitorTransactionBitmapDisable(act, basesrc->nodeformat, - bitmap->name) < 0) - return -1; - - bitmaplist[curbitmapstr++] =3D g_strdup(bitmap->name); - } - - if (disable_bitmaps) { - *actions =3D g_steal_pointer(&act); - *disabledBitmapsBase =3D g_steal_pointer(&bitmaplist); - } - - return 0; -} - - -struct qemuBlockBitmapsHandleCommitData { - bool skip; - bool create; - bool enable; - const char *basenode; - virJSONValuePtr merge; - unsigned long long granularity; - bool persistent; -}; - - -static void -qemuBlockBitmapsHandleCommitDataFree(void *opaque) -{ - struct qemuBlockBitmapsHandleCommitData *data =3D opaque; - - virJSONValueFree(data->merge); - g_free(data); -} - - -static int -qemuBlockBitmapsHandleCommitFinishIterate(void *payload, - const void *entryname, - void *opaque) -{ - struct qemuBlockBitmapsHandleCommitData *data =3D payload; - const char *bitmapname =3D entryname; - virJSONValuePtr actions =3D opaque; - - if (data->skip) - return 0; - - if (data->create) { - if (qemuMonitorTransactionBitmapAdd(actions, data->basenode, bitma= pname, - data->persistent, !data->enabl= e, - data->granularity) < 0) - return -1; - } else { - if (data->enable && - qemuMonitorTransactionBitmapEnable(actions, data->basenode, bi= tmapname) < 0) - return -1; - } - - if (data->merge && - qemuMonitorTransactionBitmapMerge(actions, data->basenode, bitmapn= ame, - &data->merge) < 0) - return -1; - - return 0; -} - - -/** - * @topsrc: virStorageSource representing 'top' of the job - * @basesrc: virStorageSource representing 'base' of the job + * @active: commit job is an active layer block-commit * @blockNamedNodeData: hash table containing data about bitmaps * @actions: filled with arguments for a 'transaction' command * @disabledBitmapsBase: bitmap names which were disabled @@ -3332,95 +3222,20 @@ qemuBlockBitmapsHandleCommitFinishIterate(void *pay= load, int qemuBlockBitmapsHandleCommitFinish(virStorageSourcePtr topsrc, virStorageSourcePtr basesrc, + bool active, virHashTablePtr blockNamedNodeData, - virJSONValuePtr *actions, - char **disabledBitmapsBase) + virJSONValuePtr *actions) { - g_autoptr(virJSONValue) act =3D virJSONValueNewArray(); - virStorageSourcePtr n; - qemuBlockNamedNodeDataPtr entry; - g_autoptr(virHashTable) commitdata =3D NULL; - struct qemuBlockBitmapsHandleCommitData *bitmapdata; - size_t i; - - commitdata =3D virHashNew(qemuBlockBitmapsHandleCommitDataFree); - - for (n =3D topsrc; n !=3D basesrc; n =3D n->backingStore) { - if (!(entry =3D virHashLookup(blockNamedNodeData, n->nodeformat))) - continue; - - for (i =3D 0; i < entry->nbitmaps; i++) { - qemuBlockNamedNodeDataBitmapPtr bitmap =3D entry->bitmaps[i]; - - if (!(bitmapdata =3D virHashLookup(commitdata, bitmap->name)))= { - bitmapdata =3D g_new0(struct qemuBlockBitmapsHandleCommitD= ata, 1); + virStorageSourcePtr writebitmapsrc =3D NULL; - /* we must mirror the state of the topmost bitmap and merge - * everything else */ - bitmapdata->create =3D true; - bitmapdata->enable =3D bitmap->recording; - bitmapdata->basenode =3D basesrc->nodeformat; - bitmapdata->merge =3D virJSONValueNewArray(); - bitmapdata->granularity =3D bitmap->granularity; - bitmapdata->persistent =3D bitmap->persistent; + if (active) + writebitmapsrc =3D basesrc; - if (virHashAddEntry(commitdata, bitmap->name, bitmapdata) = < 0) { - qemuBlockBitmapsHandleCommitDataFree(bitmapdata); - return -1; - } - } - - if (bitmap->inconsistent || - !qemuBlockBitmapChainIsValid(topsrc, bitmap->name, blockNa= medNodeData)) - bitmapdata->skip =3D true; - - if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(bitmapdat= a->merge, - n->nodefo= rmat, - bitmap->n= ame) < 0) - return -1; - } - } - - if ((entry =3D virHashLookup(blockNamedNodeData, basesrc->nodeformat))= ) { - /* note that all bitmaps in 'base' were disabled when commit was s= tarted */ - for (i =3D 0; i < entry->nbitmaps; i++) { - qemuBlockNamedNodeDataBitmapPtr bitmap =3D entry->bitmaps[i]; - - if ((bitmapdata =3D virHashLookup(commitdata, bitmap->name))) { - bitmapdata->create =3D false; - } else { - if (disabledBitmapsBase) { - char **disabledbitmaps; - - for (disabledbitmaps =3D disabledBitmapsBase; *disable= dbitmaps; disabledbitmaps++) { - if (STREQ(*disabledbitmaps, bitmap->name)) { - bitmapdata =3D g_new0(struct qemuBlockBitmapsH= andleCommitData, 1); - - bitmapdata->create =3D false; - bitmapdata->enable =3D true; - bitmapdata->basenode =3D basesrc->nodeformat; - bitmapdata->granularity =3D bitmap->granularit= y; - bitmapdata->persistent =3D bitmap->persistent; - - if (virHashAddEntry(commitdata, bitmap->name, = bitmapdata) < 0) { - qemuBlockBitmapsHandleCommitDataFree(bitma= pdata); - return -1; - } - - break; - } - } - } - } - } - } - - if (virHashForEach(commitdata, qemuBlockBitmapsHandleCommitFinishItera= te, act) < 0) + if (qemuBlockGetBitmapMergeActions(topsrc, basesrc, basesrc, NULL, NUL= L, + writebitmapsrc, actions, + blockNamedNodeData) < 0) return -1; - if (virJSONValueArraySize(act) > 0) - *actions =3D g_steal_pointer(&act); - return 0; } diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 0f5b4cfaa9..24b87e79db 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -243,19 +243,12 @@ qemuBlockBitmapsHandleBlockcopy(virStorageSourcePtr s= rc, bool shallow, virJSONValuePtr *actions); -int -qemuBlockBitmapsHandleCommitStart(virStorageSourcePtr topsrc, - virStorageSourcePtr basesrc, - virHashTablePtr blockNamedNodeData, - virJSONValuePtr *actions, - char ***disabledBitmapsBase); - int qemuBlockBitmapsHandleCommitFinish(virStorageSourcePtr topsrc, virStorageSourcePtr basesrc, + bool active, virHashTablePtr blockNamedNodeData, - virJSONValuePtr *actions, - char **disabledBitmapsBase); + virJSONValuePtr *actions); int qemuBlockReopenReadWrite(virDomainObjPtr vm, diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 17dc08476b..8e81b142f4 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -1069,6 +1069,7 @@ qemuBlockJobProcessEventCompletedCommitBitmaps(virDom= ainObjPtr vm, qemuDomainObjPrivatePtr priv =3D vm->privateData; g_autoptr(virHashTable) blockNamedNodeData =3D NULL; g_autoptr(virJSONValue) actions =3D NULL; + bool active =3D job->type =3D=3D QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT; if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN)) return 0; @@ -1078,16 +1079,18 @@ qemuBlockJobProcessEventCompletedCommitBitmaps(virD= omainObjPtr vm, if (qemuBlockBitmapsHandleCommitFinish(job->data.commit.top, job->data.commit.base, + active, blockNamedNodeData, - &actions, - job->data.commit.disabledBitmap= sBase) < 0) + &actions) < 0) return 0; if (!actions) return 0; - if (qemuBlockReopenReadWrite(vm, job->data.commit.base, asyncJob) < 0) - return -1; + if (!active) { + if (qemuBlockReopenReadWrite(vm, job->data.commit.base, asyncJob) = < 0) + return -1; + } if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) return -1; @@ -1097,8 +1100,10 @@ qemuBlockJobProcessEventCompletedCommitBitmaps(virDo= mainObjPtr vm, if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) return -1; - if (qemuBlockReopenReadOnly(vm, job->data.commit.base, asyncJob) < 0) - return -1; + if (!active) { + if (qemuBlockReopenReadOnly(vm, job->data.commit.base, asyncJob) <= 0) + return -1; + } return 0; } @@ -1268,6 +1273,9 @@ qemuBlockJobProcessEventCompletedActiveCommit(virQEMU= DriverPtr driver, job->disk->src =3D job->data.commit.base; job->disk->src->readonly =3D job->data.commit.top->readonly; + if (qemuBlockJobProcessEventCompletedCommitBitmaps(vm, job, asyncJob) = < 0) + return; + qemuBlockJobEventProcessConcludedRemoveChain(driver, vm, asyncJob, job= ->data.commit.top); if (job->data.commit.deleteCommittedImages) @@ -1339,6 +1347,7 @@ qemuBlockJobProcessEventFailedActiveCommit(virQEMUDri= verPtr driver, virDomainObjPtr vm, qemuBlockJobDataPtr job) { + g_autoptr(virJSONValue) actions =3D virJSONValueNewArray(); virDomainDiskDefPtr disk =3D job->disk; VIR_DEBUG("active commit job '%s' on VM '%s' failed", job->name, vm->d= ef->name); @@ -1346,6 +1355,10 @@ qemuBlockJobProcessEventFailedActiveCommit(virQEMUDr= iverPtr driver, if (!disk) return; + ignore_value(qemuMonitorTransactionBitmapRemove(actions, disk->mirror-= >nodeformat, + "libvirt-tmp-activewri= te")); + + /* Ideally, we would make the backing chain read only again (yes, SELi= nux * can do that using different labels). But that is not implemented ye= t and * not leaking security driver metadata is more important. */ diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 88517ba6a7..6256046762 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17312,9 +17312,9 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver, case QEMU_BLOCKJOB_TYPE_COPY: if (blockdev && !job->jobflagsmissing) { - g_autoptr(virHashTable) blockNamedNodeData =3D NULL; bool shallow =3D job->jobflags & VIR_DOMAIN_BLOCK_COPY_SHALLOW; bool reuse =3D job->jobflags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT; + g_autoptr(virHashTable) blockNamedNodeData =3D NULL; if (!(blockNamedNodeData =3D qemuBlockGetNamedNodeData(vm, QEM= U_ASYNC_JOB_NONE))) return -1; @@ -17352,16 +17352,15 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver, * the bitmaps if it wasn't present thus must skip this */ if (blockdev && virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN)) { - g_autoptr(virHashTable) blockNamedNodeData =3D NULL; - if (!(blockNamedNodeData =3D qemuBlockGetNamedNodeData(vm, QEM= U_ASYNC_JOB_NONE))) - return -1; + actions =3D virJSONValueNewArray(); - if (qemuBlockBitmapsHandleCommitFinish(job->data.commit.top, - job->data.commit.base, - blockNamedNodeData, - &actions, - job->data.commit.disabl= edBitmapsBase) < 0) + if (qemuMonitorTransactionBitmapAdd(actions, + job->data.commit.base->nod= eformat, + "libvirt-tmp-activewrite", + false, + false, + 0) < 0) return -1; } @@ -18482,7 +18481,6 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *nodebase =3D NULL; bool persistjob =3D false; bool blockdev =3D false; - g_autoptr(virJSONValue) bitmapDisableActions =3D NULL; VIR_AUTOSTRINGLIST bitmapDisableList =3D NULL; virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW | @@ -18647,27 +18645,6 @@ qemuDomainBlockCommit(virDomainPtr dom, goto endjob; } - if (blockdev && - virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN)) { - g_autoptr(virHashTable) blockNamedNodeData =3D NULL; - if (!(blockNamedNodeData =3D qemuBlockGetNamedNodeData(vm, QEMU_AS= YNC_JOB_NONE))) - goto endjob; - - if (qemuBlockBitmapsHandleCommitStart(topSource, baseSource, - blockNamedNodeData, - &bitmapDisableActions, - &bitmapDisableList) < 0) - goto endjob; - - /* if we don't have terminator on 'base' we can't reopen it */ - if (bitmapDisableActions && !baseSource->backingStore) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, - _("can't handle bitmaps on unterminated backing= image '%s'"), - base); - goto endjob; - } - } - if (!(job =3D qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSourc= e, baseSource, &bitmapDisableList, flags & VIR_DOMAIN_BLOCK_COMMIT_= DELETE, @@ -18692,23 +18669,6 @@ qemuDomainBlockCommit(virDomainPtr dom, !(backingPath =3D qemuBlockGetBackingStoreString(baseSource, f= alse))) goto endjob; - if (bitmapDisableActions) { - int rc; - - if (qemuBlockReopenReadWrite(vm, baseSource, QEMU_ASYNC_JOB_NO= NE) < 0) - goto endjob; - - qemuDomainObjEnterMonitor(driver, vm); - rc =3D qemuMonitorTransaction(priv->mon, &bitmapDisableActions= ); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto endjob; - - if (qemuBlockReopenReadOnly(vm, baseSource, QEMU_ASYNC_JOB_NON= E) < 0) - goto endjob; - - if (rc < 0) - goto endjob; - } } else { device =3D job->name; } diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index fd6dff82f9..5be98b9320 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -928,12 +928,11 @@ testQemuBlockBitmapBlockcommit(const void *opaque) g_autofree char *actual =3D NULL; g_autofree char *expectpath =3D NULL; - g_autoptr(virJSONValue) actionsDisable =3D NULL; g_autoptr(virJSONValue) actionsMerge =3D NULL; g_autoptr(virJSONValue) nodedatajson =3D NULL; g_autoptr(virHashTable) nodedata =3D NULL; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; - VIR_AUTOSTRINGLIST bitmapsDisable =3D NULL; + bool active =3D data->top =3D=3D data->chain; expectpath =3D g_strdup_printf("%s/%s%s", abs_srcdir, blockcommitPrefix, data->name); @@ -947,20 +946,10 @@ testQemuBlockBitmapBlockcommit(const void *opaque) return -1; } - if (qemuBlockBitmapsHandleCommitStart(data->top, data->base, nodedata, - &actionsDisable, &bitmapsDisable= ) < 0) - return -1; - - virBufferAddLit(&buf, "pre job bitmap disable:\n"); - - if (actionsDisable && - virJSONValueToBuffer(actionsDisable, &buf, true) < 0) - return -1; - virBufferAddLit(&buf, "merge bitmpas:\n"); - if (qemuBlockBitmapsHandleCommitFinish(data->top, data->base, nodedata, - &actionsMerge, bitmapsDisable) = < 0) + if (qemuBlockBitmapsHandleCommitFinish(data->top, data->base, active, = nodedata, + &actionsMerge) < 0) return -1; if (actionsMerge && @@ -1357,6 +1346,7 @@ mymain(void) #define TEST_BITMAP_BLOCKCOMMIT(testname, topimg, baseimg, ndf) \ do {\ blockbitmapblockcommitdata.name =3D testname; \ + blockbitmapblockcommitdata.chain =3D bitmapSourceChain; \ blockbitmapblockcommitdata.top =3D testQemuBitmapGetFakeChainEntry= (bitmapSourceChain, topimg); \ blockbitmapblockcommitdata.base =3D testQemuBitmapGetFakeChainEntr= y(bitmapSourceChain, baseimg); \ blockbitmapblockcommitdata.nodedatafile =3D ndf; \ diff --git a/tests/qemublocktestdata/bitmapblockcommit/empty b/tests/qemubl= ocktestdata/bitmapblockcommit/empty index bfc58f994e..9260011852 100644 --- a/tests/qemublocktestdata/bitmapblockcommit/empty +++ b/tests/qemublocktestdata/bitmapblockcommit/empty @@ -1,2 +1 @@ -pre job bitmap disable: merge bitmpas: --=20 2.26.2