From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 49352BF572 for ; Fri, 5 Jan 2024 17:00:29 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2A28F1DD26 for ; Fri, 5 Jan 2024 17:00:29 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 5 Jan 2024 17:00:28 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 3569248CE6 for ; Fri, 5 Jan 2024 17:00:28 +0100 (CET) Message-ID: Date: Fri, 5 Jan 2024 17:00:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Fiona Ebner To: Proxmox VE development discussion , Hannes Duerr References: <20231206074745.18832-1-h.duerr@proxmox.com> <20231206074745.18832-5-h.duerr@proxmox.com> Content-Language: en-US In-Reply-To: <20231206074745.18832-5-h.duerr@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.076 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pve-devel] [PATCH v6 qemu-server 4/4] fix #4957: add vendor and product information passthrough for SCSI-Disks 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: , X-List-Received-Date: Fri, 05 Jan 2024 16:00:29 -0000 Am 06.12.23 um 08:47 schrieb Hannes Duerr: > adds vendor and product information for SCSI devices to the json schema > and checks in the VM create/update API call if it is possible to add > these to QEMU as a device option > > Signed-off-by: Hannes Duerr > --- > PVE/API2/Qemu.pm | 38 ++++++++++++++++++++++++++++++++++++++ > PVE/QemuServer.pm | 13 ++++++++++++- > PVE/QemuServer/Drive.pm | 24 ++++++++++++++++++++++++ > 3 files changed, 74 insertions(+), 1 deletion(-) > > diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm > index 9e3cfb5..e0fbb3c 100644 > --- a/PVE/API2/Qemu.pm > +++ b/PVE/API2/Qemu.pm > @@ -696,6 +696,33 @@ my $check_vm_modify_config_perm = sub { > return 1; > }; > > +sub assert_scsi_feature_compatibility { > + my ($opt, $conf, $storecfg, $drive_attributes) = @_; > + > + my $drive = PVE::QemuServer::Drive::parse_drive($opt, $drive_attributes); > + > + my $machine_type = PVE::QemuServer::get_vm_machine($conf, undef, $conf->{arch}); > + my $machine_version = PVE::QemuServer::extract_version( > + $machine_type, PVE::QemuServer::kvm_user_version()); Is there a specific reason you don't use PVE::QemuServer::Machine::extract_version() here? Would avoid the need to make the helper below public: > diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm > index b3e651e..3a4c30d 100644 > --- a/PVE/QemuServer.pm > +++ b/PVE/QemuServer.pm > @@ -1218,7 +1218,8 @@ sub kvm_user_version { > return $kvm_user_version->{$binary}; > > } > -my sub extract_version { > + > +our sub extract_version { > my ($machine_type, $version) = @_; > $version = kvm_user_version() if !defined($version); > return PVE::QemuServer::Machine::extract_version($machine_type, $version) i.e. here. Note for the future: there's no need to add 'our' for a sub. Things I noticed while testing: 1. Currently the new properties are directly applied to the config, but not actually hotplugged. You'll need to skip them in vmconfig_update_disk(). 2. udevadm info seems to only show the first eight characters for ID_VENDOR and first sixteen characters for ID_MODEL. Can you check if that is a limitation there or if more is simply not supported? If the latter, we should limit the sizes in the schema accordingly.