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 5E92F1FF0E6 for ; Fri, 24 Jul 2026 16:32:49 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id E6D3D21511; Fri, 24 Jul 2026 16:32:47 +0200 (CEST) From: Fiona Ebner 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 Message-ID: <20260724143240.211130-5-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260724143240.211130-1-f.ebner@proxmox.com> References: <20260724143240.211130-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: 1784903533413 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.215 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_LOW -0.7 Sender listed at https://www.dnswl.org/, low 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: AXXHV3NNCFNWOOB2OFRD2XVHH4LPMTGE X-Message-ID-Hash: AXXHV3NNCFNWOOB2OFRD2XVHH4LPMTGE 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 --- 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. -- 2.47.3