Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
VMWare vCenter network adapter name detection fix
sub GetInterfaceByMacAddress
{
# This function is same as GetInterfaceByMacAddress but uses
# '/sbin/ip addr show' instead of/sbin/ifconfig
my ($self, $macAddress, $ipAddrResult) = @_;
my $result = undef;
if (! defined $ipAddrResult) {
my $ipPath = Utils::GetIpPath();
if ( defined $ipPath){
$ipAddrResult = Utils::ExecuteCommand("$ipPath addr show");
} else {
WARN("Path to 'ip addr' not found.");
}
}
my $macAddressValid = ($macAddress =~ /^([0-9a-f]{2}:){5}[0-9a-f]{2}$/i);
if ($macAddressValid && ($ipAddrResult =~
/^\d+:\s([^\s.:]+):\s[^\n]+[^\n]+\s+link\/\w+\s+$macAddress/mi)) {
$result = $1;
}
return $result;
}
@styblope
Copy link
Author

styblope commented Oct 4, 2018

Replace the function in /usr/lib/vmware-vpx/imgcust/linux/imgcust-scripts/Customization.pm or in C:\Program Files\VMware\vCenter Server\vpxd\imgcust\linux\imgcust-scripts\Customization.pm

Based on vmware/open-vm-tools#130 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment