From nobody Wed Jan 15 05:13:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1695043829; cv=none; d=zohomail.com; s=zohoarc; b=T6gLAaj4zBEv6bj48d4xYwGL1HEdJk3vZFNEarJZPaBKKvmeNCyo9TSQXGodkRooUcLURcYD5+aHefzL32adRY9c9d9WPmRF4N/V74aswnccpdGVac2l1mnbdt8W7YdjOmCS2g5m10wvIIy8PcG7cs9TbDN1Be5UGfPWeLVMg9w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695043829; 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=xIfmM5M+XIjz9LnrN93gT1YEcUde2KZsE2t/Lb+AL98=; b=Qn3gfBetxUuOhPjLErUv9mFRfGIwKlm4ohT4Q2TIo7UHltaFKxSk55DPIs7Kkdy2hGYdpmPAvc68gLd61maZ2V7e9i5IhYfEji9d9HISxTyYxkf1Hlx/uKpxGNOvafSWiNfx7W4vxNmSrno+e8WTerkqEaAQJPDck88ZLF3HmTg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1695043829396688.8910573421588; Mon, 18 Sep 2023 06:30:29 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-70-tMGMb4RCNOmFVXcndmwe1Q-1; Mon, 18 Sep 2023 09:30:23 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22CEA1C0514C; Mon, 18 Sep 2023 13:30:17 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C98E40C2070; Mon, 18 Sep 2023 13:30:17 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AF94B19465A4; Mon, 18 Sep 2023 13:29:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E3C0919465B2 for ; Mon, 18 Sep 2023 13:29:42 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id CF559170EC; Mon, 18 Sep 2023 13:29:37 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70FA11C554 for ; Mon, 18 Sep 2023 13:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695043828; 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=xIfmM5M+XIjz9LnrN93gT1YEcUde2KZsE2t/Lb+AL98=; b=Ub+pFlFmy51trccecuXTS9LTbTBAJVr95OCcZeSFTcZewWoIJL+BP/Y3UHcvtPSoaHHye6 QjIG0QPiwzDuJtUTUdCWotp/nqgCqYfP7KXrnnIjOLT3xATbfi/LxJSdmVFB8jJ3bpm1lX 0BDaFZNLRRQl6Q2iMY0FfWYbHYxmmFc= X-MC-Unique: tMGMb4RCNOmFVXcndmwe1Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH v3 07/10] qemu_snapshot: fix reverting external snapshot when not all disks are included Date: Mon, 18 Sep 2023 15:29:24 +0200 Message-ID: <890c3b2aeb7c6fd8f977b29147934247b2dcd80b.1695043512.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1695043830180100001 Content-Type: text/plain; charset="utf-8"; x-default="true" We need to skip all disks that have snapshot type other than 'external'. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index cdc8e12cff..44bd97e564 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2054,6 +2054,9 @@ qemuSnapshotRevertExternalPrepare(virDomainObj *vm, virDomainSnapshotDiskDef *snapdisk =3D &tmpsnapdef->disks[i]; virDomainDiskDef *domdisk =3D domdef->disks[i]; =20 + if (snapdisk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) + continue; + if (qemuSnapshotPrepareDiskExternal(domdisk, snapdisk, active, fal= se) < 0) return -1; } @@ -2094,6 +2097,9 @@ qemuSnapshotRevertExternalActive(virDomainObj *vm, return -1; =20 for (i =3D 0; i < tmpsnapdef->ndisks; i++) { + if (tmpsnapdef->disks[i].snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATIO= N_EXTERNAL) + continue; + if (qemuSnapshotDiskPrepareOne(snapctxt, vm->def->disks[i], tmpsnapdef->disks + i, @@ -2184,6 +2190,9 @@ qemuSnapshotRevertExternalFinish(virDomainObj *vm, for (i =3D 0; i < curdef->nrevertdisks; i++) { virDomainSnapshotDiskDef *snapdisk =3D &(curdef->revertdisks[i= ]); =20 + if (snapdisk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTER= NAL) + continue; + if (virStorageSourceInit(snapdisk->src) < 0 || virStorageSourceUnlink(snapdisk->src) < 0) { VIR_WARN("Failed to remove snapshot image '%s'", @@ -2199,6 +2208,9 @@ qemuSnapshotRevertExternalFinish(virDomainObj *vm, for (i =3D 0; i < curdef->ndisks; i++) { virDomainSnapshotDiskDef *snapdisk =3D &(curdef->disks[i]); =20 + if (snapdisk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTER= NAL) + continue; + if (virStorageSourceInit(snapdisk->src) < 0 || virStorageSourceUnlink(snapdisk->src) < 0) { VIR_WARN("Failed to remove snapshot image '%s'", --=20 2.41.0