From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id D93B91FF183 for ; Wed, 13 Aug 2025 10:57:14 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C311D1F33E; Wed, 13 Aug 2025 10:58:51 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Wed, 13 Aug 2025 10:58:36 +0200 Message-ID: <20250813085845.25516-2-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250813085845.25516-1-f.ebner@proxmox.com> References: <20250813085845.25516-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1755075496581 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.025 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qemuserver.pm] Subject: [pve-devel] [PATCH qemu-server 1/2] fix #6680: avoid setting nonexistent 'write-cache' option for scsi-{block, generic} X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Only scsi-cd and scsi-hd have a 'write-cache' option, scsi-block and scsi-generic do not. Setting the 'cache' setting on such a drive in the VM configuration is still valid and should not be prohibited, because it affects the blockdev settings. Signed-off-by: Fiona Ebner --- src/PVE/QemuServer.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm index d40b14de..99d4da4f 100644 --- a/src/PVE/QemuServer.pm +++ b/src/PVE/QemuServer.pm @@ -1203,6 +1203,7 @@ sub print_drivedevice_full { my $maxdev = 0; my $machine_version = extract_version($machine_type, kvm_user_version()); + my $has_write_cache = 1; # whether the device has a 'write-cache' option my $drive_id = PVE::QemuServer::Drive::get_drive_id($drive); if ($drive->{interface} eq 'virtio') { @@ -1244,7 +1245,8 @@ sub print_drivedevice_full { } $device .= ",wwn=$drive->{wwn}" if $drive->{wwn}; - # only scsi-hd and scsi-cd support passing vendor and product information + # only scsi-hd and scsi-cd support passing vendor and product information and have a + # 'write-cache' option if ($device_type eq 'hd' || $device_type eq 'cd') { if (my $vendor = $drive->{vendor}) { $device .= ",vendor=$vendor"; @@ -1252,6 +1254,10 @@ sub print_drivedevice_full { if (my $product = $drive->{product}) { $device .= ",product=$product"; } + + $has_write_cache = 1; + } else { + $has_write_cache = 0; } } elsif ($drive->{interface} eq 'ide' || $drive->{interface} eq 'sata') { @@ -1316,7 +1322,7 @@ sub print_drivedevice_full { } if (min_version($machine_version, 10, 0)) { # for the switch to -blockdev - if (!drive_is_cdrom($drive)) { + if (!drive_is_cdrom($drive) && $has_write_cache) { my $write_cache = 'on'; if (my $cache = $drive->{cache}) { $write_cache = 'off' if $cache eq 'writethrough' || $cache eq 'directsync'; -- 2.47.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel