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: [pve-devel] [PATCH qemu-server] fix #6713: snapshot volume chain: fix snapshot after disk move with zeroinit
Date: Fri, 19 Sep 2025 14:08:36 +0200	[thread overview]
Message-ID: <20250919120848.60751-1-f.ebner@proxmox.com> (raw)

After mirror, the node below throttle might not be the format node,
but can also be a zeroinit node. In particular, this is the node that
needs to be used by when replacing the blockdev for volume-chain
snapshots for the 'current' snapshot. Look up the actually inserted
node below throttle, rather than assuming that it's the format node.

Also removes the $src_file_blockdev_name variable that has been unused
since commit e7cf7c00 ("blockdev: delete/replace: re-use detach()
helper").

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

diff --git a/src/PVE/QemuServer/Blockdev.pm b/src/PVE/QemuServer/Blockdev.pm
index d4062148..8e6749e8 100644
--- a/src/PVE/QemuServer/Blockdev.pm
+++ b/src/PVE/QemuServer/Blockdev.pm
@@ -924,9 +924,15 @@ sub blockdev_replace {
     my $volid = $drive->{file};
     my $drive_id = PVE::QemuServer::Drive::get_drive_id($drive);
 
-    my $src_name_options = $src_snap eq 'current' ? {} : { 'snapshot-name' => $src_snap };
-    my $src_file_blockdev_name = get_node_name('file', $drive_id, $volid, $src_name_options);
-    my $src_fmt_blockdev_name = get_node_name('fmt', $drive_id, $volid, $src_name_options);
+    my $src_name_options = {};
+    my $src_blockdev_name;
+    if ($src_snap eq 'current') {
+        # there might be other nodes on top like zeroinit, look up the current node below throttle
+        $src_blockdev_name = get_node_name_below_throttle($vmid, $deviceid, 1);
+    } else {
+        $src_name_options = { 'snapshot-name' => $src_snap };
+        $src_blockdev_name = get_node_name('fmt', $drive_id, $volid, $src_name_options);
+    }
 
     my $target_file_blockdev = generate_file_blockdev(
         $storecfg,
@@ -989,7 +995,7 @@ sub blockdev_replace {
     }
 
     # delete old file|fmt nodes
-    eval { detach($vmid, $src_fmt_blockdev_name); };
+    eval { detach($vmid, $src_blockdev_name); };
     warn "detaching block node for $src_snap failed - $@" if $@;
 }
 
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


             reply	other threads:[~2025-09-19 12:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19 12:08 Fiona Ebner [this message]
2025-09-19 13:38 ` Aaron Lauterer

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=20250919120848.60751-1-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