public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Hannes Duerr <h.duerr@proxmox.com>
Subject: Re: [pve-devel] [PATCH v5 qemu-server 4/4] fix #4957: add vendor and product information passthrough for SCSI-Disks
Date: Fri, 17 Nov 2023 13:29:12 +0100	[thread overview]
Message-ID: <08b6a273-5b47-4855-8249-d2eb558f610f@proxmox.com> (raw)
In-Reply-To: <20231117121726.119792-5-h.duerr@proxmox.com>

no in-depth review, but a meta style issue and some nits in line, the former
could be fixed up on applying, the nits are not really important in general.

Am 17/11/2023 um 13:17 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
> 

please keep commit messages below 70 characters per line, where
possible:
https://pve.proxmox.com/wiki/Developer_Documentation#Commits_and_Commit_Messages

> @@ -1011,6 +1038,13 @@ __PACKAGE__->register_method({
>  		my $conf = $param;
>  		my $arch = PVE::QemuServer::get_vm_arch($conf);
>  
> +		for my $opt (sort keys $param->%*) {
> +		    if ($opt =~ m/^scsi(\d)+$/) {

nit: unnecessary capture group, not costly here but we normally try to
either avoid them or mark them as non-capturing (tiny performance benefit),
i.e., one of:

$opt =~ m/^scsi\d+$/
$opt =~ m/^scsi(?:\d)+$/


and fwiw, this could be made shorter by either

- reversing the match and skip to next loop iteration early:
  next if $opt !~ m/^scsi(\d)+$/;

- use grep 

for $scsi_disk (grep { /^scsi\d+$/ } keys $param->%*) {
    # ...
}


> +			assert_scsi_feature_compatibility(
> +			    $opt, $conf, $storecfg, $param->{$opt});
> +		    }
> +		}
> +
>  		$conf->{meta} = PVE::QemuServer::new_meta_info_string();
>  
>  		my $vollist = [];
> @@ -1826,6 +1860,11 @@ my $update_vm_api  = sub {
>  		    PVE::QemuServer::vmconfig_register_unused_drive($storecfg, $vmid, $conf, PVE::QemuServer::parse_drive($opt, $conf->{pending}->{$opt}))
>  			if defined($conf->{pending}->{$opt});
>  
> +		    if ($opt =~ m/^scsi(\d)+$/) {

same as above w.r.t. caputre group

> +			assert_scsi_feature_compatibility(
> +			    $opt, $conf, $storecfg, $param->{$opt});
> +		    }
> +
>  		    my (undef, $created_opts) = $create_disks->(
>  			$rpcenv,
>  			$authuser,





  reply	other threads:[~2023-11-17 12:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 12:17 [pve-devel] [PATCH v5 qemu-server 0/4] " Hannes Duerr
2023-11-17 12:17 ` [pve-devel] [PATCH v5 qemu-server 1/4] Move path_is_scsi to QemuServer/Drive.pm Hannes Duerr
2023-11-20 15:56   ` Fiona Ebner
2023-11-17 12:17 ` [pve-devel] [PATCH v5 qemu-server 2/4] Move NEW_DISK_RE " Hannes Duerr
2023-11-17 12:17 ` [pve-devel] [PATCH v5 qemu-server 3/4] drive: Create get_scsi_devicetype Hannes Duerr
2023-11-20 15:56   ` Fiona Ebner
2023-11-17 12:17 ` [pve-devel] [PATCH v5 qemu-server 4/4] fix #4957: add vendor and product information passthrough for SCSI-Disks Hannes Duerr
2023-11-17 12:29   ` Thomas Lamprecht [this message]
2023-11-20 16:33   ` 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=08b6a273-5b47-4855-8249-d2eb558f610f@proxmox.com \
    --to=t.lamprecht@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal