Update rspconfig man page, to add network function for FSP/BPA
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3943 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
56a3c382e7
commit
7844d8cf91
@ -4996,4 +4996,82 @@ sub get_unique_members
|
||||
}
|
||||
return keys %tmp_hash;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 updateEtcHosts
|
||||
Description:
|
||||
Add nodes and their IP addresses into /etc/hosts.
|
||||
Arguments:
|
||||
$host_ip: the hostname-IP pairs to be updated in /etc/hosts
|
||||
Returns:
|
||||
1: Succesfully. 0: Failed.
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
xCAT::Utils::updateEtcHosts(\%node_to_be_updated)
|
||||
|
||||
Comments:
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Update /etc/hosts
|
||||
##########################################################################
|
||||
sub updateEtcHosts
|
||||
{
|
||||
my $host_ip = shift;
|
||||
my $fname = "/etc/hosts";
|
||||
unless ( open( HOSTS,"<$fname" )) {
|
||||
return undef;
|
||||
}
|
||||
my @rawdata = <HOSTS>;
|
||||
my @newdata = ();
|
||||
close( HOSTS );
|
||||
chomp @rawdata;
|
||||
|
||||
######################################
|
||||
# Remove old entry
|
||||
######################################
|
||||
foreach my $host ( keys %$host_ip) {
|
||||
my $ip = $host_ip->{ $host};
|
||||
my $updated = 0;
|
||||
foreach my $line ( @rawdata ) {
|
||||
if ( $line =~ /^#/ or $line =~ /^\s*$/ ) {
|
||||
next;
|
||||
}
|
||||
if ( $line =~ /^\s*\Q$ip\E\s+/ )
|
||||
{
|
||||
if ( $line =~ /\s+\Q$host\E\s+/ or
|
||||
$line =~ /\s+\Q$host\E$/)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
$line .= "\t$host";
|
||||
}
|
||||
$updated = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ( !$updated)
|
||||
{
|
||||
push @rawdata, "$ip\t$host";
|
||||
}
|
||||
}
|
||||
######################################
|
||||
# Rewrite file
|
||||
######################################
|
||||
unless ( open( HOSTS,">$fname" )) {
|
||||
return undef;
|
||||
}
|
||||
for my $line (@rawdata)
|
||||
{
|
||||
print HOSTS "$line\n";
|
||||
}
|
||||
close( HOSTS );
|
||||
return 1;
|
||||
}
|
||||
1;
|
||||
|
@ -44,7 +44,7 @@ B<rspconfig> I<noderange> B<ntp>={[B<ntpenable>],[B<ntpserver>],[B<frequency>],[
|
||||
|
||||
=head2 FSP specific:
|
||||
|
||||
B<rspconfig> I<noderange> {B<autopower>|B<iocap>|B<decfg>|B<memdecfg>|B<procdecfg>|B<time>|B<date>|B<spdump>|B<sysdump>}
|
||||
B<rspconfig> I<noderange> {B<autopower>|B<iocap>|B<decfg>|B<memdecfg>|B<procdecfg>|B<time>|B<date>|B<spdump>|B<sysdump>|B<network>}
|
||||
|
||||
B<rspconfig> I<noderange> B<autopower>={B<enable>|B<disable>}
|
||||
|
||||
@ -60,6 +60,22 @@ B<rspconfig> I<noderange> B<procdecfg>={B<configure|deconfigure>:B<processinguni
|
||||
|
||||
B<rspconfig> I<noderange> B<memdecfg>={B<configure|deconfigure>:B<processingunit>:B<unit|bank>:B<id,...>>}
|
||||
|
||||
B<rspconfig> I<noderange> B<network>={B<nic,*>}
|
||||
|
||||
B<rspconfig> I<noderange> B<network>={B<nic,[IP,][hostname,][gateway,][netmask]>}
|
||||
|
||||
B<rspconfig> I<noderange> B<network>={B<nic,0.0.0.0>}
|
||||
|
||||
=head2 BPA Specific:
|
||||
|
||||
B<rspconfig> I<noderange> {B<network>}
|
||||
|
||||
B<rspconfig> I<noderange> B<network>={B<nic,*>}
|
||||
|
||||
B<rspconfig> I<noderange> B<network>={B<nic,[IP,][hostname,][gateway,][netmask]>}
|
||||
|
||||
B<rspconfig> I<noderange> B<network>={B<nic,0.0.0.0>}
|
||||
|
||||
=head2 HMC Specific:
|
||||
|
||||
B<rspconfig> I<noderange> {B<sshcfg>}
|
||||
@ -129,7 +145,12 @@ The subnet mask.
|
||||
|
||||
=item B<network>={[I<ip>],[I<host>],[I<gateway>],[I<netmask>]|*}
|
||||
|
||||
Get or set the MPA network parameters. If '*' is specified, all parameters are read from the xCAT database.
|
||||
For MPA only. Get or set the MPA network parameters. If '*' is specified, all parameters are read from the xCAT database.
|
||||
|
||||
=item B<network>={I<nic>,{[I<ip>],[I<host>],[I<gateway>],[I<netmask>]}|*}
|
||||
|
||||
For FSP/BPA only. Get or set the FSP/BPA network parameters. If '*' is specified, all parameters are read from the xCAT database.
|
||||
If the value of I<ip> is '0.0.0.0', this I<nic> will be configured as a DHCP client. Otherwise this I<nic> will be configured with a static IP.
|
||||
|
||||
=item B<nonred>
|
||||
|
||||
@ -266,6 +287,51 @@ B<rspconfig> I<mm01 network=,,192.168.1.1,>
|
||||
|
||||
=item *
|
||||
|
||||
To display the FSP network parameters for fsp01:
|
||||
|
||||
B<rspconfig> I<fsp01 network>
|
||||
|
||||
fsp01:
|
||||
eth0:
|
||||
IP Type: Dynamic
|
||||
IP Address: 192.168.1.215
|
||||
Hostname:
|
||||
Gateway:
|
||||
Netmask: 255.255.255.0
|
||||
|
||||
eth1:
|
||||
IP Type: Dynamic
|
||||
IP Address: 192.168.200.51
|
||||
Hostname: fsp01
|
||||
Gateway:
|
||||
Netmask: 255.255.255.0
|
||||
|
||||
=item *
|
||||
|
||||
To change the FSP network parameters with the values in command line for eth0 on fsp01:
|
||||
|
||||
B<rspconfig> I<fsp01 network=eth0,192.168.1.200,fsp01,,255.255.255.0>
|
||||
|
||||
fsp01: Success to set IP address,hostname,netmask
|
||||
|
||||
=item *
|
||||
|
||||
To change the FSP network parameters with the values in the xCAT database for eth0 on fsp01:
|
||||
|
||||
B<rspconfig> I<fsp01 network=eth0,*>
|
||||
|
||||
fsp01: Success to set IP address,hostname,gateway,netmask
|
||||
|
||||
=item *
|
||||
|
||||
To configure eth0 on fsp01 to get dynamic IP address from DHCP server:
|
||||
|
||||
B<rspconfig> I<fsp01 network=eth0,0.0.0.0>
|
||||
|
||||
fsp01: Success to set IP type to dynamic.
|
||||
|
||||
=item *
|
||||
|
||||
To get the current power redundancy mode for power domain 1 on mm01:
|
||||
|
||||
B<rspconfig> I<mm01 pd1>
|
||||
|
@ -1492,45 +1492,6 @@ sub parse_responses {
|
||||
return( \%outhash );
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Update /etc/hosts
|
||||
##########################################################################
|
||||
sub updateEtcHosts
|
||||
{
|
||||
my $host_ip = shift;
|
||||
my $fname = "/etc/hosts";
|
||||
unless ( open( HOSTS,"<$fname" )) {
|
||||
return undef;
|
||||
}
|
||||
my @rawdata = <HOSTS>;
|
||||
close( HOSTS );
|
||||
|
||||
######################################
|
||||
# Remove old entry
|
||||
######################################
|
||||
foreach my $host ( keys %$host_ip) {
|
||||
my $ip = $host_ip->{ $host};
|
||||
foreach ( @rawdata ) {
|
||||
if ( /^#/ or /^\s*\n$/ ) {
|
||||
next;
|
||||
} elsif ( /\s+$host\s+$/ ) {
|
||||
s/$_//;
|
||||
}
|
||||
}
|
||||
push @rawdata,"$ip\t$host\n";
|
||||
}
|
||||
######################################
|
||||
# Rewrite file
|
||||
######################################
|
||||
unless ( open( HOSTS,">$fname" )) {
|
||||
return undef;
|
||||
}
|
||||
print HOSTS @rawdata;
|
||||
close( HOSTS );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
##########################################################################
|
||||
# Write result to xCat database
|
||||
##########################################################################
|
||||
@ -1656,7 +1617,7 @@ sub xCATdB {
|
||||
xCAT::PPCdb::add_systemX( $type, $data );
|
||||
}
|
||||
}
|
||||
updateEtcHosts(\%host_ip);
|
||||
xCAT::Utils::updateEtcHosts(\%host_ip);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user