all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Hannes Duerr <h.duerr@proxmox.com>
Subject: Re: [pve-devel] [PATCH v6 qemu-server 4/4] fix #4957: add vendor and product information passthrough for SCSI-Disks
Date: Fri, 5 Jan 2024 17:00:27 +0100	[thread overview]
Message-ID: <a250b1f1-98e2-4f08-8efc-f350284d5bca@proxmox.com> (raw)
In-Reply-To: <20231206074745.18832-5-h.duerr@proxmox.com>

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@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.




  reply	other threads:[~2024-01-05 16:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06  7:47 [pve-devel] [PATCH v6 qemu-server 0/4] " Hannes Duerr
2023-12-06  7:47 ` [pve-devel] [PATCH v6 qemu-server 1/4] Move path_is_scsi to QemuServer/Drive.pm Hannes Duerr
2023-12-06  7:47 ` [pve-devel] [PATCH v6 qemu-server 2/4] Move NEW_DISK_RE " Hannes Duerr
2023-12-06  7:47 ` [pve-devel] [PATCH v6 qemu-server 3/4] drive: Create get_scsi_devicetype Hannes Duerr
2023-12-06  7:47 ` [pve-devel] [PATCH v6 qemu-server 4/4] fix #4957: add vendor and product information passthrough for SCSI-Disks Hannes Duerr
2024-01-05 16:00   ` Fiona Ebner [this message]
2024-01-05 16:00 ` [pve-devel] partially-applied: [PATCH v6 qemu-server 0/4] " Fiona Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a250b1f1-98e2-4f08-8efc-f350284d5bca@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=h.duerr@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal