From nobody Sun Feb 8 20:59:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1623856033; cv=none; d=zohomail.com; s=zohoarc; b=dmBrJuPCq0RjUM73bGCOL44PybgdZzet+WIC1hbfxrWSAjKl2fPSLC7GEJd976SI3stAR5rsvmHcdW2nIRaeh1XalxJezcexUty2gK/BZjnD3muQLi3bR6CT0sKJw4WvTBTEpsq/s7YEnF21pW5+bWFjE+kUuhxtr345xzuVEsE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623856033; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5/3sKjPcixzjY7EHUca4yVl14v3h4da5FoYr8AbKPpo=; b=RXedgLXm2xXwwO73B/gw9uriy5O8V5U/NydzlfhhRzrg9RRa6+j8jLXVRYRnYpTt8WBcyEgW7Fu5ksYLOEpX5V5GOoKPIbRtlvHRqcydsSaTX/S8q7wG9wrL++xzliPVHISbLnScChKoI8yhYaD3dEXAq7aPkmVwV5LDAaNaCD0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1623856033683929.557996966563; Wed, 16 Jun 2021 08:07:13 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-66-c8h_O7DSNMWvs500dCAgkA-1; Wed, 16 Jun 2021 11:06:10 -0400 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 031018042AD; Wed, 16 Jun 2021 15:06: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 D2A291001B2C; Wed, 16 Jun 2021 15:05: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 9A3491809CBE; Wed, 16 Jun 2021 15:05:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15GF5qMQ012877 for ; Wed, 16 Jun 2021 11:05:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0B2165D9E3; Wed, 16 Jun 2021 15:05:52 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5676C5D9E2 for ; Wed, 16 Jun 2021 15:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623856031; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=5/3sKjPcixzjY7EHUca4yVl14v3h4da5FoYr8AbKPpo=; b=FjPZw1xlhMD4LAZGjSINasG8QBZbCVwE1J2rGJhNsWtYsni9XOy9mPbuvsXeEXgtimK/zN MEjLI+YSagEbi5AUCQ5CSBuWvkjLn8UnsT4Gvkh3cXQPvg/JEy35HLn3b4NWqpZqhPr2SS hJWIBa/HZ/Y41zlnx+7iarcXBHDVWpU= X-MC-Unique: c8h_O7DSNMWvs500dCAgkA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 7/7] qemuSnapshotCreateActiveExternal: Don't unlink memory snapshot image if it was existing before Date: Wed, 16 Jun 2021 17:05:37 +0200 Message-Id: <1cadd16e7fa882b4f4df278048fdf2072b7d4e23.1623855902.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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" When writing the memory snapshot into an existing file don't remove it if the snapshot fails later. Signed-off-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 99fc4b836f..4e74ddd7f8 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1356,6 +1356,7 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *drive= r, virDomainSnapshotDef *snapdef =3D virDomainSnapshotObjGetDef(snap); bool memory =3D snapdef->memory =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EX= TERNAL; bool memory_unlink =3D false; + bool memory_existing =3D false; bool thaw =3D false; bool pmsuspended =3D false; int compressed; @@ -1451,13 +1452,16 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *dri= ver, goto cleanup; xml =3D NULL; + memory_existing =3D virFileExists(snapdef->memorysnapshotfile); + if ((ret =3D qemuSaveImageCreate(driver, vm, snapdef->memorysnapsh= otfile, data, compressor, 0, QEMU_ASYNC_JOB_SNAPSHOT)) < 0) goto cleanup; /* the memory image was created, remove it on errors */ - memory_unlink =3D true; + if (!memory_existing) + memory_unlink =3D true; /* forbid any further manipulation */ qemuDomainObjSetAsyncJobMask(vm, QEMU_JOB_DEFAULT_MASK); --=20 2.31.1