From 726c05134ce2011038dde9436d82b9b122e76c3f Mon Sep 17 00:00:00 2001 From: sjing Date: Tue, 4 Jun 2013 08:20:52 +0000 Subject: [PATCH] support adding/removing nichostnames as well as the given noderange git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16531 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/ddns.pm | 6 +++++- xCAT-server/lib/xcat/plugins/hosts.pm | 17 +++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 9ff2a3779..d7232fe2c 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -302,7 +302,11 @@ sub process_request { my $domain; if ($request->{node}) { #leverage makehosts code to flesh out the options require xCAT_plugin::hosts; - xCAT_plugin::hosts::add_hosts_content(nodelist=>$request->{node},callback=>$callback,hostsref=>\@contents); + my @content1; + my @content2; + xCAT_plugin::hosts::add_hosts_content(nodelist=>$request->{node},callback=>$callback,hostsref=>\@content1); + xCAT_plugin::hosts::donics(nodes=>$request->{node},callback=>$callback,hostsref=>\@content2); + @contents = (@content1, @content2); } else { #legacy behavior, read from /etc/hosts my $hostsfile; diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index 88a830b07..c5d34d775 100644 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -414,7 +414,7 @@ sub process_request } # end else # do the other node nics - if any - &donics($req->{node}, $callback, $DELNODE); + &donics(nodes=>$req->{node}, callback=>$callback, delnode=>$DELNODE); } else { @@ -452,7 +452,7 @@ sub process_request } # also do nics table - &donics(\@allnodes, $callback, $DELNODE); + &donics(nodes=>\@allnodes, callback=>$callback, delnode=>$DELNODE); } writeout(); @@ -490,7 +490,7 @@ sub writeout Globals: Example: - my $rc = &donics(\@nodes, $callback, $DELNODE); + my $rc = &donics(nodes=>\@allnodes, callback=>$callback, delnode=>$DELNODE); Comments: none @@ -499,9 +499,10 @@ sub writeout #------------------------------------------------------------------------------- sub donics { - my $nodes = shift; - my $callback = shift; - my $delnode = shift; + my %args = @_; + my $nodes = $args{nodes}; + my $callback = $args{callback}; + my $delnode = $args{delnode}; my @nodelist = @{$nodes}; @@ -718,6 +719,10 @@ sub donics } # end for each nic } # end for each node + if ($args{hostsref}) { + @{$args{hostsref}} = @hosts; + } + $nettab->close; $nicstab->close;