From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 5D2AFBABB0 for ; Thu, 21 Mar 2024 10:08:05 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 47A031AECF for ; Thu, 21 Mar 2024 10:08:05 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 21 Mar 2024 10:08:01 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 1FDC640B81 for ; Thu, 21 Mar 2024 10:08:01 +0100 (CET) From: Gabriel Goller To: pve-devel@lists.proxmox.com Date: Thu, 21 Mar 2024 10:07:52 +0100 Message-ID: <20240321090753.9056-1-g.goller@proxmox.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.089 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH storage v2] esxi: detect correct os type in 'other' family X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2024 09:08:05 -0000 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 --- 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