From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server 4/9] blockdev: attach: support explicitly attaching as writeable
Date: Fri, 24 Jul 2026 16:32:25 +0200 [thread overview]
Message-ID: <20260724143240.211130-5-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260724143240.211130-1-f.ebner@proxmox.com>
If the read-only option is explicitly set to 0, override the drive
configuration and attach the drive as writeable. This is useful for
making exports and mirror targets below throttle writeable even if the
drive itself is configured as read-only.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PVE/QemuServer/Blockdev.pm | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/PVE/QemuServer/Blockdev.pm b/src/PVE/QemuServer/Blockdev.pm
index 101c747c..879e1aab 100644
--- a/src/PVE/QemuServer/Blockdev.pm
+++ b/src/PVE/QemuServer/Blockdev.pm
@@ -202,7 +202,9 @@ sub get_node_name_below_throttle {
my sub read_only_json_option {
my ($drive, $options) = @_;
- return json_bool($drive->{ro} || drive_is_cdrom($drive) || $options->{'read-only'});
+ return json_bool($options->{'read-only'}) if defined($options->{'read-only'});
+
+ return json_bool($drive->{ro} || drive_is_cdrom($drive));
}
# Common blockdev options that need to be set across the whole throttle->fmt->file chain.
@@ -571,8 +573,8 @@ Parameters:
=item C<< $options->{'no-throttle'} >>: Do not insert a throttle node as the top node.
-=item C<< $options->{'read-only'} >>: Attach the image as read-only irrespective of the
-configuration in C<$drive>.
+=item C<< $options->{'read-only'} >>: Attach the image as read-only or as writeable irrespective of
+the configuration in C<$drive>.
=item C<< $options->{size} >>: Attach the image with this virtual size. Must be smaller than the
actual size of the image. The image format must be C<raw>.
--
2.47.3
next prev parent reply other threads:[~2026-07-24 14:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 14:32 [PATCH-SERIES qemu/qemu-server 0/9] mirror: fix regressions with blockdev and allow migration with 'ro' flag Fiona Ebner
2026-07-24 14:32 ` [PATCH qemu 1/9] add patch to allow mirror job to use non-root block node Fiona Ebner
2026-07-24 14:32 ` [PATCH qemu-server 2/9] partially fix #7299: fix regression with guest IO limits applying to mirror job Fiona Ebner
2026-07-24 14:32 ` [PATCH qemu-server 3/9] partially fix #7299: migrate: fix regression with guest IO limits applying to NBD export Fiona Ebner
2026-07-24 14:32 ` Fiona Ebner [this message]
2026-07-24 14:32 ` [PATCH qemu-server 5/9] blockdev: implement reopen function Fiona Ebner
2026-07-24 14:32 ` [PATCH qemu-server 6/9] partially fix #7836: allow mirror for drive with read-only flag when using blockdev Fiona Ebner
2026-07-24 14:32 ` [PATCH qemu-server 7/9] qm: schema: declare 'nbdstop' command as being for internal use only Fiona Ebner
2026-07-24 14:32 ` [PATCH qemu-server 8/9] migrate: log messages from remote nbdstop command Fiona Ebner
2026-07-24 14:32 ` [PATCH qemu-server 9/9] partially fix #7836: allow migration for drive with read-only flag when using blockdev Fiona Ebner
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=20260724143240.211130-5-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox