From nobody Mon Feb 9 03:48:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1583931547; cv=none; d=zohomail.com; s=zohoarc; b=bP18gE0gQvEzezU+4x1shaV4tps7afNl7KVtQR3itOOgkTmCjhxkknJpfVfrFbcwiMSvL+TsgrlM2NrCYv1mS5UvmbUH+PNmBCKKjHfntNcP1mQeJYHHtCnkWpd3YQYCx1MAsRw4gm7rwm4/C7ZCeZaGfnMlFMFeKLrHvie+7uQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931547; 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=KD9MJ5og2xeHf6FFGKdpKOsSFU3k+vKAC0lnhq/aAu0=; b=kJnkJHQattQmNZkbbGknb/6pFko3qu3RSVVaETv67HpuzTBBufygNmDUNI1bwWktBTqS9BQlDGV90Ev4u8x/vRQLtHaKk6G7aaLzZtLOgSnASg80ayh/J5Ky5TDRUHcwezhX5LYBdvecMde98SurIObaBNxsKxRQMgtxYCVK3eg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1583931547800171.00260329615492; Wed, 11 Mar 2020 05:59:07 -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-19-xe2vK390NRCZZAWmokKr9g-1; Wed, 11 Mar 2020 08:57:34 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 05FC91052BA0; Wed, 11 Mar 2020 12:57:28 +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 A3E8660C87; Wed, 11 Mar 2020 12:57:27 +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 574121832E37; Wed, 11 Mar 2020 12:57:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCvPe1009530 for ; Wed, 11 Mar 2020 08:57:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id E3FAB5C57E; Wed, 11 Mar 2020 12:57:25 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 943FD5C219; Wed, 11 Mar 2020 12:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931546; 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=KD9MJ5og2xeHf6FFGKdpKOsSFU3k+vKAC0lnhq/aAu0=; b=HxBtWap0KUtMyC2wVeyj3ZvRs/GbGb9GN5ZZvSXYeKx5nnIiYqZLlW6nWUxjrmlDIkdB+I plTaf9Ug6v8CwY/Ve9NET3ZyV1QBxcuiPdIbHdqrmXIjSLp0ILs2kEIcqIPFRFWE0aJmrW V/3lT7aG0LIaqQZPur8Vw2aZUH7sHyo= X-MC-Unique: xe2vK390NRCZZAWmokKr9g-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 17/19] qemuDomainBlockPivot: Handle merging of bitmaps when pivoting an active block-commit Date: Wed, 11 Mar 2020 13:56:02 +0100 Message-Id: <2446bea4afd1a76138dd02744ac092514be8ee32.1583930936.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.79 on 10.5.11.12 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" Active layer block commit makes the 'base' image the new top image of the disk after it finishes. This means that all bitmap operations need to be handled prior to this happening as we'd lose writes otherwise. The ideal place is to handle it when pivoting to the new image as only guest-writes would be happening after this point. Use qemuBlockBitmapsHandleCommitFinish to calculate the merging transaction. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_driver.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 628fe9b107..3afdecda1b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17301,6 +17301,23 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver, break; case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: + /* we technically don't need reopen here, but we couldn't prepare + * 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; + + if (qemuBlockBitmapsHandleCommitFinish(job->data.commit.top, + job->data.commit.base, + blockNamedNodeData, + &actions, + job->data.commit.disabl= edBitmapsBase) < 0) + return -1; + } + break; } --=20 2.24.1