fix multiple nic error while all nics in same network
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15752 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
41c00b59e2
commit
5ea143c734
@ -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}){
|
||||
|
Loading…
Reference in New Issue
Block a user