[PATCH qemu-server v3 14/18] blockdev: switch blockdev_delete() to use QMP peer

Fiona Ebner
2026-04-23T09:38:28Z

In preparation to allow snapshot operations for QSD-FUSE-exported
TPM states.

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

diff --git a/src/PVE/QemuServer/VolumeChain.pm b/src/PVE/QemuServer/VolumeChain.pm
index 8dd29d61..d2042614 100644
--- a/src/PVE/QemuServer/VolumeChain.pm
+++ b/src/PVE/QemuServer/VolumeChain.pm
@@ -64,9 +64,9 @@ sub blockdev_external_snapshot {
}

sub blockdev_delete {
- my ($storecfg, $vmid, $drive, $file_blockdev, $fmt_blockdev, $snap) = @_;
+ my ($storecfg, $qmp_peer, $drive, $file_blockdev, $fmt_blockdev, $snap) = @_;

- eval { PVE::QemuServer::Blockdev::detach(vm_qmp_peer($vmid), $fmt_blockdev->{'node-name'}); };
+ eval { PVE::QemuServer::Blockdev::detach($qmp_peer, $fmt_blockdev->{'node-name'}); };
warn "detaching block node for $file_blockdev->{filename} failed - $@" if $@;

#delete the file (don't use vdisk_free as we don't want to delete all snapshot chain)
@@ -260,7 +260,12 @@ sub blockdev_commit {
);

blockdev_delete(
- $storecfg, $vmid, $drive, $src_file_blockdev, $src_fmt_blockdev, $src_snap,
+ $storecfg,
+ vm_qmp_peer($vmid),
+ $drive,
+ $src_file_blockdev,
+ $src_fmt_blockdev,
+ $src_snap,
);
};
my $err = $@;
@@ -335,7 +340,14 @@ sub blockdev_stream {
vm_qmp_peer($vmid), undef, $jobs, 'auto', 0, 'stream',
);

- blockdev_delete($storecfg, $vmid, $drive, $snap_file_blockdev, $snap_fmt_blockdev, $snap);
+ blockdev_delete(
+ $storecfg,
+ vm_qmp_peer($vmid),
+ $drive,
+ $snap_file_blockdev,
+ $snap_fmt_blockdev,
+ $snap,
+ );
}

1;
--
2.47.3