From nobody Sun Feb 8 17:03:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 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=1583931493; cv=none; d=zohomail.com; s=zohoarc; b=akGJyNTGfrzj918VTM4sci4zCVDwzu4vGDQRN30Lvkw73Yc1ZxYk8BeLD6mmGlriqo9JYvYd+/VrqFijNS19uwsriYqmBvOu5/6g45JG4zNZOr5FqVrPgv9P7Foqj/OTF0vmWbidGa+x/Gxu3shPFy9pVFxcaM8imYw+KgYT6zU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931493; 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=Aj3+om9NLJroFkTfLnYku9xI+Vkn4yzJq+6qynAe+ik=; b=bbdrvtkJg1R7rhP1vT/jWHhYYx9ff8O733ClaKmrBBzcP7gHGFI0DfjzYGZqaXhI9PZHmdQym7dzN7zq/U9WTX7SIeFTTXYYaxu1vZ6I8jvlIQ1v6yZuw6x4TllOOkqqePwobroRM5/KLt3sow4ZNppceq+/RCXte1H6MSIkS+8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1583931493945438.56176874498556; Wed, 11 Mar 2020 05:58:13 -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-245-27iixedhMX-5zwOplfsNig-1; Wed, 11 Mar 2020 08:57:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B832800D48; Wed, 11 Mar 2020 12:57:22 +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 1D51C9298B; Wed, 11 Mar 2020 12:57:22 +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 C025B1832E2D; Wed, 11 Mar 2020 12:57:21 +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 02BCvKdA009512 for ; Wed, 11 Mar 2020 08:57:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 527155C557; Wed, 11 Mar 2020 12:57:20 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5823F5C1D8; Wed, 11 Mar 2020 12:57:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931491; 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=Aj3+om9NLJroFkTfLnYku9xI+Vkn4yzJq+6qynAe+ik=; b=Y3Icw6wZzjQmIZ5Dr4Xzr6ye53c5DIH7ivK6lWe5iwnmhQ5ZlGEqLIQaO8VLimRwEFsrcQ 4h0876dYfc1Ke1zIPavFUjccqPctCXEDYospkfEH7BSGhwLZ5RNNLFl5U4HO/GNx372iH5 HL6g55LOGxP/wgnAj/6uaQB9bpa/N9w= X-MC-Unique: 27iixedhMX-5zwOplfsNig-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 16/19] qemuDomainBlockCommit: Handle bitmaps on start of commit Date: Wed, 11 Mar 2020 13:56:01 +0100 Message-Id: <06c420609fae35c626d6fbd42d691eaaba76df97.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.15 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" On start of the commit job, we need to disable any active bitmap in the base. Use qemuBlockBitmapsHandleCommitStart to calculate which and call the appropriate QMP APIs. We use blockdev-reopen to make the 'base' writable to disable the bitmaps. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_driver.c | 43 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 31c0f2dd91..628fe9b107 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18399,6 +18399,8 @@ 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 | VIR_DOMAIN_BLOCK_COMMIT_ACTIVE | @@ -18555,8 +18557,29 @@ 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, NULL, + baseSource, &bitmapDisableList, flags & VIR_DOMAIN_BLOCK_COMMIT_= DELETE, flags))) goto endjob; @@ -18578,6 +18601,24 @@ qemuDomainBlockCommit(virDomainPtr dom, if (!backingPath && top_parent && !(backingPath =3D qemuBlockGetBackingStoreString(baseSource))) 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; } --=20 2.24.1