fix multiple nic error while all nics in same network

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15751 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
creativezj 2013-04-01 07:16:59 +00:00
parent a9e5f73abd
commit ff67a1d864

View File

@ -1494,15 +1494,9 @@ sub gen_new_hostinfo_string{
# compose the stanza string for hostinfo file.
my $hostsinfostr = "";
foreach my $item (keys %hostinfo_dict){
# Generate IPs for all interfaces.
# Generate IPs for other interfaces defined in MAC file.
my %ipshash;
foreach (keys %netprofileattr){
my $netname = $netprofileattr{$_}{'network'};
my $freeipsref;
if ($netname){
$freeipsref = $freeipshash{$netname};
}
foreach (keys %netprofileattr){
# Not generate IP if exists other nics
if (exists $allothernics{$item}->{$_}) {
my $avaiableip = $allothernics{$item}->{$_};
@ -1511,10 +1505,21 @@ sub gen_new_hostinfo_string{
}else{
$ipshash{$_} = $avaiableip;
$allips{$avaiableip} = 0;
next;
}
}
}
# Generate IPs for not defined interfaces.
foreach (keys %netprofileattr){
my $netname = $netprofileattr{$_}{'network'};
my $freeipsref;
if ($netname){
$freeipsref = $freeipshash{$netname};
}
if (exists $allothernics{$item}->{$_}) {
next;
}
# If generated IP is already used, re-generate free ip
my $nextip = shift @$freeipsref;
while (exists $allips{$nextip}){