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 D5D451FF0B3 for ; Wed, 11 Nov 2026 13:02:49 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 804C5216C9; Wed, 11 Nov 2026 13:02:21 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v2 4/9] blockdev: attach: support explicitly attaching as writeable Date: Wed, 11 Nov 2026 13:01:43 +0100 Message-ID: <20261111120211.110737-5-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261111120211.110737-1-f.ebner@proxmox.com> References: <20261111120211.110737-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: 1794398534796 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.282 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: WO3NO4N7PVPZBAOVJRLHJYLUPRH4TQFK X-Message-ID-Hash: WO3NO4N7PVPZBAOVJRLHJYLUPRH4TQFK 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: 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 --- No changes in v2. 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 c2989a37..ef038c7e 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. -- 2.47.3