fix bug 3745: makehosts -d to delete otherinterfaces hosts

This commit is contained in:
ligc 2013-09-18 07:54:40 +08:00
parent 29d9d824fe
commit 982f411251

30
xCAT-server/lib/xcat/plugins/hosts.pm Normal file → Executable file
View File

@ -203,6 +203,32 @@ sub addotherinterfaces
}
}
sub delotherinterfaces
{
my $node = shift;
my $otherinterfaces = shift;
my $domain = shift;
my @itf_pairs = split(/,/, $otherinterfaces);
foreach (@itf_pairs)
{
my ($itf, $ip);
if ($_ =~ /!/) {
($itf, $ip) = split(/!/, $_);
} else {
($itf, $ip) = split(/:/, $_);
}
if ($ip && xCAT::NetworkUtils->isIpaddr($ip))
{
if ($itf =~ /^-/)
{
$itf = $node . $itf;
}
delnode $itf, $ip, '', $domain;
}
}
}
sub add_hosts_content {
my %args = @_;
my $nodelist = $args{nodelist};
@ -245,6 +271,10 @@ sub add_hosts_content {
if ($DELNODE)
{
delnode $nodename, $ip, $ref->{hostnames}, $domain;
if (defined($ref->{otherinterfaces}))
{
delotherinterfaces $nodename, $ref->{otherinterfaces}, $domain;
}
}
else
{