From nobody Sun Feb 8 21:29:03 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=1583342832; cv=none; d=zohomail.com; s=zohoarc; b=OE778F+sK32+QAJm6G0O9wIJywvul5PN6eTQ5Cv6lvF91bZ/jdoh/Nc/3PZq1rvkYhzwIvqpJfMSjdiT8JtRkiIARKCCtubO1hURJ1JaLHDeRzFdEm0sXJJEexl3iUQrja/rwLSPE8iYvOf0VIMaMWNQGAgqrhQd04gtHQP05Kc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583342832; h=Content-Type: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; bh=l4UMmBOcfJiHL63edluQkCJYjgw1b4qDX+mxY349l5I=; b=D4srEE5SpB/907MRL4LRP2Wi7hCdu10sbivxA9xtcCSvUz3otGEjgCLj5d9O3y9323b9xBI1h3SCyftuEb2lArJoOkmyQs/A7FpJTTT8ozo3Z1lrFjVdKC3vZ2z1y+r5LZQ9HOkU44hjylFrVOJZTR+R565uGNOAmyWA/p1eKgk= 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 1583342832236643.4429402334679; Wed, 4 Mar 2020 09:27:12 -0800 (PST) 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-215-ZU8nJoP6OMOXgTLu8r_YTA-1; Wed, 04 Mar 2020 12:27:08 -0500 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 46E57801E53; Wed, 4 Mar 2020 17:27:01 +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 16EC71000325; Wed, 4 Mar 2020 17:27:01 +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 BA73418034ED; Wed, 4 Mar 2020 17:27:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 024HQnht027307 for ; Wed, 4 Mar 2020 12:26:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 323AA8B56A; Wed, 4 Mar 2020 17:26:49 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84EF68B75C; Wed, 4 Mar 2020 17:26:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583342831; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=l4UMmBOcfJiHL63edluQkCJYjgw1b4qDX+mxY349l5I=; b=cObl6bCCCV77DRTNerfE28da9zL2ZiVbklYZPrK/p8j5pWXYz+qKPNUGb+Uaa54Dk+hRrS Km7EOzLgx35kfmlNx9pJxKQZTRqZdFVr57Y5P2KffwOghnAGfSJvCi/8YLGoMAM+9w2GJO H59ypuUxJzMuloBKBF/ltwxnxmdG/Sw= X-MC-Unique: ZU8nJoP6OMOXgTLu8r_YTA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/13] qemu: blockjob: Store list of bitmaps disabled prior to commit Date: Wed, 4 Mar 2020 18:26:31 +0100 Message-Id: <9293bc29efd001fe84f5909de9850f62ff9878c7.1583342236.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa 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" Starting a commit job will require disabling bitmaps in the base image so that they are not dirtied by the commit job. We need to store a list of the bitmaps so that we can later re-enable them. Add a field and status XML handling code as well as a test. Signed-off-by: Peter Krempa --- src/qemu/qemu_blockjob.h | 2 ++ src/qemu/qemu_domain.c | 26 +++++++++++++++++++ .../blockjob-blockdev-in.xml | 4 +++ 3 files changed, 32 insertions(+) diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index 72c7fa053e..e2e28ca4d3 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -88,6 +88,8 @@ struct _qemuBlockJobCommitData { virStorageSourcePtr top; virStorageSourcePtr base; bool deleteCommittedImages; + char **disabledBitmapsBase; /* a NULL-terminated list of bitmap names = which + were disabled in @base for the commit j= ob */ }; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0a478d2080..c5f4b0ae7f 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2534,6 +2534,9 @@ static void qemuDomainPrivateBlockJobFormatCommit(qemuBlockJobDataPtr job, virBufferPtr buf) { + g_auto(virBuffer) disabledBitmapsBuf =3D VIR_BUFFER_INIT_CHILD(buf); + char **bitmaps =3D job->data.commit.disabledBitmapsBase; + if (job->data.commit.base) virBufferAsprintf(buf, "\n", job->data.commit.b= ase->nodeformat); @@ -2545,6 +2548,11 @@ qemuDomainPrivateBlockJobFormatCommit(qemuBlockJobDa= taPtr job, if (job->data.commit.deleteCommittedImages) virBufferAddLit(buf, "\n"); + + while (bitmaps && *bitmaps) + virBufferEscapeString(&disabledBitmapsBuf, "\= n", *(bitmaps++)); + + virXMLFormatElement(buf, "disabledBaseBitmaps", NULL, &disabledBitmaps= Buf); } @@ -3157,6 +3165,9 @@ static int qemuDomainObjPrivateXMLParseBlockjobDataCommit(qemuBlockJobDataPtr job, xmlXPathContextPtr ctxt) { + g_autofree xmlNodePtr *nodes =3D NULL; + ssize_t nnodes; + if (job->type =3D=3D QEMU_BLOCKJOB_TYPE_COMMIT) { qemuDomainObjPrivateXMLParseBlockjobNodename(job, "string(./topparent/@= node)", @@ -3183,6 +3194,21 @@ qemuDomainObjPrivateXMLParseBlockjobDataCommit(qemuB= lockJobDataPtr job, !job->data.commit.base) return -1; + if ((nnodes =3D virXPathNodeSet("./disabledBaseBitmaps/bitmap", ctxt, = &nodes)) > 0) { + size_t i; + + job->data.commit.disabledBitmapsBase =3D g_new0(char *, nnodes + 1= ); + + for (i =3D 0; i < nnodes; i++) { + char *tmp; + + if (!(tmp =3D virXMLPropString(nodes[i], "name"))) + return -1; + + job->data.commit.disabledBitmapsBase[i] =3D g_steal_pointer(&t= mp); + } + } + return 0; } diff --git a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml b/tests/q= emustatusxml2xmldata/blockjob-blockdev-in.xml index ca6d110179..cc17a17ff4 100644 --- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml +++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml @@ -243,6 +243,10 @@ + + + + --=20 2.24.1