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

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

src/PVE/QemuServer.pm | 2 +-
src/PVE/QemuServer/VolumeChain.pm | 25 +++++++++++++------------
2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 93f653c6..9c6e2cdb 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -4459,7 +4459,7 @@ sub qemu_volume_snapshot_delete {
print "stream intermediate snapshot $snap to $childsnap\n";
PVE::QemuServer::VolumeChain::blockdev_stream(
$storecfg,
- $vmid,
+ vm_qmp_peer($vmid),
$machine_version,
$attached_deviceid,
$drive,
diff --git a/src/PVE/QemuServer/VolumeChain.pm b/src/PVE/QemuServer/VolumeChain.pm
index d2042614..dad39479 100644
--- a/src/PVE/QemuServer/VolumeChain.pm
+++ b/src/PVE/QemuServer/VolumeChain.pm
@@ -284,8 +284,16 @@ sub blockdev_commit {
}

sub blockdev_stream {
- my ($storecfg, $vmid, $machine_version, $deviceid, $drive, $snap, $parent_snap, $target_snap) =
- @_;
+ my (
+ $storecfg,
+ $qmp_peer,
+ $machine_version,
+ $deviceid,
+ $drive,
+ $snap,
+ $parent_snap,
+ $target_snap,
+ ) = @_;

my $volid = $drive->{file};
$target_snap = undef if $target_snap eq 'current';
@@ -333,20 +341,13 @@ sub blockdev_stream {
$options->{'base-node'} = $parent_fmt_blockdev->{'node-name'};
$options->{'backing-file'} = $backing_file;

- mon_cmd($vmid, 'block-stream', %$options);
+ qmp_cmd($qmp_peer, 'block-stream', %$options);
$jobs->{$job_id} = {};

- PVE::QemuServer::BlockJob::monitor(
- vm_qmp_peer($vmid), undef, $jobs, 'auto', 0, 'stream',
- );
+ PVE::QemuServer::BlockJob::monitor($qmp_peer, undef, $jobs, 'auto', 0, 'stream');

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

--
2.47.3