Add duplicated IP address in hosts table check in makedhcp -a. This could prevent duplicated entries in dhcp configuration file or lease file

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5755 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
wanghuaz 2010-04-13 11:58:33 +00:00
parent 3cc79aa71e
commit 9cdf977a6e

View File

@ -707,6 +707,19 @@ sub process_request
if ($req->{node})
{
my $ip_hash;
foreach my $node ( @{$req->{node}} ) {
my $hoststab = xCAT::Table->new('hosts');
my $ent = $hoststab->getNodeAttribs( $node, ['ip'] );
if ( $ent->{ip} ) {
if ( $ip_hash->{ $ent->{ip} } ) {
$callback->({error=>["Duplicated IP addresses in hosts table for following nodes: $node," . $ip_hash->{ $ent->{ip} }],errorcode=>[1]});
return;
}
$ip_hash->{ $ent->{ip} } = $node;
}
}
@ARGV = @{$req->{arg}};
$statements = "";
GetOptions('s|statements=s' => \$statements);