From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id B3E741FF0B2 for ; Fri, 25 Sep 2026 14:27:42 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 7F23B217D3; Fri, 25 Sep 2026 14:26:56 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server 7/7] volume chain: blockdev delete: pass volume ID instead of drive and mark private Date: Fri, 25 Sep 2026 14:26:31 +0200 Message-ID: <20260925122646.139215-8-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260925122646.139215-1-f.ebner@proxmox.com> References: <20260925122646.139215-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1790339210345 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.502 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: VRX5Y54X6L7KZWQOOOC2LRO75JLCQC2L X-Message-ID-Hash: VRX5Y54X6L7KZWQOOOC2LRO75JLCQC2L X-MailFrom: f.ebner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The only part of the drive that's used by blockdev_delete() is the volume ID. Remove the local volid variables in blockdev_{commit,stream}() which are in-scope for the whole function but never used. The blockdev_delete() function is not used outside of the VolumeChain module and it has a quite specific signature tailored towards its two existing callers. Signed-off-by: Fiona Ebner --- src/PVE/QemuServer/VolumeChain.pm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/PVE/QemuServer/VolumeChain.pm b/src/PVE/QemuServer/VolumeChain.pm index 1ad137ed..f52deead 100644 --- a/src/PVE/QemuServer/VolumeChain.pm +++ b/src/PVE/QemuServer/VolumeChain.pm @@ -63,8 +63,8 @@ sub blockdev_external_snapshot { ); } -sub blockdev_delete { - my ($storecfg, $qmp_peer, $drive, $file_blockdev, $fmt_blockdev, $snap) = @_; +my sub blockdev_delete { + my ($storecfg, $qmp_peer, $volid, $file_blockdev, $fmt_blockdev, $snap) = @_; eval { PVE::QemuServer::Blockdev::detach($qmp_peer, $fmt_blockdev->{'node-name'}); }; warn "detaching block node for $file_blockdev->{filename} failed - $@" if $@; @@ -72,7 +72,6 @@ sub blockdev_delete { #delete the file (don't use vdisk_free as we don't want to delete all snapshot chain) print "delete old $file_blockdev->{filename}\n"; - my $volid = $drive->{file}; PVE::Storage::volume_snapshot_delete($storecfg, $volid, $snap, 1); } @@ -192,7 +191,6 @@ sub blockdev_replace { sub blockdev_commit { my ($storecfg, $qmp_peer, $machine_version, $deviceid, $drive, $src_snap, $target_snap) = @_; - my $volid = $drive->{file}; my $target_was_read_only; print "block-commit $src_snap to base:$target_snap\n"; @@ -256,7 +254,12 @@ sub blockdev_commit { PVE::QemuServer::BlockJob::monitor($qmp_peer, undef, $jobs, $complete, 0, 'commit'); blockdev_delete( - $storecfg, $qmp_peer, $drive, $src_file_blockdev, $src_fmt_blockdev, $src_snap, + $storecfg, + $qmp_peer, + $drive->{file}, + $src_file_blockdev, + $src_fmt_blockdev, + $src_snap, ); }; my $err = $@; @@ -286,7 +289,6 @@ sub blockdev_stream { $target_snap, ) = @_; - my $volid = $drive->{file}; $target_snap = undef if $target_snap eq 'current'; my $parent_file_blockdev = generate_file_blockdev( @@ -338,7 +340,7 @@ sub blockdev_stream { PVE::QemuServer::BlockJob::monitor($qmp_peer, undef, $jobs, 'auto', 0, 'stream'); blockdev_delete( - $storecfg, $qmp_peer, $drive, $snap_file_blockdev, $snap_fmt_blockdev, $snap, + $storecfg, $qmp_peer, $drive->{file}, $snap_file_blockdev, $snap_fmt_blockdev, $snap, ); } -- 2.47.3