From nobody Thu Apr 25 19:20:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1559748611; cv=none; d=zoho.com; s=zohoarc; b=WU7aBzvMhFSEx3zJKzSrcU+xUuI7U/Bf8VTswkcPDUN1JzSUiVQKvQGtNfKjassJhcQxvL4EEGyLvOWrrNymEuo1CEdnn/FP8u1vfArQM89ShtTMjEEMiNuciwX6gRpjXMXmwcL1ZIWkByIrtFTsKGk1OwbpAiT9+1Vt48tVfVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559748611; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=LYKDsnKNHl32OwgecnX//c6csPRP7hWCY3WAagJNzGE=; b=mTdcUCp5+nRdr0mb7TkMqvsEVhpptNpNY2RF/SDPqBf2VYNnWS3xvdJ1uz9+hyShmUn+A1So1xUDx/Nxj8sZvpgkVn7/wlPSfYo2KFA3BHuRybsj1pEka+0/xQIdPeizeHhU7oYsJbnPQs2xd11C7umK1JYvDFJz5cEIrH0Dcso= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559748611113779.3020821282554; Wed, 5 Jun 2019 08:30:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E992316D76E; Wed, 5 Jun 2019 15:30:04 +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 4E2555B68E; Wed, 5 Jun 2019 15:30:02 +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 DBE251806B16; Wed, 5 Jun 2019 15:29:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x55FSeJe012869 for ; Wed, 5 Jun 2019 11:28:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id C01A11823E; Wed, 5 Jun 2019 15:28:40 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AF8360920 for ; Wed, 5 Jun 2019 15:28:40 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 17:28:23 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/13] qemu: snapshot: Pass 'cfg' to external snapshot functions 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 05 Jun 2019 15:30:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The caller has it so there's no point in getting it again. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 42b1ce2521..9c6221d3b2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15231,6 +15231,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, virDomainObjPtr vm, virDomainMomentObjPtr snap, unsigned int flags, + virQEMUDriverConfigPtr cfg, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv =3D vm->privateData; @@ -15240,7 +15241,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, size_t i; bool persist =3D false; bool reuse =3D (flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) !=3D 0; - virQEMUDriverConfigPtr cfg =3D NULL; qemuDomainSnapshotDiskDataPtr diskdata =3D NULL; virErrorPtr orig_err =3D NULL; virDomainSnapshotDefPtr snapdef =3D virDomainSnapshotObjGetDef(snap); @@ -15256,8 +15256,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, if (!(diskdata =3D qemuDomainSnapshotDiskDataCollect(driver, vm, snap,= reuse))) goto cleanup; - cfg =3D virQEMUDriverGetConfig(driver); - /* Based on earlier qemuDomainSnapshotPrepare, all disks in this list= are * now either VIR_DOMAIN_SNAPSHOT_LOCATION_NONE, or * VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL with a valid file name and @@ -15344,7 +15342,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, cleanup: qemuDomainSnapshotDiskDataFree(diskdata, snapdef->ndisks, driver, vm); virJSONValueFree(actions); - virObjectUnref(cfg); if (orig_err) { virSetError(orig_err); @@ -15359,6 +15356,7 @@ static int qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainMomentObjPtr snap, + virQEMUDriverConfigPtr cfg, unsigned int flags) { virObjectEventPtr event; @@ -15371,7 +15369,6 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDrive= rPtr driver, bool memory_unlink =3D false; int thaw =3D 0; /* 1 if freeze succeeded, -1 if freeze failed */ bool pmsuspended =3D false; - virQEMUDriverConfigPtr cfg =3D NULL; int compressed; char *compressedpath =3D NULL; virQEMUSaveDataPtr data =3D NULL; @@ -15442,7 +15439,6 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDrive= rPtr driver, JOB_MASK(QEMU_JOB_SUSPEND) | JOB_MASK(QEMU_JOB_MIGRATION_OP))= ); - cfg =3D virQEMUDriverGetConfig(driver); if ((compressed =3D qemuGetCompressionProgram(cfg->snapshotImageFo= rmat, &compressedpath, "snapshot", false)) < = 0) @@ -15473,7 +15469,7 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDrive= rPtr driver, /* the domain is now paused if a memory snapshot was requested */ - if ((ret =3D qemuDomainSnapshotCreateDiskActive(driver, vm, snap, flag= s, + if ((ret =3D qemuDomainSnapshotCreateDiskActive(driver, vm, snap, flag= s, cfg, QEMU_ASYNC_JOB_SNAPSHOT)= ) < 0) goto cleanup; @@ -15532,7 +15528,6 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDrive= rPtr driver, virQEMUSaveDataFree(data); VIR_FREE(xml); VIR_FREE(compressedpath); - virObjectUnref(cfg); if (memory_unlink && ret < 0) unlink(snapdef->file); @@ -15771,7 +15766,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, virDomainSnapshotObjGetDef(snap)->memory =3D=3D VIR_DOMAIN_SNA= PSHOT_LOCATION_EXTERNAL) { /* external full system or disk snapshot */ if (qemuDomainSnapshotCreateActiveExternal(driver, - vm, snap, flags) < = 0) + vm, snap, cfg, flag= s) < 0) goto endjob; } else { /* internal full system */ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 19:20:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1559748631; cv=none; d=zoho.com; s=zohoarc; b=nHQVbqlyTAbS84iY8dP6RcC1R9NqXNij5D0k7jwWzAHRIiyi630vFq2wrETvQbEJd/U9We3YsX764U5d+NxB3Kz8y8m2sa0YF6NxLI/VVyZ8WpnnGwfigQpyNQ4rvS9O+k1iv1ZieHhisuuomq92UvtcjHY9xXybVAD6Cmede+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559748631; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=IvOQGxtabJO1s8R8HnqtiEuTbak/yuoiKJUeJvcQXPc=; b=oGTE4UIFLkmdR6pOasHdeN0BfMkuiNIHXXeuiwfinsOxJ8jmEafrpepTZrExAvCjgfOZExlxRomOeT9q62m4Vtv3jOohb5LXRdtUtI3RtvzdneBvvMMfdQHLX0HP9CAnriJliY71/BTpCZBLpkhZbBB2S/YUZnqydYoHXhfFF6Q= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559748631109148.7352975236862; Wed, 5 Jun 2019 08:30:31 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 90F317E427; Wed, 5 Jun 2019 15:30:29 +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 22FF6F6F1; Wed, 5 Jun 2019 15:30:28 +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 D9B91206D8; Wed, 5 Jun 2019 15:30:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x55FSfNe012879 for ; Wed, 5 Jun 2019 11:28:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8F1CA60920; Wed, 5 Jun 2019 15:28:41 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 189685F7C0 for ; Wed, 5 Jun 2019 15:28:40 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 17:28:24 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/13] qemu: Use VIR_AUTOPTR in qemuDomainSnapshotCreateDiskActive 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 05 Jun 2019 15:30:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9c6221d3b2..8093b27656 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15235,7 +15235,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - virJSONValuePtr actions =3D NULL; + VIR_AUTOPTR(virJSONValue) actions =3D NULL; bool do_transaction =3D false; int ret =3D 0; size_t i; @@ -15341,7 +15341,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, cleanup: qemuDomainSnapshotDiskDataFree(diskdata, snapdef->ndisks, driver, vm); - virJSONValueFree(actions); if (orig_err) { virSetError(orig_err); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 19:20:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1559748651; cv=none; d=zoho.com; s=zohoarc; b=BIcTAXdfFeUWqnc9cTxFicnubM/lQ67vtKQ0NKfNTr1qj22uWRLKswwN8OYLhnEbGspEo+nnDv9wdKqwKo6LDz+ENO0U8E2VT5shE+i5ukyoZhWxLbTpIG6m6qmChty9l4apsyhXt9IvO0dRx3ybL84na+O3WHzdze3yPvuzLNM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559748651; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=SLQo6WspfM6vkanu6s0Dym5HB4YGGT2HeUDBU0vxGgM=; b=hIBKDlMOEP1Te4f9EQmwJ3fqZtOKZ8jHMVY9c21KKdqSn0HKncUd7cz2zCcKRJdvirfAGS26GXjinWOHfcUA4ucreIn3GG8fWiXPVWmM+1UVU+DD0YO84NM5buyRNharsHMAwxhT7mwics9jo7+gdgrQCHlUAdjUjcACayZ+36M= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559748651345101.71515954058441; Wed, 5 Jun 2019 08:30:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C79BD81123; Wed, 5 Jun 2019 15:30:39 +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 9FEE85DEC8; Wed, 5 Jun 2019 15:30:39 +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 6591E1806B0F; Wed, 5 Jun 2019 15:30:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x55FSgIW012884 for ; Wed, 5 Jun 2019 11:28:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5C9F060920; Wed, 5 Jun 2019 15:28:42 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id DAC945F7C0 for ; Wed, 5 Jun 2019 15:28:41 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 17:28:25 +0200 Message-Id: <842f9e1ea568c810be4c52e3cd170d5475414d60.1559748399.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/13] qemu: Use virErrorPreserveLast in qemuDomainSnapshotCreateDiskActive 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 05 Jun 2019 15:30:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8093b27656..65b54b7511 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15301,7 +15301,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, error: if (ret < 0) { - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); for (i =3D 0; i < snapdef->ndisks; i++) { if (!diskdata[i].src) continue; @@ -15341,11 +15341,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPt= r driver, cleanup: qemuDomainSnapshotDiskDataFree(diskdata, snapdef->ndisks, driver, vm); - - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); return ret; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 19:20:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1559748665; cv=none; d=zoho.com; s=zohoarc; b=G7LxUkfAy9lLBCaXSz+08Kcxj+hrnMC3Kx9bwdXkSJh3SnuVWO5+mf4wDfWVURmMTHMwgQGhYH3dgXDVuLL+m2m5NZEzAUb8g998p0UVKSR+/w6JCBVlofKXE8QgV8QiRnfuA+MSgh3AE0n+X9BYe/Inf8Gpwz4F8JIAp/sk5ro= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559748665; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=fxWkFOb0eQnaWD9dm/Y1sWJ9jkMpn/Gf1wAswBRfCsI=; b=nM4zZwi+lsQpz/abB+fGk7NAIHiLEg/Jf2WHOP+TMACpRT1OehiR/NEBeLDXEZlyBYphn0CqcD+y8jdJVkNv9fjvz9zcJ/Ogd28xNHDjTv7CRIZrQgIqPOPNz7tTzsTik+5zfBYfiK37xcu2mtye/4vbI7kIO5vycGbjPmaZGls= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559748665177538.1899370440484; Wed, 5 Jun 2019 08:31:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3C20BC18B2F5; Wed, 5 Jun 2019 15:30:58 +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 18EAA18344; Wed, 5 Jun 2019 15:30:58 +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 D45491806B1A; Wed, 5 Jun 2019 15:30:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x55FShgh012901 for ; Wed, 5 Jun 2019 11:28:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2A91817F22; Wed, 5 Jun 2019 15:28:43 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id A849160920 for ; Wed, 5 Jun 2019 15:28:42 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 17:28:26 +0200 Message-Id: <57623006a09cc72da42776dfc511ed92a151fc23.1559748399.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/13] qemu: Use VIR_AUTO* in qemuDomainSnapshotCreateActiveExternal 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 05 Jun 2019 15:31:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 65b54b7511..fad96053db 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15358,14 +15358,14 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDri= verPtr driver, bool resume =3D false; int ret =3D -1; qemuDomainObjPrivatePtr priv =3D vm->privateData; - char *xml =3D NULL; + VIR_AUTOFREE(char *) xml =3D NULL; virDomainSnapshotDefPtr snapdef =3D virDomainSnapshotObjGetDef(snap); bool memory =3D snapdef->memory =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EX= TERNAL; bool memory_unlink =3D false; int thaw =3D 0; /* 1 if freeze succeeded, -1 if freeze failed */ bool pmsuspended =3D false; int compressed; - char *compressedpath =3D NULL; + VIR_AUTOFREE(char *) compressedpath =3D NULL; virQEMUSaveDataPtr data =3D NULL; /* If quiesce was requested, then issue a freeze command, and a @@ -15521,8 +15521,6 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDrive= rPtr driver, } virQEMUSaveDataFree(data); - VIR_FREE(xml); - VIR_FREE(compressedpath); if (memory_unlink && ret < 0) unlink(snapdef->file); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 19:20:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1559748678; cv=none; d=zoho.com; s=zohoarc; b=ZQUpEh/eCwHJPydBq3kYn178hvKB/o+uvlu+kEfmTo4JHyKBwNMLKbGTvjaDpm85trnOaeObYjok61WtgT1wZ0v6P5SEanHrY+uxNlg/HE7yw2TE+qmD8BsUwQ3BtPKq6pfDmyWRtogFrEO4DY3p5aMSS+SuIl6RFwOt/JqPa4o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559748678; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=sFuQsIWcZrh3qHrqNjblzOxvYIDdIO72fQUy+z5SPLA=; b=arlwFBRpMol7LFTVxisPyYn73jV299zko/ByEGupFsQ+w2OnBcAg90SoZhLcWvpGO5Nsd1hILkzTjydRf2+gIrGp4WshgcxbtcCJdNdi5jh3IRf/bQ6L7C9h1nX9uLRvhLHH03kIb8NbGfmy8XluQy6ivGeduwG5OP8F4UCkaIE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559748678498527.396207312408; Wed, 5 Jun 2019 08:31:18 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id EAEC9C0741EB; Wed, 5 Jun 2019 15:31:16 +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 C04E91019615; Wed, 5 Jun 2019 15:31:15 +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 74E65206D2; Wed, 5 Jun 2019 15:31:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x55FShwN012906 for ; Wed, 5 Jun 2019 11:28:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id ECFFD60920; Wed, 5 Jun 2019 15:28:43 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 76CEE5F7C0 for ; Wed, 5 Jun 2019 15:28:43 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 17:28:27 +0200 Message-Id: <4490d9377f53d46546d79e8abb544fab2f7795dd.1559748399.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/13] qemu: snapshot: Remove unused cleanup section in qemuDomainSnapshotCreateSingleDiskActive 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 05 Jun 2019 15:31:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" After getting rid of pre-transaction qemu support the cleanup section is unused. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index fad96053db..97f7ad16bf 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15197,31 +15197,26 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUD= riverPtr driver, virJSONValuePtr actions, bool reuse) { - int ret =3D -1; - if (qemuBlockSnapshotAddLegacy(actions, dd->disk, dd->src, reuse) < 0) - goto cleanup; + return -1; /* pre-create the image file so that we can label it before handing it= to qemu */ if (!reuse && dd->src->type !=3D VIR_STORAGE_TYPE_BLOCK) { if (virStorageFileCreate(dd->src) < 0) { virReportSystemError(errno, _("failed to create image file '%s= '"), NULLSTR(dd->src->path)); - goto cleanup; + return -1; } dd->created =3D true; } /* set correct security, cgroup and locking options on the new image */ if (qemuDomainStorageSourceAccessAllow(driver, vm, dd->src, false, tru= e) < 0) - goto cleanup; + return -1; dd->prepared =3D true; - ret =3D 0; - - cleanup: - return ret; + return 0; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 19:20:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1559748579; cv=none; d=zoho.com; s=zohoarc; b=T7ae0NOup1Nctx4EkiBkwQUiMaf6nEwTV8uGlObPIp+UsCH7+4RI0/Sootw9TJ+iHeIba69bMONA0JHDSyT2XTuqvDOsTiQQ5agyJXGgcRSExL3glgI6XYEgwgxijlGj2XJfy5FMWnuT3fLmAymnqx6j9OFfvgNCSusfGmmqnPw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559748579; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=an5zkR0uHnfjJCpgEcHODntLtVL65UQaPlW5nj7e38A=; b=NAt86cHj9xwwkN7XIqcyoI8xBrVddPaHvS406cMs3axLXRPCeuLEE09EBfCqqRZf2/it6KfBXc2gptY9lrGeVIvASPBiemhWvGUj8XV9rGaskNggq3Tfs6IVdVqUa+J16AzfP5BJ04RmPOB3h9NaAfIhtMA5M5G73w2p4Vvf344= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559748579004903.3900589897025; Wed, 5 Jun 2019 08:29:39 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 356DC776DB; Wed, 5 Jun 2019 15:29:09 +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 996465F7C0; Wed, 5 Jun 2019 15:28:59 +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 BA756206D3; Wed, 5 Jun 2019 15:28:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x55FSiZK012911 for ; Wed, 5 Jun 2019 11:28:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id BBE9617F2C; Wed, 5 Jun 2019 15:28:44 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 454B617F22 for ; Wed, 5 Jun 2019 15:28:44 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 17:28:28 +0200 Message-Id: <32810fb807143670ed3a9f9d887cb03ace17b0ce.1559748399.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/13] qemu: snapshot: Always save status and config after qemuDomainSnapshotCreateDiskActive 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 05 Jun 2019 15:29:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The error path is unlikely thus saving the status XML even if we didn't modify it does not add much burden. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 97f7ad16bf..40ba50c8c0 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15327,12 +15327,10 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverP= tr driver, } } - if (ret =3D=3D 0 || !do_transaction) { - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver-= >caps) < 0 || - (persist && virDomainSaveConfig(cfg->configDir, driver->caps, - vm->newDef) < 0)) - ret =3D -1; - } + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->cap= s) < 0 || + (persist && virDomainSaveConfig(cfg->configDir, driver->caps, + vm->newDef) < 0)) + ret =3D -1; cleanup: qemuDomainSnapshotDiskDataFree(diskdata, snapdef->ndisks, driver, vm); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 19:20:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1559748699; cv=none; d=zoho.com; s=zohoarc; b=EJkrTcknUZs1WtL1h+BkPzSdej8TsU0l+4NgVyzkpDOsqLsxk84/rPDwkq1AlHicxAQJ2hjCfzDwCWncmTlgFXWmHwgMfx9KHRHyHNX8kt0F0qjqHWt9aUYWUfuxiY+8+4snaHFSo1hIBgvrXlU3X0e7qtZyq87GC/Kn2f6eNcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559748699; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=/hJfLlGOLM6FpYVnhGamAWCmaBjrSZMCzMKuoq4QohI=; b=PmrqC6vr6iVZG/Y/fXU+7sC3OKs850dJyZS8g8+yGMSLUjjTc4aipVMmy6FunKhQqQXQJ6ZO8GyW1Bwyxf5+J8GMq6kUTp7xg5F70TgIgzcX2CpM+Yb5KgOAIi9j8Vy/6O44WLUodCJOr9jZm3Gl1y119WBtC1jotvBiMgA4ytI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559748699480324.31540379348905; Wed, 5 Jun 2019 08:31:39 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id B4ADA30860A3; Wed, 5 Jun 2019 15:31:32 +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 8D2725F7C0; Wed, 5 Jun 2019 15:31:32 +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 50B27206D6; Wed, 5 Jun 2019 15:31:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x55FSjPW012926 for ; Wed, 5 Jun 2019 11:28:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8B00517F22; Wed, 5 Jun 2019 15:28:45 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14CC55F7C0 for ; Wed, 5 Jun 2019 15:28:44 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 17:28:29 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/13] qemu: snapshot: Always save config XML after qemuDomainSnapshotCreateDiskActive 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 05 Jun 2019 15:31:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If there's a offline config definition save it unconditionally even if it was not modified. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 40ba50c8c0..40182c84e5 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15157,13 +15157,11 @@ qemuDomainSnapshotUpdateDiskSourcesRenumber(virSt= orageSourcePtr src) /** * qemuDomainSnapshotUpdateDiskSources: * @dd: snapshot disk data object - * @persist: set to true if persistent config of the VM was changed * * Updates disk definition after a successful snapshot. */ static void -qemuDomainSnapshotUpdateDiskSources(qemuDomainSnapshotDiskDataPtr dd, - bool *persist) +qemuDomainSnapshotUpdateDiskSources(qemuDomainSnapshotDiskDataPtr dd) { if (!dd->src) return; @@ -15185,7 +15183,6 @@ qemuDomainSnapshotUpdateDiskSources(qemuDomainSnaps= hotDiskDataPtr dd, if (dd->persistdisk) { VIR_STEAL_PTR(dd->persistsrc->backingStore, dd->persistdisk->src); VIR_STEAL_PTR(dd->persistdisk->src, dd->persistsrc); - *persist =3D true; } } @@ -15234,7 +15231,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, bool do_transaction =3D false; int ret =3D 0; size_t i; - bool persist =3D false; bool reuse =3D (flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) !=3D 0; qemuDomainSnapshotDiskDataPtr diskdata =3D NULL; virErrorPtr orig_err =3D NULL; @@ -15287,7 +15283,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, virDomainAuditDisk(vm, dd->disk->src, dd->src, "snapshot", ret= >=3D 0); if (ret =3D=3D 0) - qemuDomainSnapshotUpdateDiskSources(dd, &persist); + qemuDomainSnapshotUpdateDiskSources(dd); } if (ret < 0) @@ -15328,8 +15324,8 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, } if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->cap= s) < 0 || - (persist && virDomainSaveConfig(cfg->configDir, driver->caps, - vm->newDef) < 0)) + (vm->newDef && virDomainSaveConfig(cfg->configDir, driver->caps, + vm->newDef) < 0)) ret =3D -1; cleanup: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 19:20:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1559748579; cv=none; d=zoho.com; s=zohoarc; b=ChXgNAEuZKr0SgcPzFs5qpkeiUqWaYxUybtf+cFj+x2l5KusjsCHjilmFRLezwumZcJ8AS8Fawgr0BG7O7j2CoHx5KMbgTRB2qQq9kQUkVbdtiZLpYBV6HxfV6aJaPOGCklILsS4tvKhEfjCf3BNtMUVKsG5MNWjQRqzr5Q36a8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559748579; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=usYjLCpD22PvZMlclwHLoR/8Z4o7WsEnCTMDFZ4J9MM=; b=jzl9kkBQ6AV5wKYvQKI4xlVTtKX92aIwswFNWmIw6r7l9gyfJLlFWiK4T765DEdWphv2stbIVoVQXbwmvJpJeblb70Fjzq3CRp6yjTJMW9kLEzGReO2r/sKw5OpGkqjNtsfixLCPK7ktwPpKD2RVReLguAEqFXCkbAcmgvS2tFU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559748579338376.16173657908087; Wed, 5 Jun 2019 08:29:39 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 45DD722388D; Wed, 5 Jun 2019 15:29:12 +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 04CCE84EF; Wed, 5 Jun 2019 15:29:04 +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 A52F81806B0F; Wed, 5 Jun 2019 15:28:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x55FSk5e012936 for ; Wed, 5 Jun 2019 11:28:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5A0AC17F22; Wed, 5 Jun 2019 15:28:46 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id D77B35F7C0 for ; Wed, 5 Jun 2019 15:28:45 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 17:28:30 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/13] qemu: snapshot: Densely pack data in qemuDomainSnapshotDiskDataCollect 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 05 Jun 2019 15:29:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The function skips disks which are not selected for snapshot. Rather than creating a sparse array and check whether the given field is filled compress the entries. Note that this does not allocate a smaller array, but the memory allocation is short-lived. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 69 +++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 40182c84e5..9736933143 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15071,37 +15071,42 @@ qemuDomainSnapshotDiskDataFree(qemuDomainSnapshot= DiskDataPtr data, * Collects and prepares a list of structures that hold information about = disks * that are selected for the snapshot. */ -static qemuDomainSnapshotDiskDataPtr +static int qemuDomainSnapshotDiskDataCollect(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainMomentObjPtr snap, - bool reuse) + bool reuse, + qemuDomainSnapshotDiskDataPtr *rdata, + size_t *rndata) { size_t i; - qemuDomainSnapshotDiskDataPtr ret; + qemuDomainSnapshotDiskDataPtr data; + size_t ndata =3D 0; qemuDomainSnapshotDiskDataPtr dd; char *backingStoreStr; virDomainSnapshotDefPtr snapdef =3D virDomainSnapshotObjGetDef(snap); + int ret =3D -1; - if (VIR_ALLOC_N(ret, snapdef->ndisks) < 0) - return NULL; + if (VIR_ALLOC_N(data, snapdef->ndisks) < 0) + return -1; for (i =3D 0; i < snapdef->ndisks; i++) { if (snapdef->disks[i].snapshot =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION= _NONE) continue; - dd =3D ret + i; + ndata++; + dd =3D data + ndata; dd->disk =3D vm->def->disks[i]; if (!(dd->src =3D virStorageSourceCopy(snapdef->disks[i].src, fals= e))) - goto error; + goto cleanup; if (virStorageSourceInitChainElement(dd->src, dd->disk->src, false= ) < 0) - goto error; + goto cleanup; if (qemuDomainStorageFileInit(driver, vm, dd->src, NULL) < 0) - goto error; + goto cleanup; dd->initialized =3D true; @@ -15109,7 +15114,7 @@ qemuDomainSnapshotDiskDataCollect(virQEMUDriverPtr = driver, * block commit still works */ if (reuse) { if (virStorageFileGetBackingStoreStr(dd->src, &backingStoreStr= ) < 0) - goto error; + goto cleanup; if (backingStoreStr !=3D NULL) { if (virStorageIsRelative(backingStoreStr)) VIR_STEAL_PTR(dd->relPath, backingStoreStr); @@ -15127,19 +15132,21 @@ qemuDomainSnapshotDiskDataCollect(virQEMUDriverPt= r driver, false))) { if (!(dd->persistsrc =3D virStorageSourceCopy(dd->src, false))) - goto error; + goto cleanup; if (virStorageSourceInitChainElement(dd->persistsrc, dd->persistdisk->src, fal= se) < 0) - goto error; + goto cleanup; } } - return ret; + VIR_STEAL_PTR(*rdata, data); + *rndata =3D ndata; + ret =3D 0; - error: - qemuDomainSnapshotDiskDataFree(ret, snapdef->ndisks, driver, vm); - return NULL; + cleanup: + qemuDomainSnapshotDiskDataFree(data, ndata, driver, vm); + return ret; } @@ -15163,9 +15170,6 @@ qemuDomainSnapshotUpdateDiskSourcesRenumber(virStor= ageSourcePtr src) static void qemuDomainSnapshotUpdateDiskSources(qemuDomainSnapshotDiskDataPtr dd) { - if (!dd->src) - return; - /* storage driver access won'd be needed */ if (dd->initialized) virStorageFileDeinit(dd->src); @@ -15233,8 +15237,8 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, size_t i; bool reuse =3D (flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) !=3D 0; qemuDomainSnapshotDiskDataPtr diskdata =3D NULL; + size_t ndiskdata =3D 0; virErrorPtr orig_err =3D NULL; - virDomainSnapshotDefPtr snapdef =3D virDomainSnapshotObjGetDef(snap); if (virDomainObjCheckActive(vm) < 0) return -1; @@ -15244,17 +15248,15 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverP= tr driver, /* prepare a list of objects to use in the vm definition so that we do= n't * have to roll back later */ - if (!(diskdata =3D qemuDomainSnapshotDiskDataCollect(driver, vm, snap,= reuse))) + if (qemuDomainSnapshotDiskDataCollect(driver, vm, snap, reuse, + &diskdata, &ndiskdata) < 0) goto cleanup; /* Based on earlier qemuDomainSnapshotPrepare, all disks in this list= are * now either VIR_DOMAIN_SNAPSHOT_LOCATION_NONE, or * VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL with a valid file name and * qcow2 format. */ - for (i =3D 0; i < snapdef->ndisks; i++) { - if (!diskdata[i].src) - continue; - + for (i =3D 0; i < ndiskdata; i++) { ret =3D qemuDomainSnapshotCreateSingleDiskActive(driver, vm, &diskdata[i], actions, reuse); @@ -15274,12 +15276,9 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPt= r driver, if (qemuDomainObjExitMonitor(driver, vm) < 0) ret =3D -1; - for (i =3D 0; i < snapdef->ndisks; i++) { + for (i =3D 0; i < ndiskdata; i++) { qemuDomainSnapshotDiskDataPtr dd =3D &diskdata[i]; - if (!dd->src) - continue; - virDomainAuditDisk(vm, dd->disk->src, dd->src, "snapshot", ret= >=3D 0); if (ret =3D=3D 0) @@ -15293,10 +15292,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPt= r driver, error: if (ret < 0) { virErrorPreserveLast(&orig_err); - for (i =3D 0; i < snapdef->ndisks; i++) { - if (!diskdata[i].src) - continue; - + for (i =3D 0; i < ndiskdata; i++) { if (diskdata[i].prepared) qemuDomainStorageSourceAccessRevoke(driver, vm, diskdata[i= ].src); @@ -15310,10 +15306,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPt= r driver, * stopped using them*/ bool paused =3D virDomainObjGetState(vm, NULL) !=3D VIR_DOMAIN_RUN= NING; - for (i =3D 0; i < snapdef->ndisks; i++) { - if (!diskdata[i].disk) - continue; - + for (i =3D 0; i < ndiskdata; i++) { if (paused) virDomainLockImageDetach(driver->lockManager, vm, diskdata[i].disk->src); @@ -15329,7 +15322,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, ret =3D -1; cleanup: - qemuDomainSnapshotDiskDataFree(diskdata, snapdef->ndisks, driver, vm); + qemuDomainSnapshotDiskDataFree(diskdata, ndiskdata, driver, vm); virErrorRestore(&orig_err); return ret; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 19:20:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1559748620; cv=none; d=zoho.com; s=zohoarc; b=F4rMzJR/t6YvV/zS9eBFyWNm06Dj6RBjJfCFZZojtvXhOIPRIj1rUJGN2qjjk6N/r6CVRbdlcQsRFNcFbfziYoYANQGg2rn9K9Q4Jwv5sER1Wiorgb9m1wkbRaYNk0q8jlMN9Dhg7k2WVw6l9bo+b3KoOu2DvTs9qM0g8F8313w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559748620; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=YH4QBJImNbAdKLBL0odvq0NgmRCUxFXffdWmyZUmHiM=; b=GMe2/TdZIujLUKzToFrjSnzi7k1Ax9IkWLNfnTtJyY+AoCdAZ2ifXMIsNc69D7Oc2WQh+qMiA/tfT09l/u5t0OUgMEjZDya5GZ//kKtY5KLzZzGKCUyid4YzPZ6+ENCNw9LhrEGFg8pGVdkb3a/mENqqkWSwE37CTbFRCkPDBgA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155974862095359.22839020062156; Wed, 5 Jun 2019 08:30:20 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 53A8CB5C13; Wed, 5 Jun 2019 15:30:11 +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 2BA401018A31; Wed, 5 Jun 2019 15:30: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 4ACD4206D2; Wed, 5 Jun 2019 15:30:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x55FSl2e012941 for ; Wed, 5 Jun 2019 11:28:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2858760920; Wed, 5 Jun 2019 15:28:47 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id A60445F7C0 for ; Wed, 5 Jun 2019 15:28:46 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 17:28:31 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/13] qemu: snapshot: Move all cleanup of snapshot disk data to qemuDomainSnapshotDiskDataFree 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 05 Jun 2019 15:30:19 +0000 (UTC) Content-Type: text/plain; charset="utf-8" qemuDomainSnapshotDiskDataFree also removes the resources associated with the disk data. Move the unlinking of the just-created file so that we can unify the cleanup paths. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9736933143..220a5846d8 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15049,6 +15049,12 @@ qemuDomainSnapshotDiskDataFree(qemuDomainSnapshotD= iskDataPtr data, /* on success of the snapshot the 'src' and 'persistsrc' propertie= s will * be set to NULL by qemuDomainSnapshotUpdateDiskSources */ if (data[i].src) { + if (data[i].created && + virStorageFileUnlink(data[i].src) < 0) { + VIR_WARN("Unable to remove just-created %s", + NULLSTR(data[i].src->path)); + } + if (data[i].initialized) virStorageFileDeinit(data[i].src); @@ -15292,14 +15298,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPt= r driver, error: if (ret < 0) { virErrorPreserveLast(&orig_err); - for (i =3D 0; i < ndiskdata; i++) { - if (diskdata[i].prepared) - qemuDomainStorageSourceAccessRevoke(driver, vm, diskdata[i= ].src); - - if (diskdata[i].created && - virStorageFileUnlink(diskdata[i].src) < 0) - VIR_WARN("Unable to remove just-created %s", diskdata[i].s= rc->path); - } } else { /* on successful snapshot we need to remove locks from the now-old * disks and if the VM is paused release locks on the images since= qemu --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 19:20:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1559748710; cv=none; d=zoho.com; s=zohoarc; b=BLTGqcnjcF6OezFzIVGfAwe5qVY1JuYtPDuWSGU6z8VzWPdPw+RKpKitAu1qu4dhoSZYBADvIhCmYsfbteYaZO2/CpaeOuhQE+PmJtty37fBxKlqBpYNmLT3ecfODSScz6r5+kNWnf9dFFpxJEw2ezo/ZS6aRumSlAi9Slf1W/4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559748710; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=/EQaB7E4c7R22EIadUICSzvvQqs2Wc4WHy2/0dzf4G4=; b=cajoUO0jzy32MRnHcUC2kpRMDyXP1WfBe3pz9y8B6HS5UqFheYCR7PzZpUhLpuYiqe/lO8vVyrLVkVtwgW9enVGe7Ot+miPIcKTfzuMwzkQmoKv5asBZ8YlOBthmAull57W6KNnwMNX/2UTlsQEjbfEKdx7bP/zigZCIiR6xlSQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559748710873180.99291671995502; Wed, 5 Jun 2019 08:31:50 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 39641316291E; Wed, 5 Jun 2019 15:31:49 +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 13DC460BC3; Wed, 5 Jun 2019 15:31:48 +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 D1779206D7; Wed, 5 Jun 2019 15:31:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x55FSlXX012949 for ; Wed, 5 Jun 2019 11:28:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id EA6D860920; Wed, 5 Jun 2019 15:28:47 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74C515F7C0 for ; Wed, 5 Jun 2019 15:28:47 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 17:28:32 +0200 Message-Id: <57a420a4f1a7ddc62c99b896cf5959d284fbcf8f.1559748399.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/13] qemu: snapshot: Don't overload 'ret' in qemuDomainSnapshotCreateDiskActive 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 05 Jun 2019 15:31:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Introduce 'rc' for collecting state from monitor commands so that we can initialize 'ret' to -1. This also fixes few cases which could return 0 from the fucntion despite an error condition. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 220a5846d8..17270d5f83 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15239,7 +15239,8 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, qemuDomainObjPrivatePtr priv =3D vm->privateData; VIR_AUTOPTR(virJSONValue) actions =3D NULL; bool do_transaction =3D false; - int ret =3D 0; + int rc; + int ret =3D -1; size_t i; bool reuse =3D (flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) !=3D 0; qemuDomainSnapshotDiskDataPtr diskdata =3D NULL; @@ -15263,11 +15264,9 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPt= r driver, * VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL with a valid file name and * qcow2 format. */ for (i =3D 0; i < ndiskdata; i++) { - ret =3D qemuDomainSnapshotCreateSingleDiskActive(driver, vm, - &diskdata[i], - actions, reuse); - - if (ret < 0) + if (qemuDomainSnapshotCreateSingleDiskActive(driver, vm, + &diskdata[i], + actions, reuse) < 0) goto error; do_transaction =3D true; @@ -15277,24 +15276,26 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverP= tr driver, if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) goto cleanup; - ret =3D qemuMonitorTransaction(priv->mon, &actions); + rc =3D qemuMonitorTransaction(priv->mon, &actions); if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret =3D -1; + rc =3D -1; for (i =3D 0; i < ndiskdata; i++) { qemuDomainSnapshotDiskDataPtr dd =3D &diskdata[i]; - virDomainAuditDisk(vm, dd->disk->src, dd->src, "snapshot", ret= >=3D 0); + virDomainAuditDisk(vm, dd->disk->src, dd->src, "snapshot", rc = >=3D 0); - if (ret =3D=3D 0) + if (rc =3D=3D 0) qemuDomainSnapshotUpdateDiskSources(dd); } - if (ret < 0) + if (rc < 0) goto error; } + ret =3D 0; + error: if (ret < 0) { virErrorPreserveLast(&orig_err); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 19:20:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1559748615; cv=none; d=zoho.com; s=zohoarc; b=b3mihS6sbKt9pZmr7i5ctTMd/MT+oQo9M6XI2gIbNAI7Xjjb+dg3MWjhHlA4FpelA8ktjvOfQelcgEmr4PsHkIISWG6+JrqlfdYxpAO2Jk6fon3hng/vbmR1N4dzThukuuScitIoav5TOro18p3PNtq+pafxnuaOPXNLtg5wyEA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559748615; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=XZjdxM9ezHBhQL+/IPfpI9eNUX2iNsBgQS1vd06BGl4=; b=MSBc9WbI/Oo7ov0CKa1lBhoqlWR2s/NQi9EuhLXPElPNNWOZ0f4bqTS6pXJr1H/afrlAhoItcmJWkBFoYAZo70oIL6WM9OwcjXBjV+VhxMNIzYguJTVuITJ1kkUCBUycpWT0qTlpcanAvUnslA9K/OFnJUXmJJhNs0ftZLNjtC8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559748615628715.0119895278062; Wed, 5 Jun 2019 08:30:15 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 2C6FE2F8BC0; Wed, 5 Jun 2019 15:30:03 +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 CF56A1018A31; Wed, 5 Jun 2019 15:30: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 758331806B11; Wed, 5 Jun 2019 15:30:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x55FSmle012966 for ; Wed, 5 Jun 2019 11:28:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id B9AB217F22; Wed, 5 Jun 2019 15:28:48 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4263960920 for ; Wed, 5 Jun 2019 15:28:48 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 17:28:33 +0200 Message-Id: <0fb5fc017c53219bd9f598cbbff0690b1d3fe845.1559748399.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 11/13] qemu: snapshot: Unify 'cleanup' and 'error' in qemuDomainSnapshotCreateDiskActive 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 05 Jun 2019 15:30:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" All cases taking the 'cleanup' path can take the original 'error' path. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 17270d5f83..5b6d3bb795 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15267,7 +15267,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, if (qemuDomainSnapshotCreateSingleDiskActive(driver, vm, &diskdata[i], actions, reuse) < 0) - goto error; + goto cleanup; do_transaction =3D true; } @@ -15291,12 +15291,12 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverP= tr driver, } if (rc < 0) - goto error; + goto cleanup; } ret =3D 0; - error: + cleanup: if (ret < 0) { virErrorPreserveLast(&orig_err); } else { @@ -15320,7 +15320,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, vm->newDef) < 0)) ret =3D -1; - cleanup: qemuDomainSnapshotDiskDataFree(diskdata, ndiskdata, driver, vm); virErrorRestore(&orig_err); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 19:20:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1559748722; cv=none; d=zoho.com; s=zohoarc; b=kv0fdd4h9PtPIMIA5Wa1ybopMSjsxAjRXcK7I6sYjvau6fkl1wY7F8/tjnesYhZVP32yl8GevuGEmOFtpMxcuxAiFcoRpgUbSFbswpOtxwZ7+XRjBK4u2VxvNwGKG53QKMKik+50jWKYOPlDDzIYt8YSQ7F7kgkROYsXLDXHaWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559748722; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=/y+EktaBs03aIlH3R7h6LJumXWA4IaokPcyrVgKBIQw=; b=HcA+PZPOMGYDmYXec4rJGOG6EMiyqWLw+B14RJIJwTi+Ln3bmaFB1JGTarpecxwEs54E5ZVF1NjCk4mnXIePAa+AGEjIcSE3/uff+uuEucHPUZCcj+jviRpMVJeMgsi4teAwu5ss69ntNbZoaGqVVyp5BDD39ye6xXWpMai0hG0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559748722745457.30727526248245; Wed, 5 Jun 2019 08:32:02 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id EF84218DF7B; Wed, 5 Jun 2019 15:32:00 +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 C3D062E02A; Wed, 5 Jun 2019 15:31:59 +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 8A5531806B0F; Wed, 5 Jun 2019 15:31:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x55FSnje012971 for ; Wed, 5 Jun 2019 11:28:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 871CA17F22; Wed, 5 Jun 2019 15:28:49 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10D775F7C0 for ; Wed, 5 Jun 2019 15:28:48 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 17:28:34 +0200 Message-Id: <806b6bedfb2ae48b37f465e2d1deef9d2a631b53.1559748399.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/13] qemu: snapshot: Return early if there's nothing to snapshot 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 05 Jun 2019 15:32:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Skip actual snapshot creation code if we have 0 disks to snapshot. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5b6d3bb795..b7f5142605 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15259,6 +15259,12 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPt= r driver, &diskdata, &ndiskdata) < 0) goto cleanup; + /* check whether there's anything to do */ + if (ndiskdata =3D=3D 0) { + ret =3D 0; + goto cleanup; + } + /* Based on earlier qemuDomainSnapshotPrepare, all disks in this list= are * now either VIR_DOMAIN_SNAPSHOT_LOCATION_NONE, or * VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL with a valid file name and --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 19:20:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1559748641; cv=none; d=zoho.com; s=zohoarc; b=VtBvAZywfOED7WhmLK33X2yLQSgB8NV8Na6LNBuqBwOLXDaYGte9rVbAjTSesnM5AOCQBwIAyOW2hI8tDsr8WOOcW4/cXGCJ1Cv+jMgPN20YdGyBNhSNPrPuAPl10FD5f+b0oHuxerJap8OFbbVoADHxaTkWG+4fxHBmFA++lcY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559748641; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=l7Nj5N5vIZ7GoINxSIW6agYvn0/ctiPzeJ7ycbB9UaY=; b=OjVGRPkQGfZtxX1KgV8UyyKBVX73OEOeKxuDa+hpP5ytGR10ZWIhpF56MIU2W1M11Y04+BC8sq4UHscRE6z6lC2ukyC0Fk62fykXskkQVN05AD/E988cQ4w1o75ipaZS2AYyBVyVFlhyFKVEaZ4/603vOUSXRpTrHkL5uMhoyfQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559748641951121.42977039598736; Wed, 5 Jun 2019 08:30:41 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 4FBFEC004BEC; Wed, 5 Jun 2019 15:30:38 +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 A00EA5F7C2; Wed, 5 Jun 2019 15:30:37 +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 593ED206D8; Wed, 5 Jun 2019 15:30:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x55FSoSU012989 for ; Wed, 5 Jun 2019 11:28:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5661760920; Wed, 5 Jun 2019 15:28:50 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id D30675F7C1 for ; Wed, 5 Jun 2019 15:28:49 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 5 Jun 2019 17:28:35 +0200 Message-Id: <9ba755ddb7933911c3980c10a549287d42a6e866.1559748399.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 13/13] qemu: snapshot: Remove unnecessary 'do_transaction' logic in qemuDomainSnapshotCreateDiskActive 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 05 Jun 2019 15:30:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Now that we never get to the actual snapshot code if there's nothing to do we can remove the variable and surrounding logic. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b7f5142605..69aefcf659 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15238,7 +15238,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, { qemuDomainObjPrivatePtr priv =3D vm->privateData; VIR_AUTOPTR(virJSONValue) actions =3D NULL; - bool do_transaction =3D false; int rc; int ret =3D -1; size_t i; @@ -15274,32 +15273,28 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverP= tr driver, &diskdata[i], actions, reuse) < 0) goto cleanup; - - do_transaction =3D true; } - if (do_transaction) { - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto cleanup; - - rc =3D qemuMonitorTransaction(priv->mon, &actions); + if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + goto cleanup; - if (qemuDomainObjExitMonitor(driver, vm) < 0) - rc =3D -1; + rc =3D qemuMonitorTransaction(priv->mon, &actions); - for (i =3D 0; i < ndiskdata; i++) { - qemuDomainSnapshotDiskDataPtr dd =3D &diskdata[i]; + if (qemuDomainObjExitMonitor(driver, vm) < 0) + rc =3D -1; - virDomainAuditDisk(vm, dd->disk->src, dd->src, "snapshot", rc = >=3D 0); + for (i =3D 0; i < ndiskdata; i++) { + qemuDomainSnapshotDiskDataPtr dd =3D &diskdata[i]; - if (rc =3D=3D 0) - qemuDomainSnapshotUpdateDiskSources(dd); - } + virDomainAuditDisk(vm, dd->disk->src, dd->src, "snapshot", rc >=3D= 0); - if (rc < 0) - goto cleanup; + if (rc =3D=3D 0) + qemuDomainSnapshotUpdateDiskSources(dd); } + if (rc < 0) + goto cleanup; + ret =3D 0; cleanup: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list