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 v3 qemu-server 1/2] Create get_scsi_devicetype and move it and its dependencies to QemuServer/Drive.pm
Date: Thu, 16 Nov 2023 11:15:03 +0100 [thread overview]
Message-ID: <4ca79a2c-0e0f-4a70-9f76-e3cc0f3757ea@proxmox.com> (raw)
In-Reply-To: <20231110093358.62006-2-h.duerr@proxmox.com>
Nit: Like can be seen from the "and" in the commit title, it's actually
two changes. Moving the dependencies first, and then introducing the new
helper in a second patch would be even better. But no big deal :)
Am 10.11.23 um 10:33 schrieb Hannes Duerr:
> +sub get_scsi_devicetype {
> + my ($drive, $storecfg, $machine_version) = @_;
> +
> + my $devicetype = 'hd';
> + my $path = '';
> + if (drive_is_cdrom($drive)) {
> + $devicetype = 'cd';
> + } else {
> + if ($drive->{file} =~ m|^/|) {
> + $path = $drive->{file};
> + if (my $info = path_is_scsi($path)) {
> + if ($info->{type} == 0 && $drive->{scsiblock}) {
> + $devicetype = 'block';
> + } elsif ($info->{type} == 1) { # tape
> + $devicetype = 'generic';
> + }
> + }
> + } elsif ($drive->{file} =~ m/local-lvm:/){
> + # special syntax cannot be parsed to path
> + $path = "local-lvm";
What if the storage is called differently ;)
Note, there also is a NEW_DISK_RE in API2/Qemu.pm you can use to compare
(needs to be moved to the Drive.pm module first - make it
our $NEW_DISK_RE = ...;
to be able to reference it from API2/Qemu.pm afterwards)
Why set the path to some fake value and not just return the device type
early?
next prev parent reply other threads:[~2023-11-16 10:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-10 9:33 [pve-devel] [PATCH v3 qemu-server 0/2] fix #4957: add vendor and product information passthrough for SCSI-Disks Hannes Duerr
2023-11-10 9:33 ` [pve-devel] [PATCH v3 qemu-server 1/2] Create get_scsi_devicetype and move it and its dependencies to QemuServer/Drive.pm Hannes Duerr
2023-11-16 10:15 ` Fiona Ebner [this message]
2023-11-10 9:33 ` [pve-devel] [PATCH v3 qemu-server 2/2] fix #4957: add vendor and product information passthrough for SCSI-Disks Hannes Duerr
2023-11-16 10:37 ` 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=4ca79a2c-0e0f-4a70-9f76-e3cc0f3757ea@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox