Skip to content

Commit

Permalink
no IP when more than 1 vmnic
Browse files Browse the repository at this point in the history
I found there is no IP address when run fusioninventory-esx
against ESX server with several vnic adapters. After little
investigation I found in file FusionInventory/VMware/SOAP/Host.pm,
function getNetworks not filling values if there is an array of nics
instead of hash!

http://forum.fusioninventory.org/viewtopic.php?pid=5263
  • Loading branch information
sstefanov authored and Gonéri Le Bouder committed Nov 4, 2011
1 parent e16fe50 commit 6ffc1ab
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion lib/FusionInventory/VMware/SOAP/Host.pm
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,22 @@ sub getNetworks {
foreach (@vnic) {
next if ref($_) ne 'HASH';

push @$ret, {
if ( ref($_) eq 'ARRAY') {
foreach ( @$_ ) {
push @$ret, {
DESCRIPTION => $_->{device},
IPADDRESS => $_->{spec}{ip}{ipAddress},
IPMASK => $_->{spec}{ip}{subnetMask},
MACADDR => $_->{spec}{mac},
MTU => $_->{spec}{ip}{mtu},
STATUS => $_->{spec}{ip}{ipAddress}?'Up':'Down',
VIRTUALDEV => '1',
};
}
}
else {

push @$ret, {
DESCRIPTION => $_->{device},
IPADDRESS => $_->{spec}{ip}{ipAddress},
IPMASK => $_->{spec}{ip}{subnetMask},
Expand All @@ -216,6 +231,9 @@ sub getNetworks {
STATUS => $_->{spec}{ip}{ipAddress}?'Up':'Down',
VIRTUALDEV => '1',
};

}

}

return $ret;
Expand Down

0 comments on commit 6ffc1ab

Please sign in to comment.