From 0eb9db534b5cc61cf7193dcdf8f67b4a695f46ae Mon Sep 17 00:00:00 2001 From: creativezj Date: Tue, 4 Jun 2013 05:46:55 +0000 Subject: [PATCH] fix multiple nics problem git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@16524 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/pods/man1/nodeimport.1.pod | 4 --- xCAT-server/lib/xcat/plugins/profilednodes.pm | 28 +++++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/xCAT-client/pods/man1/nodeimport.1.pod b/xCAT-client/pods/man1/nodeimport.1.pod index 269544946..01f2ddf2d 100644 --- a/xCAT-client/pods/man1/nodeimport.1.pod +++ b/xCAT-client/pods/man1/nodeimport.1.pod @@ -157,10 +157,6 @@ B> This is an optional item. Description: node location info. Specify the rack name which this node will be placed into. If not specify this item, there will be no node location info set for this node. this item must be specified together with height + unit. -B> This is an optional item. - -Description: node location info. Specify the rack name which this node will be placed into. If not specify this item, there will be no node location info set for this node. this item must be specified together with height + unit. - B> This is an optional item. Description: node location info, for blade(or PureFlex) only. Specify the chasiss name which this blade will be placed into. this item can not be specified together with rack. diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index f3d7b8d71..b78acf717 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -1597,13 +1597,7 @@ sub gen_new_hostinfo_string{ foreach (keys %netprofileattr){ # Not generate IP if exists other nics if (exists $allothernics{$item}->{$_}) { - my $avaiableip = $allothernics{$item}->{$_}; - if (exists $allips{$avaiableip}){ - return 0, "The specified nicips IP address $avaiableip is already in use."; - }else{ - $ipshash{$_} = $avaiableip; - $allips{$avaiableip} = 0; - } + $ipshash{$_} = $allothernics{$item}->{$_}; } } @@ -2039,7 +2033,25 @@ sub validate_node_entry{ $errmsg .= "Specified slotid $node_entry{$_} is invalid"; } }elsif ($_ eq "nicips"){ - # Support Multi-Nic + # Check Multi-Nic's ip + my $othernics = $node_entry{$_}; + foreach my $nic_ips (split(/,/, $othernics)) { + my @nic_and_ips = (); + my $nic = ""; + my $nic_ip = ""; + if($nic_ips =~ /!/ and $nic_ips !~ /!$/) { + @nic_and_ips = split(/!/, $nic_ips); + $nic_ip = $nic_and_ips[1]; + if (exists $allips{$node_entry{$_}}){ + $errmsg .= "IP address $nic_ip already exists in the database or in the nodeinfo file.\n"; + }elsif((xCAT::NetworkUtils->validate_ip($nic_ip))[0]->[0] ){ + $errmsg .= "IP address $nic_ip is invalid. You must use a valid IP address.\n"; + }else { + #push the IP into allips list. + $allips{$nic_ip} = 0; + } + } + } }else{ $errmsg .= "Invalid attribute $_ specified\n"; }