public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage v2] esxi: detect correct os type in 'other' family
Date: Thu, 21 Mar 2024 10:07:52 +0100	[thread overview]
Message-ID: <20240321090753.9056-1-g.goller@proxmox.com> (raw)

This patch introduces the conversion table for all possible OS Types
that are in the VMWare 'other' family and sets the pve counterpart.
Our default OS Type is 'linux', so including mappings to 'other' makes
sense.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---

v2, thanks @sterzy:
 - removed perltidy output

 src/PVE/Storage/ESXiPlugin.pm | 43 +++++++++++++++++++++++++++++++----
 1 file changed, 39 insertions(+), 4 deletions(-)

diff --git a/src/PVE/Storage/ESXiPlugin.pm b/src/PVE/Storage/ESXiPlugin.pm
index b36cea8..6e80caa 100644
--- a/src/PVE/Storage/ESXiPlugin.pm
+++ b/src/PVE/Storage/ESXiPlugin.pm
@@ -849,7 +849,7 @@ sub is_windows {
     return;
 }
 
-my %guest_types = (
+my %guest_types_windows = (
     dos                     => 'other',
     winNetBusiness          => 'w2k3',
     windows9                => 'win10',
@@ -888,14 +888,49 @@ my %guest_types = (
     'winXPPro-64'           => 'wxp',
 );
 
+my %guest_types_other = (
+    'freeBSD11'    => 'other',
+    'freeBSD11-64' => 'other',
+    'freeBSD12'    => 'other',
+    'freeBSD12-64' => 'other',
+    'freeBSD13'    => 'other',
+    'freeBSD13-64' => 'other',
+    'freeBSD14'    => 'other',
+    'freeBSD14-64' => 'other',
+    'freeBSD'      => 'other',
+    'freeBSD-64'   => 'other',
+    'os2'          => 'other',
+    'netware5'     => 'other',
+    'netware6'     => 'other',
+    'solaris10'    => 'solaris',
+    'solaris10-64' => 'solaris',
+    'solaris11-64' => 'solaris',
+    'other'        => 'other',
+    'other-64'     => 'other',
+    'openserver5'  => 'other',
+    'openserver6'  => 'other',
+    'unixware7'    => 'other',
+    'eComStation'  => 'other',
+    'eComStation2' => 'other',
+    'solaris8'     => 'solaris',
+    'solaris9'     => 'solaris',
+    'vmkernel'     => 'other',
+    'vmkernel5'    => 'other',
+    'vmkernel6'    => 'other',
+    'vmkernel65'   => 'other',
+    'vmkernel7'    => 'other',
+    'vmkernel8'    => 'other',
+);
+
 # Best effort translation from vmware guest os type to pve.
 # Returns a tuple: `(pve-type, is_windows)`
 sub guest_type {
     my ($self) = @_;
-
     if (defined(my $guest = $self->{guestOS})) {
-	if (defined(my $known = $guest_types{$guest})) {
-	    return ($known, 1);
+	if (defined(my $known_windows = $guest_types_windows{$guest})) {
+	    return ($known_windows, 1);
+	} elsif (defined(my $known_other = $guest_types_other{$guest})) {
+	    return ($known_other, 0);
 	}
 	# This covers all the 'Mac OS' types AFAICT
 	return ('other', 0) if $guest =~ /^darwin/;
-- 
2.43.0





             reply	other threads:[~2024-03-21  9:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-21  9:07 Gabriel Goller [this message]
2024-03-22 10:30 ` [pve-devel] applied: " Thomas Lamprecht

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=20240321090753.9056-1-g.goller@proxmox.com \
    --to=g.goller@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