From nobody Thu May 9 09:23:50 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1706617037303907.5383612501032; Tue, 30 Jan 2024 04:17:17 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 0DBC31C31; Tue, 30 Jan 2024 07:17:16 -0500 (EST) Received: from lists.libvirt.org.85.43.8.in-addr.arpa (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id CEC67199E; Tue, 30 Jan 2024 07:15:57 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 0A8BC195D; Tue, 30 Jan 2024 07:15:54 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 7FE091949 for ; Tue, 30 Jan 2024 07:15:53 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-176-w0IZDRmXMMWYc2ssrTVm4w-1; Tue, 30 Jan 2024 07:15:51 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A66F21C05EB8 for ; Tue, 30 Jan 2024 12:15:51 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.45.224.183]) by smtp.corp.redhat.com (Postfix) with ESMTP id 508FCC1ED63 for ; Tue, 30 Jan 2024 12:15:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: w0IZDRmXMMWYc2ssrTVm4w-1 From: Pavel Hrdina To: devel@lists.libvirt.org Subject: [libvirt PATCH] qemu_snapshot: fix detection if non-leaf snapshot isn't in active chain Date: Tue, 30 Jan 2024 13:15:50 +0100 Message-ID: <20003eac1c479cee580d14594a2f6e3e1fe31e0b.1706616942.git.phrdina@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: VFIR6MQLZTYAJAQGWG2FFETEHWHXHNEE X-Message-ID-Hash: VFIR6MQLZTYAJAQGWG2FFETEHWHXHNEE X-MailFrom: phrdina@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1706617039461100001 The condition was completely wrong. As per the comment for function virDomainMomentIsAncestor() it checks that the first argument is descendant of the second argument. Consider the following snapshot tree for VM: s1 | +- s2 | | | +- s3 | +- s4 | +- s5 (current) When deleting s2 with the original code we checked if virDomainMomentIsAncestor(s2, s5) which would return false basically for any snapshot as s5 is leaf snapshot so no children. When deleting s2 with fixed code we check if virDomainMomentIsAncestor(s5, s2) which still returns false but when deleting s4 it will correctly return true. Resolves: https://issues.redhat.com/browse/RHEL-23212 Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 73ff533827..af5f995b0d 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -3815,7 +3815,7 @@ qemuSnapshotDeleteValidate(virDomainObj *vm, } =20 if (snap !=3D current && snap->nchildren !=3D 0 && - virDomainMomentIsAncestor(snap, current)) { + !virDomainMomentIsAncestor(current, snap)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("deletion of non-leaf external snapshot that = is not in active chain is not supported")); return -1; --=20 2.43.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org