From 263acbf5ce728b6b6bd738225843b65e72edb225 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 15 Nov 2016 16:43:09 -0500 Subject: [PATCH] Based on Er Tao's comments, before going into the code for determining the noboot nic names, parse out the interface names for the tagged vlans without the physical name in the string --- xCAT-server/lib/xcat/plugins/mknb.pm | 34 +++++++++++----------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index 16721de47..8508a598a 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -73,28 +73,20 @@ sub process_request { } } my $nicips = xCAT::NetworkUtils->get_nic_ip(); + foreach (keys $nicips) { + # To support tagged vlan, create entries in the hash for the + # interface name removing the physical interface ending: + # 'enP1p12s0f0.2@enP1p12s0f0' => 'enP1p12s0f0.2' + if ($_ =~ "@") { + my $newkey = $_; + $newkey =~ s/\@.*//g; + $$nicips{$newkey} = ${nicips}->{$_}; + } + } + foreach (keys %nobootnics) { - # looping on each nics that has 'noboot' configured - print "DEBUG ==> Interface $_ is set to 'noboot'\n"; - if (defined($nicips)) { - foreach my $nicipkey (keys $nicips) { - if ( $nicipkey =~ "@" ) { - # If VLAN tagging is in use on this management node, the interface name is taken - # from 'ip addr show' command and will contain the physical interface: - # enP1p12s0f0.2@enP1p12s0f0 - if ($nicipkey =~ m/$_\@/i ) { - print "DEBUG ---- FOUND ---- Interface name $_ is part of $nicipkey, IP=$nicips->{$nicipkey}!\n"; - if (defined($nicips->{$nicipkey})) { - $nobootnicips{$nicips->{$nicipkey}} = 1; - } - } - } else { - # Non VLAN case - if (defined($nicips->{$_})) { - $nobootnicips{$nicips->{$_}} = 1; - } - } - } + if (defined($nicips->{$_})) { + $nobootnicips{$nicips->{$_}} = 1; } } }