From: Hannes Duerr <h.duerr@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server] fix #4957: add vendor and product information passthrough for SCSI-Disks
Date: Wed, 25 Oct 2023 14:37:19 +0200 [thread overview]
Message-ID: <20231025123719.38036-1-h.duerr@proxmox.com> (raw)
Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
---
PVE/QemuServer.pm | 12 ++++++++++++
PVE/QemuServer/Drive.pm | 26 ++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 2cd8948..69be3af 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1482,6 +1482,18 @@ sub print_drivedevice_full {
}
$device .= ",wwn=$drive->{wwn}" if $drive->{wwn};
+ # only scsi-hd supports passing vendor and product information
+ if ($devicetype eq 'hd') {
+ if (my $vendor = $drive->{vendor}) {
+ $vendor = URI::Escape::uri_unescape($vendor);
+ $device .= ",vendor=$vendor";
+ }
+ if (my $product = $drive->{product}) {
+ $product = URI::Escape::uri_unescape($product);
+ $device .= ",product=$product";
+ }
+ }
+
} elsif ($drive->{interface} eq 'ide' || $drive->{interface} eq 'sata') {
my $maxdev = ($drive->{interface} eq 'sata') ? $PVE::QemuServer::Drive::MAX_SATA_DISKS : 2;
my $controller = int($drive->{index} / $maxdev);
diff --git a/PVE/QemuServer/Drive.pm b/PVE/QemuServer/Drive.pm
index e24ba12..20efc2f 100644
--- a/PVE/QemuServer/Drive.pm
+++ b/PVE/QemuServer/Drive.pm
@@ -159,6 +159,28 @@ my %iothread_fmt = ( iothread => {
optional => 1,
});
+my %product_fmt = (
+ product => {
+ type => 'string',
+ format => 'urlencoded',
+ format_description => 'product',
+ maxLength => 40*3, # *3 since it's %xx url enoded
+ description => "The drive's product name, url-encoded, up to 40 bytes long.",
+ optional => 1,
+ },
+);
+
+my %vendor_fmt = (
+ vendor => {
+ type => 'string',
+ format => 'urlencoded',
+ format_description => 'vendor',
+ maxLength => 40*3, # *3 since it's %xx url enoded
+ description => "The drive's vendor name, url-encoded, up to 40 bytes long.",
+ optional => 1,
+ },
+);
+
my %model_fmt = (
model => {
type => 'string',
@@ -281,6 +303,8 @@ my $scsi_fmt = {
%scsiblock_fmt,
%ssd_fmt,
%wwn_fmt,
+ %vendor_fmt,
+ %product_fmt,
};
my $scsidesc = {
optional => 1,
@@ -404,6 +428,8 @@ my $alldrive_fmt = {
%readonly_fmt,
%scsiblock_fmt,
%ssd_fmt,
+ %vendor_fmt,
+ %product_fmt,
%wwn_fmt,
%tpmversion_fmt,
%efitype_fmt,
--
2.39.2
next reply other threads:[~2023-10-25 12:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 12:37 Hannes Duerr [this message]
2023-10-30 16:30 ` Thomas Lamprecht
2023-10-31 11:04 ` Wolfgang Bumiller
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=20231025123719.38036-1-h.duerr@proxmox.com \
--to=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