Skip to content

Commit

Permalink
2.2.x getCanonicalManufacturer() support
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonéri Le Bouder committed Oct 15, 2011
1 parent 10973b4 commit 483a50f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
18 changes: 15 additions & 3 deletions lib/FusionInventory/VMware/SOAP/Host.pm
Expand Up @@ -229,7 +229,6 @@ sub getStorages {
my $serialnumber;
my $size;


# TODO
#$volumnMapping{$entry->{canonicalName}} = $entry->{deviceName};

Expand All @@ -245,12 +244,25 @@ sub getStorages {
if ($entry->{capacity}{blockSize} && $entry->{capacity}{block}) {
$size = int($entry->{capacity}{blockSize} *$entry->{capacity}{block})/1000;
}
my $manufacturer;
if ($entry->{vendor} && ($entry->{vendor} !~ /^\s*ATA\s*$/)) {
$manufacturer = $entry->{vendor};
} else {
$manufacturer = getCanonicalManufacturer($entry->{model});
}

$manufacturer =~ s/\s*(\S.*\S)\s*/$1/;

my $model = $entry->{model};
$model =~ s/\s*(\S.*\S)\s*/$1/;


push @$ret, {
DESCRIPTION => $entry->{displayName},
DISKSIZE => $size,
# INTERFACE
MANUFACTURER => getCanonicalManufacturer($entry->{model}) || $entry->{vendor},
MODEL => $entry->{model},
MANUFACTURER => $manufacturer,
MODEL => $model,
NAME => $entry->{deviceName},
TYPE => $entry->{deviceType},
SERIAL => $serialnumber,
Expand Down
6 changes: 3 additions & 3 deletions t/soap.t
Expand Up @@ -354,8 +354,8 @@ my %test = (
'DISKSIZE' => undef,
'SERIAL' => undef,
'DESCRIPTION' => 'Local TEAC CD-ROM (mpx.vmhba0:C0:T0:L0)',
'MANUFACTURER' => 'TEAC ',
'MODEL' => 'DV-28E-V '
'MANUFACTURER' => 'TEAC',
'MODEL' => 'DV-28E-V'
},
{
'NAME' => '/vmfs/devices/disks/t10.ATA_____ST3250310NS_________________________________________9SF1F0TH',
Expand All @@ -365,7 +365,7 @@ my %test = (
'SERIAL' => '3232323232323232323232325783704970488472',
'DESCRIPTION' => 'Local ATA Disk (t10.ATA_____ST3250310NS_________________________________________9SF1F0TH)',
'MANUFACTURER' => 'Seagate',
'MODEL' => 'ST3250310NS '
'MODEL' => 'ST3250310NS'
}

],
Expand Down

0 comments on commit 483a50f

Please sign in to comment.