From nobody Fri May 3 23:15:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1583342820; cv=none; d=zohomail.com; s=zohoarc; b=hqYBMkM2MRopAS1HrUqWozxlnvIH7X7kK9esg1trN3SAIWaPBhsPh/y1aQhjFXlM86LuDNgsWoGJBjAdqZbn3v0UCsals9Lbx9M+bpDvJ+LYxRY/ty0D+Ck36tpMelhdFazK0W7yGzvu1479B7g6u092Wv5gzXqssJKQDEXRaZg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583342820; 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=xrm2/Uq+i2/MPosidON/+nPvu/uG26FjXtpYhcsHdqg=; b=Fiqq6JnyVdHZ3WzMDHYA2GA3sb0UxK8VMut0pvywfH7UG8z0DmJ1I/GWHc6qyOmr+uOtesEoeviJg5QtVWw8pf5H4DYtxlSi7t4F5OY+2KJWAwj9JxdQ4y/M+SKMk9f3LW06rNsH3L+PNrFHsvt7+v9CStLeqU2qCCqirVr3GcY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1583342820331275.41619447441303; Wed, 4 Mar 2020 09:27:00 -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-400-mE-TtmHvOxScOzetW9l0Mg-1; Wed, 04 Mar 2020 12:26:57 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E51D6DB25; Wed, 4 Mar 2020 17:26:50 +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 EDA4A8B56A; Wed, 4 Mar 2020 17:26:49 +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 D0D5618034E9; Wed, 4 Mar 2020 17:26:48 +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 024HQlcU027286 for ; Wed, 4 Mar 2020 12:26:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 37B318D55E; Wed, 4 Mar 2020 17:26:47 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8ACF08B777; Wed, 4 Mar 2020 17:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583342819; 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=xrm2/Uq+i2/MPosidON/+nPvu/uG26FjXtpYhcsHdqg=; b=FXs6IIQnqsk7TMdscAdgJJc8dDTHDjFPw5e22LiKkr22oe/AMgSauN9I1QXkclIvszxWqg n1LJxLVRDNPhqFbiwOa38GDHZvvrh9s+QqtvURkwvs0o9usJ8HdF/F3o/DHGXx5cPZgKfl /cGHlYQWW7dW+8Ssib6ctsehawZcGNk= X-MC-Unique: mE-TtmHvOxScOzetW9l0Mg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 01/13] qemu: domain: Extract formatting of 'commit' blockjob data into a function Date: Wed, 4 Mar 2020 18:26:29 +0100 Message-Id: <685dbc1cb83253463b11ce4b0af335928dd4d6c4.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.79 on 10.5.11.11 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" I'll be adding more fields to care about so splitting the code out will be better long-term. Signed-off-by: Peter Krempa Reviewed-by: Pavel Mores --- src/qemu/qemu_domain.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 33c2158eb5..71d0a400cc 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2530,6 +2530,24 @@ qemuDomainObjPrivateXMLFormatBlockjobFormatSource(vi= rBufferPtr buf, } +static void +qemuDomainPrivateBlockJobFormatCommit(qemuBlockJobDataPtr job, + virBufferPtr buf) +{ + if (job->data.commit.base) + virBufferAsprintf(buf, "\n", job->data.commit.b= ase->nodeformat); + + if (job->data.commit.top) + virBufferAsprintf(buf, "\n", job->data.commit.to= p->nodeformat); + + if (job->data.commit.topparent) + virBufferAsprintf(buf, "\n", job->data.com= mit.topparent->nodeformat); + + if (job->data.commit.deleteCommittedImages) + virBufferAddLit(buf, "\n"); +} + + static int qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload, const void *name G_GNUC_UNUS= ED, @@ -2589,14 +2607,7 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *= payload, case QEMU_BLOCKJOB_TYPE_COMMIT: case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: - if (job->data.commit.base) - virBufferAsprintf(&childBuf, "\n", job-= >data.commit.base->nodeformat); - if (job->data.commit.top) - virBufferAsprintf(&childBuf, "\n", job->= data.commit.top->nodeformat); - if (job->data.commit.topparent) - virBufferAsprintf(&childBuf, "\n",= job->data.commit.topparent->nodeformat); - if (job->data.commit.deleteCommittedImages) - virBufferAddLit(&childBuf, "\n"); + qemuDomainPrivateBlockJobFormatCommit(job, &childBuf); break; case QEMU_BLOCKJOB_TYPE_CREATE: --=20 2.24.1 From nobody Fri May 3 23:15:00 2024 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=1583342904; cv=none; d=zohomail.com; s=zohoarc; b=eGUpgOBr8JcaTmAAY7VUD1u581AXJdg40SxSAAulH6KbbNe9HDRTYrjzl5GhHVRdPM1uPiXm6RBcaWmIBcUG8f1IBKPTH9uC+HOdO5kxzpxjph+LzRh+UdZ6kx89EoU5JEuQZzB3ZPLMBkyCXP3rHQYuF9KojliRwWenh8ozR5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583342904; 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=4aj2aAEbXgNgWFisB0xnv5x+KueFdKS+pQDnIGNp6XY=; b=cO1z6E3dyYYU1GrD4Bbp+JLgepXZkn7A/PiSTMS3kLAAVGwvm/Q/8Pm/OSD04pgMK74xjHglBpRR4dljpoWLwCxy3nhMobSyHRNgNOxA6S3mGEf8ozm+hI/maKiaTOBjqytsRlxV9QS1h0JoUqVL7AWnxM0CrkMVyEqhnxev6R0= 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-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1583342904755912.619638413621; Wed, 4 Mar 2020 09:28:24 -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-234-8as65UovN9WonJTEcEmOlg-1; Wed, 04 Mar 2020 12:27:09 -0500 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 5AD371060DF7; 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 2CB4B60BF3; 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 D4DBD18034EF; 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 024HQmlw027299 for ; Wed, 4 Mar 2020 12:26:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 357218B56A; Wed, 4 Mar 2020 17:26:48 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 887088D55E; Wed, 4 Mar 2020 17:26:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583342903; 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=4aj2aAEbXgNgWFisB0xnv5x+KueFdKS+pQDnIGNp6XY=; b=Ofqen6lpJRJ3isdSgxjBrXOyihwq9GKMgV9dCD1mI33A+uCX2Ya7/8RV657X6M8a29LhfB 6iB38e0vfzJBNT1UWiNpNhALh5BBRAYdsAMaMcM8jMuiTDrQQX4qnPj5wtjh/hCHP1sdvm P623XWRbxti9ASowCjPKcT0+mz/kCBQ= X-MC-Unique: 8as65UovN9WonJTEcEmOlg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/13] qemu: domain: Extract parsing of 'commit' blockjob data into a function Date: Wed, 4 Mar 2020 18:26:30 +0100 Message-Id: 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.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" I'll be adding more fields to care about so splitting the code out will be better long-term. Signed-off-by: Peter Krempa Reviewed-by: Pavel Mores --- src/qemu/qemu_domain.c | 57 ++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 71d0a400cc..0a478d2080 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3153,6 +3153,40 @@ qemuDomainObjPrivateXMLParseBlockjobNodename(qemuBlo= ckJobDataPtr job, } +static int +qemuDomainObjPrivateXMLParseBlockjobDataCommit(qemuBlockJobDataPtr job, + xmlXPathContextPtr ctxt) +{ + if (job->type =3D=3D QEMU_BLOCKJOB_TYPE_COMMIT) { + qemuDomainObjPrivateXMLParseBlockjobNodename(job, + "string(./topparent/@= node)", + &job->data.commit.top= parent, + ctxt); + + if (!job->data.commit.topparent) + return -1; + } + + qemuDomainObjPrivateXMLParseBlockjobNodename(job, + "string(./top/@node)", + &job->data.commit.top, + ctxt); + qemuDomainObjPrivateXMLParseBlockjobNodename(job, + "string(./base/@node)", + &job->data.commit.base, + ctxt); + + if (virXPathNode("./deleteCommittedImages", ctxt)) + job->data.commit.deleteCommittedImages =3D true; + + if (!job->data.commit.top || + !job->data.commit.base) + return -1; + + return 0; +} + + static void qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qemuBlockJobDataPtr job, xmlXPathContextPtr ctxt, @@ -3172,29 +3206,10 @@ qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qe= muBlockJobDataPtr job, break; case QEMU_BLOCKJOB_TYPE_COMMIT: - qemuDomainObjPrivateXMLParseBlockjobNodename(job, - "string(./toppare= nt/@node)", - &job->data.commit= .topparent, - ctxt); - - if (!job->data.commit.topparent) - goto broken; - - G_GNUC_FALLTHROUGH; case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: - qemuDomainObjPrivateXMLParseBlockjobNodename(job, - "string(./top/@no= de)", - &job->data.commit= .top, - ctxt); - qemuDomainObjPrivateXMLParseBlockjobNodename(job, - "string(./base/@n= ode)", - &job->data.commit= .base, - ctxt); - if (virXPathNode("./deleteCommittedImages", ctxt)) - job->data.commit.deleteCommittedImages =3D true; - if (!job->data.commit.top || - !job->data.commit.base) + if (qemuDomainObjPrivateXMLParseBlockjobDataCommit(job, ctxt) = < 0) goto broken; + break; case QEMU_BLOCKJOB_TYPE_CREATE: --=20 2.24.1 From nobody Fri May 3 23:15:00 2024 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 From nobody Fri May 3 23:15:00 2024 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=1583342890; cv=none; d=zohomail.com; s=zohoarc; b=MrFZEEzZVXljxuh15xzTFsF6sNhTMD7A2xgK2xJtEnRFHrSEX7/+gGTF0bYPdGC6GxxbJa/bG0mB0rZsHq+HDY5N6jp/YnlcV3C6bdqiRDcyEhKEubzzJ1YLc3l6h/AthJ2gQMDzcKTpCeg2YGR8H8VE+7s/va8vzB9RKIbUYmA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583342890; 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=Ej7xAJ3ndZpV4aEDLx+MHkiCpALelVnvz4w9JQWI6VI=; b=mdNie0OwM5vOAp5P8DGJJKLJRoXXPOgWeUo5mRTSm+XBN9do2mMuGRFSdU5vdDplZz4ZnqX/1G5kmkrSd1o4gXXko1oPkz2TefzfIN1lgVOGMalDNXs+poqMZ1jZsK6JMYXr5M71NX7bWPCGaQACdKchnuS2AsUkhBp7me4+OqM= 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 158334289004738.52033197775813; Wed, 4 Mar 2020 09:28:10 -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-236-aLJ4pfflOaWCmx2H8CpsPQ-1; Wed, 04 Mar 2020 12:27:18 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3732818C43EA; Wed, 4 Mar 2020 17:27:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 00BD292D40; Wed, 4 Mar 2020 17:27: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 8217086A09; Wed, 4 Mar 2020 17:27:05 +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 024HQoJA027320 for ; Wed, 4 Mar 2020 12:26:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2DC888B75C; Wed, 4 Mar 2020 17:26:50 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 811D919E9C; Wed, 4 Mar 2020 17:26:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583342889; 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=Ej7xAJ3ndZpV4aEDLx+MHkiCpALelVnvz4w9JQWI6VI=; b=etuaG2ClaeC/vsDIrLeXhbhMQyfZSpbQxSM8yiLpmLkVL/JO0FdJYIeP9rakKXdAgtwQ2J RTXm1jUnKzpVyD6553Af+l1HvpGZf3WS4OMlPDif06HVLsl5BnOL+c9AZFG3Giv0IvNNrN mVLHL7Sd1+nWi8QWac+jb7ErG8cAJIw= X-MC-Unique: aLJ4pfflOaWCmx2H8CpsPQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/13] qemublocktest: Fix and optimize fake image chain Date: Wed, 4 Mar 2020 18:26:32 +0100 Message-Id: <1d615f887e816fcee914455ca569804bf40f043d.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.79 on 10.5.11.13 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" Set the 'id' field of the backing chain properly so that we can look up images and initialize 6 images instead of 10 as we don't use more currently. Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 7b7948d4c6..a6b6376c7d 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -570,6 +570,7 @@ testQemuBackupIncrementalBitmapCalculateGetFakeImage(si= ze_t idx) if (!(ret =3D virStorageSourceNew())) abort(); + ret->id =3D idx; ret->type =3D VIR_STORAGE_TYPE_FILE; ret->format =3D VIR_STORAGE_FILE_QCOW2; ret->path =3D g_strdup_printf("/image%zu", idx); @@ -589,7 +590,7 @@ testQemuBackupIncrementalBitmapCalculateGetFakeChain(vo= id) n =3D ret =3D testQemuBackupIncrementalBitmapCalculateGetFakeImage(1); - for (i =3D 2; i < 10; i++) { + for (i =3D 2; i < 6; i++) { n->backingStore =3D testQemuBackupIncrementalBitmapCalculateGetFak= eImage(i); n =3D n->backingStore; } --=20 2.24.1 From nobody Fri May 3 23:15:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1583342822; cv=none; d=zohomail.com; s=zohoarc; b=RU+IBqR/tVvnoK1GtZQ5hnWgydShIlSBhYsWCLKCcjyumDwAz3obZ/9w2kt8vr8fmAqdEYjoJZ83f/jI8PNkWp3QvvVpHbnl3rz+V4zXCub0F9iM7Ko2a1CclaukuXOo9CdpZWc0Ym414iUTX99GXFK12KjdA5nfJJ4w9qEYjzU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583342822; 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=bQIKSAB9dmLLj2+iQ9rOtsuoeX+ZEBB1U2atozbQITU=; b=cGnrAoF/58Z2zOJI+fNNZ4zqL1DAdYWN2BRDOsX+SZBAs1iBdrsooRmxxqjpefDHuIw+xMTQQ7E0uw6KxY61WnBIlMusVMOu8O9WT1csuxSkKLr104qQvT5hUBxwz3ww31ZlHidL4QeJLFFv2D72XC00tbUt+bMV3OCZa4KL0As= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1583342822733301.8674010670086; Wed, 4 Mar 2020 09:27:02 -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-316-AKDTZHr6ON-lAsXsRrw3KQ-1; Wed, 04 Mar 2020 12:26:59 -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 C13B91088389; Wed, 4 Mar 2020 17:26:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8FC5910027A7; Wed, 4 Mar 2020 17:26:53 +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 3D8DF860D7; Wed, 4 Mar 2020 17:26:53 +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 024HQpki027331 for ; Wed, 4 Mar 2020 12:26:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2ABC28B75C; Wed, 4 Mar 2020 17:26:51 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7D48F19E9C; Wed, 4 Mar 2020 17:26:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583342821; 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=bQIKSAB9dmLLj2+iQ9rOtsuoeX+ZEBB1U2atozbQITU=; b=LoW86ZyniIrJyJI2Xfd3AY7l7Q1tZ5FmL4Xqul4q+TAEtZjwODHKSX2/xtyP1pgOIaseU8 7y7MOM9b4c75SbE9HiiFF2vAtiov5h4WysU5M/VR624I0+f/dkqpKtT3wFMBy4lZ0IP7ew wHOWse9oc1eK9/EXr3OY1Qh+neT+ITg= X-MC-Unique: AKDTZHr6ON-lAsXsRrw3KQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/13] qemu: block: Implement helpers for dealing with bitmaps during block commit Date: Wed, 4 Mar 2020 18:26:33 +0100 Message-Id: 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" qemuBlockBitmapsHandleCommitStart prepares for disabling the bitmaps in the 'base' of the commit job so that the bitmaps are not dirtied by the commit job. This needs to be done prior to start of the commit job. qemuBlockBitmapsHandleCommitFinish then calculates the necessary merges that agregate all the bitmaps between the commited images and write them into the base bitmap. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 217 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_block.h | 14 +++ 2 files changed, 231 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 11df8eedd0..2467315563 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -2962,6 +2962,223 @@ 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 hanlding 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 top, + 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 true; + size_t i; + + if (!(entry =3D virHashLookup(blockNamedNodeData, basesrc->nodeformat)= )) + return 0; + + bitmaplist =3D g_new0(char *, entry->nbitmaps); + + for (i =3D 0; i < entry->nbitmaps; i++) { + qemuBlockNamedNodeDataBitmapPtr bitmap =3D entry->bitmaps[i]; + + if (!bitmap->recording || bitmap->inconsistent || + !qemuBlockBitmapChainIsValid(top, bitmap->name, blockNamedNode= Data)) + 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-> enab= le, + 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 + * @blockNamedNodeData: hash table containing data about bitmaps + * @actions: filled with arguments for a 'transaction' command + * @disabledBitmapsBase: bitmap names which were disabled + * + * Calculates the necessary bitmap merges/additions/enablements to properly + * handle commit of images from 'top' into 'base'. The necessary operations + * in form of argumets of the 'transaction' command are filled into 'actio= ns' + * if there is anything to do. Otherwise NULL is returned. + */ +int +qemuBlockBitmapsHandleCommitFinish(virStorageSourcePtr topsrc, + virStorageSourcePtr basesrc, + virHashTablePtr blockNamedNodeData, + virJSONValuePtr *actions, + char **disabledBitmapsBase) +{ + 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); + + /* 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 (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 { + char **disabledbitmaps =3D disabledBitmapsBase; + + for (disabledbitmaps =3D disabledBitmapsBase; *disabledbit= maps; disabledbitmaps++) { + if (STREQ(*disabledBitmapsBase, bitmap->name)) { + bitmapdata =3D g_new0(struct qemuBlockBitmapsHandl= eCommitData, 1); + + bitmapdata->create =3D false; + bitmapdata->enable =3D true; + bitmapdata->basenode =3D basesrc->nodeformat; + bitmapdata->granularity =3D bitmap->granularity; + bitmapdata->persistent =3D bitmap->persistent; + + if (virHashAddEntry(commitdata, bitmap->name, bitm= apdata) < 0) { + qemuBlockBitmapsHandleCommitDataFree(bitmapdat= a); + return -1; + } + + break; + } + } + } + } + } + + if (virHashForEach(commitdata, qemuBlockBitmapsHandleCommitFinishItera= te, act) < 0) + return -1; + + if (virJSONValueArraySize(act) > 0) + *actions =3D g_steal_pointer(&act); + + return 0; +} + + /** * qemuBlockReopenFormat: * @vm: domain object diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index b3d7d0f876..cb408d2eee 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -229,6 +229,20 @@ qemuBlockBitmapsHandleBlockcopy(virStorageSourcePtr sr= c, bool shallow, virJSONValuePtr *actions); +int +qemuBlockBitmapsHandleCommitStart(virStorageSourcePtr topsrc, + virStorageSourcePtr basesrc, + virHashTablePtr blockNamedNodeData, + virJSONValuePtr *actions, + char ***disabledBitmapsBase); + +int +qemuBlockBitmapsHandleCommitFinish(virStorageSourcePtr topsrc, + virStorageSourcePtr basesrc, + virHashTablePtr blockNamedNodeData, + virJSONValuePtr *actions, + char **disabledBitmapsBase); + int qemuBlockReopenFormat(virDomainObjPtr vm, virStorageSourcePtr src, --=20 2.24.1 From nobody Fri May 3 23:15:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1583342838; cv=none; d=zohomail.com; s=zohoarc; b=H4VcbFy/hvzLW1VXGku3BAugSvYfmewU5IwlJipus3G6vsknvvnlyhxeuA00q4hrxSZD8LZ8DZukZFbSdo0eyz9gRSrqD+VQBVogctFkeEzx9cKHMe9GJqz3gFtBNvOo2T8Hoo9xNhrDoMqtQ/TFHCJEjSn0Vtii2bFaSnmNRrk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583342838; 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=y64Unc/Lb2OB8G1lC7KpPPkEjEbk5y1+cy5p8VINBqo=; b=bxzeXjNd74XWTPjFLPRwUGBXERLqT+CCrrPa9McbinP31YTYszTL2tIp6qFn2vBWYvq7q363lyTLEWjW18YrtCgjPtzk+CEbgM/dmJBc1tMqvIc4o7KBxMDXNdt3J8l/3n53lNhMSHqZsfZzljILvHWhYiTSMQOhMS+PA8nkC6k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1583342838304318.63613631314934; Wed, 4 Mar 2020 09:27:18 -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-2-k2Lsd7eiPhuNpYDuG6a_vA-1; Wed, 04 Mar 2020 12:27:14 -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 172501081FB0; Wed, 4 Mar 2020 17:27:07 +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 DFF5F1000325; Wed, 4 Mar 2020 17:27: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 82AF318034EE; Wed, 4 Mar 2020 17:27:06 +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 024HQq8q027342 for ; Wed, 4 Mar 2020 12:26:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 274EE8B75C; Wed, 4 Mar 2020 17:26:52 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7940819E9C; Wed, 4 Mar 2020 17:26:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583342837; 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=y64Unc/Lb2OB8G1lC7KpPPkEjEbk5y1+cy5p8VINBqo=; b=hweI87Y0Z6JIpLBU8hv26F7l7mUNAgs9LBTFD7GVcZhgVhogrjhV8GuxVHH0U/5YPGUs4I 3p9zR0CkNgpnfyJdzbh/h8bBs9E82cdfUxdxNP6pn1R/DvOMFtBrNb6xNyviKDuUvFoEkq TsqRpK5eCrKa22FBNetpvSnkrY5ZSjQ= X-MC-Unique: k2Lsd7eiPhuNpYDuG6a_vA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/13] qemublocktest: Add tests for handling of bitmaps during block-commit Date: Wed, 4 Mar 2020 18:26:34 +0100 Message-Id: <69a1eaa05f5335966d8b4cbd428eb802fa57ffb7.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" Add code for testing the two necessary steps of handling bitmaps during block commit and excercise the code on the test data which we have for bitmap handling. Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 95 ++++++++++++++ .../bitmapblockcommit/basic-1-2 | 119 ++++++++++++++++++ .../bitmapblockcommit/basic-1-3 | 119 ++++++++++++++++++ .../bitmapblockcommit/basic-2-3 | 2 + 4 files changed, 335 insertions(+) create mode 100644 tests/qemublocktestdata/bitmapblockcommit/basic-1-2 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/basic-1-3 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/basic-2-3 diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index a6b6376c7d..3662fee42a 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -599,6 +599,21 @@ testQemuBackupIncrementalBitmapCalculateGetFakeChain(v= oid) } +static virStorageSourcePtr +testQemuBitmapGetFakeChainEntry(virStorageSourcePtr src, + size_t idx) +{ + virStorageSourcePtr n; + + for (n =3D src; n; n =3D n->backingStore) { + if (n->id =3D=3D idx) + return n; + } + + return NULL; +} + + typedef virDomainMomentDefPtr testMomentList; static void @@ -853,6 +868,68 @@ testQemuBlockBitmapBlockcopy(const void *opaque) return virTestCompareToFile(actual, expectpath); } +static const char *blockcommitPrefix =3D "qemublocktestdata/bitmapblockcom= mit/"; + +struct testQemuBlockBitmapBlockcommitData { + const char *name; + virStorageSourcePtr top; + virStorageSourcePtr base; + virStorageSourcePtr chain; + const char *nodedatafile; +}; + + +static int +testQemuBlockBitmapBlockcommit(const void *opaque) +{ + const struct testQemuBlockBitmapBlockcommitData *data =3D 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; + + expectpath =3D g_strdup_printf("%s/%s%s", abs_srcdir, + blockcommitPrefix, data->name); + + if (!(nodedatajson =3D virTestLoadFileJSON(bitmapDetectPrefix, data->n= odedatafile, + ".json", NULL))) + return -1; + + if (!(nodedata =3D qemuMonitorJSONBlockGetNamedNodeDataJSON(nodedatajs= on))) { + VIR_TEST_VERBOSE("failed to load nodedata JSON\n"); + 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) + return -1; + + if (actionsMerge && + virJSONValueToBuffer(actionsMerge, &buf, true) < 0) + return -1; + + actual =3D virBufferContentAndReset(&buf); + + return virTestCompareToFile(actual, expectpath); +} + static int mymain(void) @@ -866,6 +943,7 @@ mymain(void) struct testQemuCheckpointDeleteMergeData checkpointdeletedata; struct testQemuBlockBitmapValidateData blockbitmapvalidatedata; struct testQemuBlockBitmapBlockcopyData blockbitmapblockcopydata; + struct testQemuBlockBitmapBlockcommitData blockbitmapblockcommitdata; char *capslatest_x86_64 =3D NULL; virQEMUCapsPtr caps_x86_64 =3D NULL; g_autoptr(virStorageSource) bitmapSourceChain =3D NULL; @@ -1196,6 +1274,23 @@ mymain(void) TEST_BITMAP_BLOCKCOPY("snapshots-shallow", true, "snapshots"); TEST_BITMAP_BLOCKCOPY("snapshots-deep", false, "snapshots"); + +#define TEST_BITMAP_BLOCKCOMMIT(testname, topimg, baseimg, ndf) \ + do {\ + blockbitmapblockcommitdata.name =3D testname; \ + blockbitmapblockcommitdata.top =3D testQemuBitmapGetFakeChainEntry= (bitmapSourceChain, topimg); \ + blockbitmapblockcommitdata.base =3D testQemuBitmapGetFakeChainEntr= y(bitmapSourceChain, baseimg); \ + blockbitmapblockcommitdata.nodedatafile =3D ndf; \ + if (virTestRun("bitmap block commit " testname, \ + testQemuBlockBitmapBlockcommit, \ + &blockbitmapblockcommitdata) < 0) \ + ret =3D -1; \ + } while (0) + + TEST_BITMAP_BLOCKCOMMIT("basic-1-2", 1, 2, "basic"); + TEST_BITMAP_BLOCKCOMMIT("basic-1-3", 1, 3, "basic"); + TEST_BITMAP_BLOCKCOMMIT("basic-2-3", 2, 3, "basic"); + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/bitmapblockcommit/basic-1-2 b/tests/qe= mublocktestdata/bitmapblockcommit/basic-1-2 new file mode 100644 index 0000000000..8eeb4c3a11 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/basic-1-2 @@ -0,0 +1,119 @@ +pre job bitmap disable: +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-2-format", + "name": "a", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "a" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-2-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-2-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-2-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-2-format", + "name": "d", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/basic-1-3 b/tests/qe= mublocktestdata/bitmapblockcommit/basic-1-3 new file mode 100644 index 0000000000..71b48e31a5 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/basic-1-3 @@ -0,0 +1,119 @@ +pre job bitmap disable: +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "a", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "a" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "d", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/basic-2-3 b/tests/qe= mublocktestdata/bitmapblockcommit/basic-2-3 new file mode 100644 index 0000000000..bfc58f994e --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/basic-2-3 @@ -0,0 +1,2 @@ +pre job bitmap disable: +merge bitmpas: --=20 2.24.1 From nobody Fri May 3 23:15:00 2024 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=1583342844; cv=none; d=zohomail.com; s=zohoarc; b=cNPdnUTNChvuq9213GUTOV1nODTxG0e0QJT3FwtC18ftoJULkeRUwwnuV2ZLYoxrAvje1TyHNKtaYcvsy/OavWLic5KLfyF3HVjJngm64UEUC0HPG4WRe1Br3wEH+8FZ6Ux9MSBC7/k+DlsPd/U7NxLpQMmlxq56RjjdGHr6Jcc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583342844; 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=jOz7rGJmyUCksppBjQAGk2g+X0EH95CiM+VQMI3IRJc=; b=bww/nyaKKSCpuWkbHfw778YDsvjwc47842mYhnwOQYP/cOrDBe+Q39kgItOc9PxKMJzUVukCwXF+Lx2Y07hsYeqLhzmCbKxL2i9FCG3PBv0KqBcKFvump+41LacA8ux2yN3IjOQu2UncRwpXopPYCQFPCGzgOrgccXgLuagLRJY= 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 1583342844111921.142563395505; Wed, 4 Mar 2020 09:27:24 -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-107-ZB4lu_39PKGCwOGAi6m1jA-1; Wed, 04 Mar 2020 12:27:18 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id BA2F4801F8E; Wed, 4 Mar 2020 17:27:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8123726FDF; Wed, 4 Mar 2020 17:27:10 +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 258E686A0A; Wed, 4 Mar 2020 17:27:10 +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 024HQrrd027351 for ; Wed, 4 Mar 2020 12:26:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4C28F19E9C; Wed, 4 Mar 2020 17:26:53 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 776898B75C; Wed, 4 Mar 2020 17:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583342843; 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=jOz7rGJmyUCksppBjQAGk2g+X0EH95CiM+VQMI3IRJc=; b=To7bOmTswhkStiqYg0rMz9jWCInwPzVuxN6mMw1X7qNdQbr5/juGmANvr0AViGdAg5fdtJ L9oeF1fRrwM3I7k1OhSXZb67vlAhzyjI65B1CyLiZQVVpTcycPJbNcwSXNzLvVILRuodqL h0F4cvuwirLxwIb17fYbj0grdhu1ops= X-MC-Unique: ZB4lu_39PKGCwOGAi6m1jA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/13] qemublocktest: Add more tests for block-commit bitmap handling with snapshots Date: Wed, 4 Mar 2020 18:26:35 +0100 Message-Id: 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.23 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" Test handling of more complex cases of merging bitmaps accross snapshots. Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 15 ++ .../bitmapblockcommit/snapshots-1-2 | 49 +++++++ .../bitmapblockcommit/snapshots-1-3 | 76 ++++++++++ .../bitmapblockcommit/snapshots-1-4 | 126 +++++++++++++++++ .../bitmapblockcommit/snapshots-1-5 | 130 ++++++++++++++++++ .../bitmapblockcommit/snapshots-2-3 | 49 +++++++ .../bitmapblockcommit/snapshots-2-4 | 99 +++++++++++++ .../bitmapblockcommit/snapshots-2-5 | 103 ++++++++++++++ .../bitmapblockcommit/snapshots-3-4 | 72 ++++++++++ .../bitmapblockcommit/snapshots-3-5 | 76 ++++++++++ .../bitmapblockcommit/snapshots-4-4 | 11 ++ .../bitmapblockcommit/snapshots-4-5 | 33 +++++ 12 files changed, 839 insertions(+) create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-1-2 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-1-3 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-1-4 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-1-5 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-2-3 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-2-4 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-2-5 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-3-4 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-3-5 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-4-4 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-4-5 diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 3662fee42a..5eb38c3981 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -1291,6 +1291,21 @@ mymain(void) TEST_BITMAP_BLOCKCOMMIT("basic-1-3", 1, 3, "basic"); TEST_BITMAP_BLOCKCOMMIT("basic-2-3", 2, 3, "basic"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-1-2", 1, 2, "snapshots"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-1-3", 1, 3, "snapshots"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-1-4", 1, 4, "snapshots"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-1-5", 1, 5, "snapshots"); + + TEST_BITMAP_BLOCKCOMMIT("snapshots-2-3", 2, 3, "snapshots"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-2-4", 2, 4, "snapshots"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-2-5", 2, 5, "snapshots"); + + TEST_BITMAP_BLOCKCOMMIT("snapshots-3-4", 3, 4, "snapshots"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-3-5", 3, 5, "snapshots"); + + TEST_BITMAP_BLOCKCOMMIT("snapshots-4-5", 4, 5, "snapshots"); + + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-2 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-1-2 new file mode 100644 index 0000000000..0015b9ceb3 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-2 @@ -0,0 +1,49 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-2-format", + "name": "d" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-2-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-3 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-1-3 new file mode 100644 index 0000000000..5691b408aa --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-3 @@ -0,0 +1,76 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-3-format", + "name": "c" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "d", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + }, + { + "node": "libvirt-2-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-4 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-1-4 new file mode 100644 index 0000000000..454001531a --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-4 @@ -0,0 +1,126 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-4-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "a" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + }, + { + "node": "libvirt-3-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "d", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + }, + { + "node": "libvirt-2-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-5 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-1-5 new file mode 100644 index 0000000000..2fd43d7917 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-5 @@ -0,0 +1,130 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "a" + }, + { + "node": "libvirt-4-format", + "name": "a" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + }, + { + "node": "libvirt-3-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "d", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + }, + { + "node": "libvirt-2-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-3 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-2-3 new file mode 100644 index 0000000000..d719a90bd7 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-3 @@ -0,0 +1,49 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-3-format", + "name": "c" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "d", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-4 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-2-4 new file mode 100644 index 0000000000..9e37962344 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-4 @@ -0,0 +1,99 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-4-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "a" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + }, + { + "node": "libvirt-3-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "d", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-5 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-2-5 new file mode 100644 index 0000000000..d6b20a5d05 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-5 @@ -0,0 +1,103 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "a" + }, + { + "node": "libvirt-4-format", + "name": "a" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + }, + { + "node": "libvirt-3-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "d", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-3-4 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-3-4 new file mode 100644 index 0000000000..b96e8910d7 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-3-4 @@ -0,0 +1,72 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-4-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "a" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "c", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-3-5 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-3-5 new file mode 100644 index 0000000000..9570c34c40 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-3-5 @@ -0,0 +1,76 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "a" + }, + { + "node": "libvirt-4-format", + "name": "a" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "c", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-4-4 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-4-4 new file mode 100644 index 0000000000..a445fd7c49 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-4-4 @@ -0,0 +1,11 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] +merge bitmpas: diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-4-5 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-4-5 new file mode 100644 index 0000000000..7e1020d96e --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-4-5 @@ -0,0 +1,33 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-enable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-4-format", + "name": "a" + } + ] + } + } +] --=20 2.24.1 From nobody Fri May 3 23:15:00 2024 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=1583342845; cv=none; d=zohomail.com; s=zohoarc; b=ZQ1MW1/CkPxx0WjqjHK4BmaEPbkIuxy0sXpahIK9Z+SsE1HyPc5HQU5bW3Oe38foqEavMOhOnH0YP9w3CyFiqXUVVsfnZ94wAq2UWz1MdvhkcAqt5Y3F+mEABS2ODaHyMGA/MuEn3IgTAdfJ5f83xWwV+RHIX4x6YddVSf9jv6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583342845; 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=D2XNkuUA4PfSwK1QtETLad+lCppapb/GFUQrGFN1T78=; b=l/1Ruspgm6mdoa2S0YpdZp4YcN51c9Dw4UQf5j2BQru1/uHW3s/z4fs/EDGZ6zmkU54MZmtkBaQH0y+aY0yoUxsTw61bA3qp4DnYLVtZiFmMD4fCZAV/2gqxFAIOCbGojc9rF5RyJADtWh+S6LDzgwtXacu9rnzlGuDRmNnLak4= 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 1583342845885915.5294499143695; Wed, 4 Mar 2020 09:27:25 -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-208-jQHpvEu_OPifS6cPPqEX2Q-1; Wed, 04 Mar 2020 12:27:21 -0500 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 85B9F1081FAF; Wed, 4 Mar 2020 17:27:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5744E60F89; Wed, 4 Mar 2020 17:27:14 +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 11A5A86A10; Wed, 4 Mar 2020 17:27:14 +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 024HQsLf027361 for ; Wed, 4 Mar 2020 12:26:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4E1898D57F; Wed, 4 Mar 2020 17:26:54 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C2608D55E; Wed, 4 Mar 2020 17:26:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583342844; 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=D2XNkuUA4PfSwK1QtETLad+lCppapb/GFUQrGFN1T78=; b=KAIQRY9bpg1iZKIQaC73CT1/9oLLn1BxCSzkqV0qlAyKbryPz1nmXvxw4jCO66ptiLwXf8 oaAqDFvDs6tcss+GZoCRHBvtlCYGR1+gP95E1Q+o6cfgWEQwuI2UxqtP0jBx9VPiSwulan DdvA0Mgj3/BeCy/XBmDl1NubdaPsJJs= X-MC-Unique: jQHpvEu_OPifS6cPPqEX2Q-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/13] qemublocktest: Add tests of broken bitmap chain handling during block-commit Date: Wed, 4 Mar 2020 18:26:36 +0100 Message-Id: <337f1c9679909d75a0052e522c03de089b839e05.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.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" Use the 'snapshots-synthetic-broken' test data for block-commit. Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 13 ++++ .../snapshots-synthetic-broken-1-2 | 30 ++++++++ .../snapshots-synthetic-broken-1-3 | 66 ++++++++++++++++ .../snapshots-synthetic-broken-1-4 | 76 +++++++++++++++++++ .../snapshots-synthetic-broken-1-5 | 76 +++++++++++++++++++ .../snapshots-synthetic-broken-2-3 | 43 +++++++++++ .../snapshots-synthetic-broken-2-4 | 53 +++++++++++++ .../snapshots-synthetic-broken-2-5 | 53 +++++++++++++ .../snapshots-synthetic-broken-3-4 | 30 ++++++++ .../snapshots-synthetic-broken-3-5 | 30 ++++++++ .../snapshots-synthetic-broken-4-5 | 20 +++++ 11 files changed, 490 insertions(+) create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-1-2 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-1-3 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-1-4 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-1-5 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-2-3 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-2-4 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-2-5 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-3-4 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-3-5 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-4-5 diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 5eb38c3981..b782e7969d 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -1305,6 +1305,19 @@ mymain(void) TEST_BITMAP_BLOCKCOMMIT("snapshots-4-5", 4, 5, "snapshots"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-1-2", 1, 2, "snaps= hots-synthetic-broken"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-1-3", 1, 3, "snaps= hots-synthetic-broken"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-1-4", 1, 4, "snaps= hots-synthetic-broken"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-1-5", 1, 5, "snaps= hots-synthetic-broken"); + + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-2-3", 2, 3, "snaps= hots-synthetic-broken"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-2-4", 2, 4, "snaps= hots-synthetic-broken"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-2-5", 2, 5, "snaps= hots-synthetic-broken"); + + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-3-4", 3, 4, "snaps= hots-synthetic-broken"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-3-5", 3, 5, "snaps= hots-synthetic-broken"); + + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-4-5", 4, 5, "snaps= hots-synthetic-broken"); cleanup: virHashFree(diskxmljsondata.schema); diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-2 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-2 new file mode 100644 index 0000000000..ab269d9256 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 1-2 @@ -0,0 +1,30 @@ +pre job bitmap disable: +[ + +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-2-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-3 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-3 new file mode 100644 index 0000000000..6eb14f927a --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 1-3 @@ -0,0 +1,66 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-3-format", + "name": "b" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-enable", + "data": { + "node": "libvirt-3-format", + "name": "b" + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-4 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-4 new file mode 100644 index 0000000000..fbf2bc0554 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 1-4 @@ -0,0 +1,76 @@ +pre job bitmap disable: +[ + +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "b", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-5 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-5 new file mode 100644 index 0000000000..477f921050 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 1-5 @@ -0,0 +1,76 @@ +pre job bitmap disable: +[ + +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "b", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-2-3 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-2-3 new file mode 100644 index 0000000000..d468e2b9d8 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 2-3 @@ -0,0 +1,43 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-3-format", + "name": "b" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-enable", + "data": { + "node": "libvirt-3-format", + "name": "b" + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-2-4 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-2-4 new file mode 100644 index 0000000000..d5bce940d9 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 2-4 @@ -0,0 +1,53 @@ +pre job bitmap disable: +[ + +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "b", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-2-5 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-2-5 new file mode 100644 index 0000000000..2da87865a1 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 2-5 @@ -0,0 +1,53 @@ +pre job bitmap disable: +[ + +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "b", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-3-4 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-3-4 new file mode 100644 index 0000000000..feb54e1af4 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 3-4 @@ -0,0 +1,30 @@ +pre job bitmap disable: +[ + +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "b", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-3-5 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-3-5 new file mode 100644 index 0000000000..ced2a3751c --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 3-5 @@ -0,0 +1,30 @@ +pre job bitmap disable: +[ + +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "b", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-4-5 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-4-5 new file mode 100644 index 0000000000..b1f10a8a24 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 4-5 @@ -0,0 +1,20 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-enable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] --=20 2.24.1 From nobody Fri May 3 23:15:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1583342841; cv=none; d=zohomail.com; s=zohoarc; b=bl1POg0HHjAKAYFq3pA1eJXZo0jJyyJ14SDUacucAEw09ZwdK/PZCfnVAdcD1fMQZPlUMLLQraMuOf0YeCZLCerUfaDad4W1QUBP1LQ4c/5TuVNUbkdZlTTYE/psX6h2AU+BTUJcIcYeYGAymfpMSDpDtDS33d4q/LnUfDO0Ydo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583342841; 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=nbMdi93NOHkehB8E/HCtoyqJ75jbZbQBHcYVEIYk0os=; b=KeUIvV85JiNcgzl0zQl8kRC5KsI8I3fbtw6OiexqOQxaIPlNkT9PaE0+bpMvHk1DE13XwgTXXGt3TTrSQ2qHF33NFmLwmI+Fzfw47j2YYlNNoCcdNs0AO3c5Qp+yTHUxp7j/Q4MKfRHtGWPmOTOmsQnm7LxH9aiPwo5Bigd9B+g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1583342841601668.575962089063; Wed, 4 Mar 2020 09:27:21 -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-298-w5iFO4GJPoyF1xu6T_jEng-1; Wed, 04 Mar 2020 12:27:17 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6DAE3107B7F4; Wed, 4 Mar 2020 17:27:11 +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 46EA719E9C; Wed, 4 Mar 2020 17:27:11 +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 E594718034FA; Wed, 4 Mar 2020 17:27:10 +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 024HQt1h027376 for ; Wed, 4 Mar 2020 12:26:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 498A68D57A; Wed, 4 Mar 2020 17:26:55 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9A9E78D57B; Wed, 4 Mar 2020 17:26:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583342840; 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=nbMdi93NOHkehB8E/HCtoyqJ75jbZbQBHcYVEIYk0os=; b=TA/BWVFdCGaKBdcy/rDoJtTmL2RJzgHXp1vWL2kD/CGG81Z3YHf5/1OX8aTTGSGh1tpUgH V2hs5yDCcbTQwmG+W4I3pgKAFQqGIgN+PbyeHUXJcRwCeoR1glAHbEOrqEi4eBx88xufXK 3aSvzOxxgLrQHm2ol9hglz/gPiSogjA= X-MC-Unique: w5iFO4GJPoyF1xu6T_jEng-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/13] qemuBlockJobDiskNewCommit: Propagate 'disabledBitmapsBase' Date: Wed, 4 Mar 2020 18:26:37 +0100 Message-Id: <331904e3faac239c7e368c3fc75e6c589a9e9e62.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.79 on 10.5.11.11 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" Add an argument to qemuBlockJobDiskNewCommit to propagate the list of disabled bitmaps into the job data structure. Signed-off-by: Peter Krempa --- src/qemu/qemu_blockjob.c | 2 ++ src/qemu/qemu_blockjob.h | 1 + src/qemu/qemu_driver.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 71df0d1ab2..44c0dc2c16 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -285,6 +285,7 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm, virStorageSourcePtr topparent, virStorageSourcePtr top, virStorageSourcePtr base, + char ***disabledBitmapsBase, bool delete_imgs, unsigned int jobflags) { @@ -310,6 +311,7 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm, job->data.commit.top =3D top; job->data.commit.base =3D base; job->data.commit.deleteCommittedImages =3D delete_imgs; + job->data.commit.disabledBitmapsBase =3D g_steal_pointer(disabledBitma= psBase); job->jobflags =3D jobflags; if (qemuBlockJobRegister(job, vm, disk, true) < 0) diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index e2e28ca4d3..9264c70217 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -187,6 +187,7 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm, virStorageSourcePtr topparent, virStorageSourcePtr top, virStorageSourcePtr base, + char ***disabledBitmapsBase, bool delete_imgs, unsigned int jobflags); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 79ce518c5b..ef1314835e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18544,7 +18544,7 @@ qemuDomainBlockCommit(virDomainPtr dom, goto endjob; if (!(job =3D qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSourc= e, - baseSource, + baseSource, NULL, flags & VIR_DOMAIN_BLOCK_COMMIT_= DELETE, flags))) goto endjob; --=20 2.24.1 From nobody Fri May 3 23:15:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1583342845; cv=none; d=zohomail.com; s=zohoarc; b=KE95zD8+3zbvkybAh6+PWauXUdLZDiBeatoALO16sjrTB2UNlKlDqRs0b/2gFtpuFVonh+3drhn19ZE6HyAwCczwi+c2f6ncLStQeHQWakS29mXYARVosCGqGZBKQUuLRm2aMl5Nx/TApguZIWrjfBzsIzKMHLvsmCzbhbzskho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583342845; 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=asY5VY1olX4LOgEcOT3FSdaHSho3MRCJQw9y8ExV3e0=; b=Ae5iGAp9fIMJTZj2zcfqv30K0Lku+KQ+EGEg6HN94EKfZ8by2rDTqOJleyweCoSTeWzS2XTD9GS3RNc7+PBm8Kp9VnY6lZ8GiffMC7jn0SDuiBIVZto1GEEuTkrKy58mJKac3SmkPcPFUmHvu5rX3dFbUPeg932nD+an2CVXCWc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1583342845503764.5151826218287; Wed, 4 Mar 2020 09:27:25 -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-408-19ojmoL0NF2pw6FPp5P9DQ-1; Wed, 04 Mar 2020 12:27:21 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id E9E7D18C8C06; Wed, 4 Mar 2020 17:27:14 +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 BFDC919C58; Wed, 4 Mar 2020 17:27:14 +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 7691418034FE; Wed, 4 Mar 2020 17:27:14 +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 024HQuPB027383 for ; Wed, 4 Mar 2020 12:26:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7BEBF8B777; Wed, 4 Mar 2020 17:26:56 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98B218B74D; Wed, 4 Mar 2020 17:26:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583342844; 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=asY5VY1olX4LOgEcOT3FSdaHSho3MRCJQw9y8ExV3e0=; b=haAcLIV7LRvssDppMLTMNRQi4IwYJin2DJyhaAnroDGkE6ceNDqCLZ48qUo8m7dLUDL5lH uxeka1HXvv1nSkqGlTeBff6pd+FJIOX7lqXYLDbbUAnIuj8RAuP/tB0/mq57vWT/HNGfAL 9Olc/45WYk9SPThEzx+KUAPliWwv5jI= X-MC-Unique: 19ojmoL0NF2pw6FPp5P9DQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/13] qemuDomainBlockCommit: Handle bitmaps on start of commit Date: Wed, 4 Mar 2020 18:26:38 +0100 Message-Id: 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.23 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 --- src/qemu/qemu_driver.c | 44 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ef1314835e..85612f3281 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18395,6 +18395,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 | @@ -18543,8 +18545,30 @@ qemuDomainBlockCommit(virDomainPtr dom, qemuDomainStorageSourceAccessAllow(driver, vm, top_parent, false,= false) < 0)) goto endjob; + if (blockdev && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP)) { + 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; @@ -18566,6 +18590,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 From nobody Fri May 3 23:15:00 2024 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-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=1583342836; cv=none; d=zohomail.com; s=zohoarc; b=hFLRX+Jn5oeUgA/8ON5gZdEP+lpMT79PJMK0NmT48KfBmBKqVz6tDch1xpLujNxH+AhZtal8gzRzINBZnQ9H4+6DxVA1RGMM7j67bjwU+6SNc/CuqAictpqYVOy51Oo6rn+m05ZYqHH+8Vp4N4OwW2TKr49WyeEqwSsdX4oCm2U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583342836; 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=jJGgeTeoBV90Chrsj1oEZidXSqNLqRcqIfX2DxLgSHg=; b=NeYtnt5pNsdnLF6QXMGt/ovboVbGVVf6BxHzgpt5eW57yiP8Vi/LRCVx029x8/MfGPLH8oT1hzwqayBAZHWn6QORp5X2AHx0rTvIbYwjBYfzVzkNpzzPLcCTUTb9mckr4AHtU0NodClrluKaS2z3iz4nY/2pM5g6/sZMoKHnpA4= 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-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1583342836144516.3249211212303; Wed, 4 Mar 2020 09:27:16 -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-20-kDbudaR9P_OUr67uZskodg-1; Wed, 04 Mar 2020 12:27:11 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB3CC107B114; Wed, 4 Mar 2020 17:27:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9AAFD8B74D; Wed, 4 Mar 2020 17:27:03 +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 50707860D7; Wed, 4 Mar 2020 17:27:03 +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 024HQv8r027399 for ; Wed, 4 Mar 2020 12:26:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 847828F370; Wed, 4 Mar 2020 17:26:57 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id CAF8819E9C; Wed, 4 Mar 2020 17:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583342834; 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=jJGgeTeoBV90Chrsj1oEZidXSqNLqRcqIfX2DxLgSHg=; b=VB5P40BEp75c+f5/BgURYnSxRpXlym8sEpVpwhESYGEBJcfjGZXH2NWLcbgSXEAlr0Qm+p F/MuFoxKCEggpO8pHcfNf9gk+RLIAhRCDB07OiOUUI0xY/XQPAjszkdPt+SRh6tcDJpzFS aLzAK7tZjtQwodO74Si0hQGPplhX3iI= X-MC-Unique: kDbudaR9P_OUr67uZskodg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/13] qemuDomainBlockPivot: Handle merging of bitmaps when pivoting an active block-commit Date: Wed, 4 Mar 2020 18:26:39 +0100 Message-Id: <25f71c67fc29367c43ff04a06c1493a7cc6b48da.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.79 on 10.5.11.11 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 --- src/qemu/qemu_driver.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 85612f3281..bc3e495064 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17288,6 +17288,21 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver, break; case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: + if (blockdev && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP)) { + 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 From nobody Fri May 3 23:15:00 2024 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=1583342917; cv=none; d=zohomail.com; s=zohoarc; b=J2tsuimu5Bd284zzcawlg54qOkJINTVjKPhZRHA/+kEGfXx0oOboD+FG+2Rsf2Mz7u2k/2EE5FnJYcUC5yjSq8CbBg7bKv6E3YUhBlSs+IoloTnIy7QjT/8eA/5xIj7YB7iYwo2Gfktkv9flJRljiO+16ACfSntF59sq5ZkSWRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583342917; 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=wFtl1lFKbLw2K2v79WIc53FVkvRW+qvr2rzUt4glYP8=; b=mYCMDwNHvoFXldoIb5nBVqQSoZSrzqRvWVqrbWneeOlRURu94TAN9PKNO8R1m/iTKoCti+zTadbfTnQxt/Hg0tdSowAvk9ryI93UzJopP33S5JnQGg60Xy2pYqP3t9h6cIvNiy6FzSGCwm+xPUkVksUnAiSgu+Gd9fzwX8Q7IKM= 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-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1583342917393275.738776051532; Wed, 4 Mar 2020 09:28:37 -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-367-JVgwAoq7NJ6lidCb-QSMQA-1; Wed, 04 Mar 2020 12:27:25 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1A45B800053; Wed, 4 Mar 2020 17:27:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E31B45C1D8; Wed, 4 Mar 2020 17:27:18 +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 9450A86A12; Wed, 4 Mar 2020 17:27:18 +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 024HQwOe027405 for ; Wed, 4 Mar 2020 12:26:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id 768368D55E; Wed, 4 Mar 2020 17:26:58 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id C92D219E9C; Wed, 4 Mar 2020 17:26:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583342916; 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=wFtl1lFKbLw2K2v79WIc53FVkvRW+qvr2rzUt4glYP8=; b=XFW0eEzfdb/uRjAi15ZTdwFNK2xeeVF3UL/rN6D+Gf6iS+xMTQ6kdG+Y9VITOFf+xS49eS IdJr76BomBZj4JloHab2Gpp8bdR0tDdDdEwpX9ABHRSS1i6IVNY3tT7peCKSRSV4ghDv7b g72km/saLn2czJShowcxR1SLTAaVG7I= X-MC-Unique: JVgwAoq7NJ6lidCb-QSMQA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 12/13] qemu: blockjob: Handle bitmaps after finish of normal block-commit Date: Wed, 4 Mar 2020 18:26:40 +0100 Message-Id: <7ba5e477b410bb143b94cf095df0fd14a42a4b50.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.79 on 10.5.11.16 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" Merge the bitmaps into base of the block commit after the job finishes. Signed-off-by: Peter Krempa --- src/qemu/qemu_blockjob.c | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 44c0dc2c16..904c4c3f46 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -1049,6 +1049,53 @@ qemuBlockJobDeleteImages(virQEMUDriverPtr driver, } } + +/** + * qemuBlockJobProcessEventCompletedCommitBitmaps: + * + * Handles the bitmap changes after commit. This function shall return -1 = on + * monitor failures. + */ +static int +qemuBlockJobProcessEventCompletedCommitBitmaps(virDomainObjPtr vm, + qemuBlockJobDataPtr job, + qemuDomainAsyncJob asyncJob) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + g_autoptr(virHashTable) blockNamedNodeData =3D NULL; + g_autoptr(virJSONValue) actions =3D NULL; + + if (!(blockNamedNodeData =3D qemuBlockGetNamedNodeData(vm, asyncJob))) + return -1; + + if (qemuBlockBitmapsHandleCommitFinish(job->data.commit.top, + job->data.commit.base, + blockNamedNodeData, + &actions, + job->data.commit.disabledBitmap= sBase) < 0) + return 0; + + if (!actions) + return 0; + + if (qemuBlockReopenReadWrite(vm, job->data.commit.base, asyncJob) < 0) + return -1; + + if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + return -1; + + qemuMonitorTransaction(priv->mon, &actions); + + if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) + return -1; + + if (qemuBlockReopenReadOnly(vm, job->data.commit.base, asyncJob) < 0) + return -1; + + return 0; +} + + /** * qemuBlockJobProcessEventCompletedCommit: * @driver: qemu driver object @@ -1106,6 +1153,9 @@ qemuBlockJobProcessEventCompletedCommit(virQEMUDriver= Ptr driver, if (!n) return; + if (qemuBlockJobProcessEventCompletedCommitBitmaps(vm, job, asyncJob) = < 0) + return; + /* revert access to images */ qemuDomainStorageSourceAccessAllow(driver, vm, job->data.commit.base, = true, false); if (job->data.commit.topparent !=3D job->disk->src) --=20 2.24.1 From nobody Fri May 3 23:15:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1583342852; cv=none; d=zohomail.com; s=zohoarc; b=aNML6V0pFwrNBhau0ZXyV373FIxRf+A5MY+/LEFcEQstCBydCnKh69zJJQn8cRrcjWEvd3+hFTI/nAk+dXw3p6fZbdLZLNVhYPrI8ypJMkLWLDdFeebN6EXphIDmk24paFHj5wT4vnhrmRKLU35K+exPWkd4v+v8gNqW5KZAEcA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583342852; 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=k39hqP/hEN1zcdKjpUG6YcbCbYrnLX1eZDLDuyl+4eo=; b=iiNSL/hXpdf7SjohlZ7ADQTmLJx+4xgB1yeg+uUJwtA67DuywWpyaObItXQsstPx2WamkJe0AD/Z5xcCp1d6oSgpZp3X+7Jx5gjgV4wMb0ys+6CrTKN5t1Wmq2MRZfwWKPsHdDxHzRB8VJ73PZkZcnHghrMBGF8q6q10xSsLbPU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1583342852266910.2182016790082; Wed, 4 Mar 2020 09:27:32 -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-196-s16MfvtQP_C-plEXn1kiLw-1; Wed, 04 Mar 2020 12:27:28 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F90C8017CC; Wed, 4 Mar 2020 17:27:23 +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 0922090779; Wed, 4 Mar 2020 17:27:23 +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 B15F818034EF; Wed, 4 Mar 2020 17:27:22 +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 024HQxN3027411 for ; Wed, 4 Mar 2020 12:26:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 739C98B56A; Wed, 4 Mar 2020 17:26:59 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id C558319E9C; Wed, 4 Mar 2020 17:26:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583342851; 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=k39hqP/hEN1zcdKjpUG6YcbCbYrnLX1eZDLDuyl+4eo=; b=NgGsIdPDvzrfymwRMNrUw4gF3w39RX3kPvXBTqeodT0GSobzLrUFQFpxwlgNyx1rwbnHFs VAj3IKm4Oly5oi/jfsrcgoAnryJj6VJUzCrxa64Q0yV4EnhqozKDUzWDplM9i3kZPvpPeD G24t9aXkeSd4Q3BhkeDFsxYOxY8PJTs= X-MC-Unique: s16MfvtQP_C-plEXn1kiLw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 13/13] qemu: blockjob: Re-enable bitmaps after failed block-copy Date: Wed, 4 Mar 2020 18:26:41 +0100 Message-Id: <627dac45b0b710728aba318b2ccc4fdc9129abcf.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.79 on 10.5.11.13 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" If a block-copy fails we should at least re-enable the bitmaps so that the operation can be re-tried. Signed-off-by: Peter Krempa --- src/qemu/qemu_blockjob.c | 42 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 904c4c3f46..5ac1cd8856 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -1341,6 +1341,40 @@ qemuBlockJobProcessEventFailedActiveCommit(virQEMUDr= iverPtr driver, } +static void +qemuBlockJobProcessEventFailedCommitCommon(virDomainObjPtr vm, + qemuBlockJobDataPtr job, + qemuDomainAsyncJob asyncJob) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + g_autoptr(virJSONValue) actions =3D virJSONValueNewArray(); + char **disabledBitmaps =3D job->data.commit.disabledBitmapsBase; + + if (!disabledBitmaps || !*disabledBitmaps) + return; + + for (; *disabledBitmaps; disabledBitmaps++) { + qemuMonitorTransactionBitmapEnable(actions, + job->data.commit.base->nodeform= at, + *disabledBitmaps); + } + + if (qemuBlockReopenReadWrite(vm, job->data.commit.base, asyncJob) < 0) + return; + + if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + return; + + qemuMonitorTransaction(priv->mon, &actions); + + if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) + return; + + if (qemuBlockReopenReadOnly(vm, job->data.commit.base, asyncJob) < 0) + return; +} + + static void qemuBlockJobProcessEventConcludedCreate(virQEMUDriverPtr driver, virDomainObjPtr vm, @@ -1448,13 +1482,17 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlo= ckJobDataPtr job, case QEMU_BLOCKJOB_TYPE_COMMIT: if (success) qemuBlockJobProcessEventCompletedCommit(driver, vm, job, async= Job); + else + qemuBlockJobProcessEventFailedCommitCommon(vm, job, asyncJob); break; case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: - if (success) + if (success) { qemuBlockJobProcessEventCompletedActiveCommit(driver, vm, job,= asyncJob); - else + } else { qemuBlockJobProcessEventFailedActiveCommit(driver, vm, job); + qemuBlockJobProcessEventFailedCommitCommon(vm, job, asyncJob); + } break; case QEMU_BLOCKJOB_TYPE_CREATE: --=20 2.24.1