[pve-devel] [PATCH v6 qemu-server 4/4] fix #4957: add vendor and product information passthrough for SCSI-Disks
Fiona Ebner
f.ebner at proxmox.com
Fri Jan 5 17:00:27 CET 2024
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 <h.duerr at proxmox.com>
> ---
> 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.
More information about the pve-devel
mailing list