From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id B743B1FF183 for ; Wed, 30 Jul 2025 12:36:28 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 05AA8A177; Wed, 30 Jul 2025 12:37:50 +0200 (CEST) From: Shannon Sterz To: pve-devel@lists.proxmox.com Date: Wed, 30 Jul 2025 12:37:06 +0200 Message-ID: <20250730103705.98313-3-s.sterz@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250730103705.98313-2-s.sterz@proxmox.com> References: <20250730103705.98313-2-s.sterz@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1753871824168 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.022 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH qemu-server 1/1] qemu-server: exit delete early if we cannot find a snapshot X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Die if the list of snapshots returned by `volume_snapshot_info` does not contain the snapshot we are trying to delete. Previously it was just assumed that the snapshot would be present, leading to the entry in the list being autoviviefied by the following lines of code. Hence, we tried to commit nonexistent snapshot states here, as both `$parentsnap` and `$childsnap` would be undefined. Signed-off-by: Shannon Sterz --- consider this more of a suggestion, but the autovivification here made this bug somewhat more annoying to debug and i don't really see a reason not to check that here (after all, what behaviour should be expected in this case?) src/PVE/QemuServer.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm index 5a4f8120..ef8f2fc0 100644 --- a/src/PVE/QemuServer.pm +++ b/src/PVE/QemuServer.pm @@ -4418,6 +4418,9 @@ sub qemu_volume_snapshot_delete { my $path = PVE::Storage::path($storecfg, $volid); my $snapshots = PVE::Storage::volume_snapshot_info($storecfg, $volid); + + die "could not find snapshot '$snap'\n" if !defined($snapshots->{$snap}); + my $parentsnap = $snapshots->{$snap}->{parent}; my $childsnap = $snapshots->{$snap}->{child}; my $machine_version = PVE::QemuServer::Machine::get_current_qemu_machine($vmid); -- 2.47.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel