[pve-devel] [PATCH qemu-server 13/16] blockdev: attach: also return whether attached blockdev is read-only
Fiona Ebner
f.ebner at proxmox.com
Tue Oct 14 16:39:24 CEST 2025
This is in preparation for the qemu-storage-daemon, so that it can
apply the same setting for the export.
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
src/PVE/QemuServer/BlockJob.pm | 2 +-
src/PVE/QemuServer/Blockdev.pm | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/PVE/QemuServer/BlockJob.pm b/src/PVE/QemuServer/BlockJob.pm
index 506010e1..c89994db 100644
--- a/src/PVE/QemuServer/BlockJob.pm
+++ b/src/PVE/QemuServer/BlockJob.pm
@@ -480,7 +480,7 @@ sub blockdev_mirror {
# Note that if 'aio' is not explicitly set, i.e. default, it can change if source and target
# don't both allow or both not allow 'io_uring' as the default.
- my $target_node_name =
+ my ($target_node_name) =
PVE::QemuServer::Blockdev::attach($storecfg, $vmid, $dest_drive, $attach_dest_opts);
$jobs = {} if !$jobs;
diff --git a/src/PVE/QemuServer/Blockdev.pm b/src/PVE/QemuServer/Blockdev.pm
index d08a4855..f799c70b 100644
--- a/src/PVE/QemuServer/Blockdev.pm
+++ b/src/PVE/QemuServer/Blockdev.pm
@@ -528,10 +528,10 @@ my sub blockdev_add {
=head3 attach
- my $node_name = attach($storecfg, $vmid, $drive, $options);
+ my ($node_name, $read_only) = attach($storecfg, $vmid, $drive, $options);
Attach the drive C<$drive> to the VM C<$vmid> considering the additional options C<$options>.
-Returns the node name of the (topmost) attached block device node.
+Returns the node name of the (topmost) attached block device node and whether the node is read-only.
Parameters:
@@ -611,7 +611,7 @@ sub attach {
die $err;
}
- return $blockdev->{'node-name'};
+ return ($blockdev->{'node-name'}, $blockdev->{'read-only'});
}
=pod
--
2.47.3
More information about the pve-devel
mailing list