all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 1/1] qemu-server: exit delete early if we cannot find a snapshot
Date: Wed, 30 Jul 2025 12:37:06 +0200	[thread overview]
Message-ID: <20250730103705.98313-3-s.sterz@proxmox.com> (raw)
In-Reply-To: <20250730103705.98313-2-s.sterz@proxmox.com>

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 <s.sterz@proxmox.com>
---
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


  reply	other threads:[~2025-07-30 10:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 10:37 [pve-devel] [PATCH pve-storage 1/1] fix #6587: parse snapshot names beginning from the first underscore Shannon Sterz
2025-07-30 10:37 ` Shannon Sterz [this message]
2025-07-30 16:32   ` [pve-devel] applied: [PATCH qemu-server 1/1] qemu-server: exit delete early if we cannot find a snapshot Fiona Ebner
2025-07-30 15:43 ` [pve-devel] [PATCH pve-storage 1/1] fix #6587: parse snapshot names beginning from the first underscore Fiona Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250730103705.98313-3-s.sterz@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal