added ipforward in servicenode table

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6160 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
linggao 2010-05-18 20:38:50 +00:00
parent 3415fbd8f9
commit 37189c8616
3 changed files with 47 additions and 2 deletions

View File

@ -624,7 +624,7 @@ ppchcp => {
},
},
servicenode => {
cols => [qw(node nameserver dhcpserver tftpserver nfsserver conserver monserver ldapserver ntpserver ftpserver nimserver comments disable)],
cols => [qw(node nameserver dhcpserver tftpserver nfsserver conserver monserver ldapserver ntpserver ftpserver nimserver ipforward comments disable)],
keys => [qw(node)],
table_desc => 'List of all Service Nodes and services that will be set up on the Service Node.',
descriptions => {
@ -639,6 +639,7 @@ servicenode => {
ntpserver => 'Not used presently. Do we set up a ntp server on this service node? Valid values:yes or 1, no or 0.',
ftpserver => 'Do we set up a ftp server on this service node? Valid values:yes or 1, no or 0.',
nimserver => 'Do we set up a NIM server on this service node? Valid values:yes or 1, no or 0.',
ipforward => 'Do we set up ip forwarding on this service node? Valid values:yes or 1, no or 0.',
comments => 'Any user-written notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
@ -1015,6 +1016,7 @@ my @nodeattrs = (
tabentry => 'noderes.nimserver',
access_tabentry => 'noderes.node=attr:node',
},
###
# TODO: Is noderes.nfsdir used anywhere? Could not find any code references
# to this attribute.
@ -1083,6 +1085,10 @@ my @nodeattrs = (
{attr_name => 'setupconserver',
tabentry => 'servicenode.conserver',
access_tabentry => 'servicenode.node=attr:node',
},
{attr_name => 'setupipforward',
tabentry => 'servicenode.ipforward',
access_tabentry => 'servicenode.node=attr:node',
},
# - moserver not used yet
# {attr_name => 'setupmonserver',

View File

@ -2965,7 +2965,7 @@ sub isServiceReq
my @services = (
"nameserver", "dhcpserver", "tftpserver", "nfsserver",
"conserver", "monserver", "ldapserver", "ntpserver",
"ftpserver"
"ftpserver", "ipforward"
);
my @ips = @$serviceip; # list of service node ip addresses and names

View File

@ -252,6 +252,16 @@ sub init_plugin
"AAsn.pm:Error reading the servicenode table.");
}
my $service = "ipforward";
if (grep(/$service/, @servicelist))
{
$rc = &setup_ip_forwarding($nodename, $doreq); # setup ip forwarding
if ($rc == 0)
{
xCAT::Utils->update_xCATSN($service);
}
}
}
else # management node
{
@ -1234,4 +1244,33 @@ sub setup_HTTP
return $rc;
}
#-----------------------------------------------------------------------------
=head3 setup_ip_forwarding
Sets up ip forwarding on the sn
=cut
#-----------------------------------------------------------------------------
sub setup_ip_forwarding
{
if (xCAT::Utils->isLinux()) {
my $conf_file="/etc/sysctl.conf";
my $rc=`grep "net.ipv4.ip_forward" $conf_file`;
if ($? == 0) {
`sed -i "s/^net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/" $conf_file`;
} else {
`echo "net.ipv4.ip_forward = 1" >> $conf_file`;
}
$rc = `sysctl -p $conf_file`;
}
else
{ #AIX: TODO
}
return $rc;
}
1;