all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server 3/7] fix #8071: volume snapshot delete: use current drive information to fix SAVC handling
Date: Fri, 25 Sep 2026 14:26:27 +0200	[thread overview]
Message-ID: <20260925122646.139215-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260925122646.139215-1-f.ebner@proxmox.com>

When removing a volume chain snapshot, the blockdev properties are
re-generated in blockdev_{commit,replace,stream}() to operate upon.
This must happen with the current drive information, not the one from
the time the snapshot was taken.

A similar bug was present before volume chain snapshots existed, and
fixed by commit c6058683 ("fix #2258: select correct device when
removing drive snapshot via QEMU"). This is where the handling for
$attached_deviceid comes from. With snapshot-as-volume-chain, this
needs to be extended to the full drive information, not just the
device ID.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/PVE/QemuConfig.pm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/PVE/QemuConfig.pm b/src/PVE/QemuConfig.pm
index 3dd69ce8..39e88366 100644
--- a/src/PVE/QemuConfig.pm
+++ b/src/PVE/QemuConfig.pm
@@ -441,13 +441,19 @@ sub __snapshot_delete_vol_snapshot {
     my $running = PVE::QemuServer::Helpers::vm_running_locally($vmid);
     my $attached_deviceid;
 
+    # Need to operate on the currently attached device if the VM is running for QMP handling to
+    # work correctly. For blockdev generation, it's also important that the same drive information
+    # as currently attached is used, because otherwise node names and other settings might differ.
     if ($running) {
         my $conf = $class->load_config($vmid);
         $class->foreach_volume(
             $conf,
             sub {
-                my ($ds, $drive) = @_;
-                $attached_deviceid = "drive-$ds" if $drive->{file} eq $volid;
+                my ($ds, $current_drive) = @_;
+                if ($current_drive->{file} eq $volid) {
+                    $attached_deviceid = "drive-$ds";
+                    $drive = $current_drive;
+                }
             },
         );
     }
-- 
2.47.3





  parent reply	other threads:[~2026-09-25 12:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 12:26 [PATCH-SERIES qemu-server 0/7] fix #8071: volume snapshot delete: use current drive information to fix SAVC handling Fiona Ebner
2026-09-25 12:26 ` [PATCH qemu-server 1/7] volume snapshot (delete): avoid using deprecated check_running() helper Fiona Ebner
2026-09-25 12:26 ` [PATCH qemu-server 2/7] volume snapshot delete: move getting attached device ID to caller Fiona Ebner
2026-09-25 12:26 ` Fiona Ebner [this message]
2026-09-25 12:26 ` [PATCH qemu-server 4/7] snapshot: add module for snapshot-related functionality Fiona Ebner
2026-09-25 12:26 ` [PATCH qemu-server 5/7] snapshot: use v5.36 and subroutine signatures Fiona Ebner
2026-09-25 12:26 ` [PATCH qemu-server 6/7] volume chain: blockdev delete: remove superfluous parse_volume_id() call Fiona Ebner
2026-09-25 12:26 ` [PATCH qemu-server 7/7] volume chain: blockdev delete: pass volume ID instead of drive and mark private 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=20260925122646.139215-4-f.ebner@proxmox.com \
    --to=f.ebner@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