Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8
This commit is contained in:
commit
736bcf95bb
@ -3237,7 +3237,17 @@ sub bld_resolve_nodes_hash
|
||||
|
||||
# find out if we have an MN in the list, local cp and sh will be used
|
||||
# not remote shell
|
||||
my $mname = xCAT::Utils->noderangecontainsMn(@target_list);
|
||||
# find out the names for the Management Node
|
||||
my @MNnodeinfo = xCAT::NetworkUtils->determinehostname;
|
||||
my $mname = pop @MNnodeinfo; # hostname
|
||||
my $cmd="hostname";
|
||||
my $localhostname = xCAT::Utils->runcmd($cmd,0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{info}->[0] = "Command: $cmd failed. Continuing...";
|
||||
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
|
||||
}
|
||||
foreach my $target (@target_list)
|
||||
{
|
||||
|
||||
@ -3246,11 +3256,9 @@ sub bld_resolve_nodes_hash
|
||||
my $localhost;
|
||||
my $user;
|
||||
my $context = "XCAT";
|
||||
# check to see if this node is the Management Node
|
||||
if ($mname) {
|
||||
if ($mname eq $target) {
|
||||
# check to see if this node is the Management Node we are on, can run local commands (sh,cp)
|
||||
if (($mname eq $target) || ($localhostname eq $target)){
|
||||
$localhost=$target;
|
||||
}
|
||||
}
|
||||
my %properties = (
|
||||
'hostname' => $hostname,
|
||||
@ -4079,11 +4087,12 @@ sub parse_and_run_dsh
|
||||
# check if any node in the noderange is the Management Node and exit
|
||||
# with error, if the Management Node is in the Database and in the
|
||||
# noderange
|
||||
my $mname = xCAT::Utils->noderangecontainsMn(@nodelist);
|
||||
if ($mname) { # MN in the nodelist
|
||||
my @mname = xCAT::Utils->noderangecontainsMn(@nodelist);
|
||||
if (@mname) { # MN in the nodelist
|
||||
my $nodes=join(',', @mname);
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"You must not run -K option against the Management Node:$mname.";
|
||||
"You must not run -K option against the Management Node:$nodes.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return;
|
||||
}
|
||||
|
@ -242,12 +242,13 @@ sub getAllSN
|
||||
# if did not input "ALL" and there is a MN, remove it
|
||||
my @newservicenodes;
|
||||
if ((!defined($options)) || ($options ne "ALL")) {
|
||||
my $mname = xCAT::Utils->noderangecontainsMn(@servicenodes);
|
||||
if ($mname) { # if there is a MN
|
||||
foreach my $nodes (@servicenodes) {
|
||||
if ($mname ne ($nodes)){
|
||||
push @newservicenodes, $nodes;
|
||||
}
|
||||
my @mname = xCAT::Utils->noderangecontainsMn(@servicenodes);
|
||||
if (@mname) { # if there is a MN
|
||||
foreach my $node (@servicenodes) {
|
||||
# check to see if node in MN list
|
||||
if (!(grep(/^$node$/, @mname))) { # if node not in the MN array
|
||||
push @newservicenodes, $node;
|
||||
}
|
||||
}
|
||||
$servicenodetab->close;
|
||||
return @newservicenodes; # return without the MN in the array
|
||||
|
@ -3151,26 +3151,30 @@ sub noderangecontainsMn
|
||||
{
|
||||
my ($class, @noderange)=@_;
|
||||
# check if any node in the noderange is the Management Node return the
|
||||
# name
|
||||
my $mname;
|
||||
# name
|
||||
my @mnames; # management node names in the database, members of __mgmtnode
|
||||
my $tab = xCAT::Table->new('nodelist');
|
||||
my @nodelist=$tab->getAllNodeAttribs(['node','groups']);
|
||||
foreach my $n (@nodelist) {
|
||||
if (defined($n->{'groups'})) {
|
||||
my @groups=split(",",$n->{'groups'});
|
||||
if ((grep (/__mgmtnode/,@groups))) { # this is the MN
|
||||
$mname=$n->{'node'};
|
||||
last;
|
||||
push @mnames,$n->{'node'};
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($mname) { # if Management Node defined in the database
|
||||
if (grep(/^$mname$/, @noderange)) { # if MN in the noderange
|
||||
return $mname;
|
||||
} else {
|
||||
return ;
|
||||
my @MNs; # management node names found the noderange
|
||||
if (@mnames) { # if any Management Node defined in the database
|
||||
foreach my $mn (@mnames) {
|
||||
if (grep(/^$mn$/, @noderange)) { # if MN in the noderange
|
||||
push @MNs, $mn;
|
||||
}
|
||||
}
|
||||
if (@MNs) { # management nodes in the noderange
|
||||
return @MNs;
|
||||
}
|
||||
}
|
||||
return; # if no MN in the noderange, return nothing
|
||||
}
|
||||
|
||||
=head3 filter_nodes
|
||||
@ -3221,6 +3225,11 @@ sub filter_nodes{
|
||||
if ($ipmitab) {
|
||||
$ipmitabhash = $ipmitab->getNodesAttribs(\@nodes,['bmc']);
|
||||
}
|
||||
my $nodehmhash;
|
||||
my $nodehmtab = xCAT::Table->new("nodehm");
|
||||
if ($nodehmtab) {
|
||||
$nodehmhash = $nodehmtab->getNodesAttribs(\@nodes,['mgt']);
|
||||
}
|
||||
|
||||
my (@mp, @ngpfsp, @ngpbmc, @commonfsp, @commonbmc, @unknow);
|
||||
|
||||
@ -3230,6 +3239,15 @@ sub filter_nodes{
|
||||
# if only in 'ipmi', a common x86 node
|
||||
foreach (@nodes) {
|
||||
if (defined ($mptabhash->{$_}->[0]) && defined ($mptabhash->{$_}->[0]->{'mpa'})) {
|
||||
if ($mptabhash->{$_}->[0]->{'mpa'} eq $_) {
|
||||
if (defined($nodehmhash->{$_}->[0]) && defined($nodehmhash->{$_}->[0]->{'mgt'}) &&
|
||||
$nodehmhash->{$_}->[0]->{'mgt'} eq "blade") {
|
||||
push @mp, $_;
|
||||
} else {
|
||||
push @unknow, $_;
|
||||
}
|
||||
next;
|
||||
}
|
||||
if (defined ($ppctabhash->{$_}->[0]) && defined ($ppctabhash->{$_}->[0]->{'hcp'})) {
|
||||
# flex power node
|
||||
push @ngpfsp, $_;
|
||||
@ -3275,6 +3293,7 @@ sub filter_nodes{
|
||||
} else {
|
||||
push @{$mpnodes}, @ngpfsp;
|
||||
}
|
||||
push @{$mpnodes}, @ngpbmc;
|
||||
} elsif ($cmd eq "rvitals") {
|
||||
if (@args && (grep /^lcds$/,@args)) {
|
||||
push @{$fspnodes},@ngpfsp;
|
||||
|
@ -1915,6 +1915,8 @@ sub build_kitcomp
|
||||
# specifically reference it's version-release
|
||||
if ( &update_kitcomp_kitpkgdeps($comp,$repodir) ) { return 1; }
|
||||
|
||||
$::VALID_PRER_COMPONENT = 0;
|
||||
|
||||
if ( !$::PREREQUISITE ) {
|
||||
if ( $comp->{ospkgdeps} || $comp->{preinstall} || $comp->{preupgrade} || $comp->{preuninstall} ) {
|
||||
if ( &gen_kitcomp_spec($comp,\%repo, 'PREREQUISITE') ) { return 1; }
|
||||
@ -1954,6 +1956,8 @@ sub build_kitcomp
|
||||
}
|
||||
}
|
||||
|
||||
$::VALID_PRER_COMPONENT = 1;
|
||||
|
||||
}
|
||||
|
||||
if ( &gen_kitcomp_spec($comp,\%repo, 'METARPM') ) { return 1; }
|
||||
@ -2271,7 +2275,12 @@ sub gen_kitcomp_spec
|
||||
s/<<<INSERT_url_HERE>>>/$::bldkit_config->{kit}{entries}[0]->{url}/;
|
||||
s/<<<INSERT_kitcomponent_ospkgdeps_HERE>>>//;
|
||||
s/<<<INSERT_kitcomponent_kitpkgdeps_HERE>>>/$comp->{kitpkgdeps}/;
|
||||
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>/$comp->{kitcompdeps}/;
|
||||
#Update kitcompdeps for prep_<kitcomponent>
|
||||
if ( $::VALID_PRER_COMPONENT ) {
|
||||
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>/$comp->{kitcompdeps},prep_$comp->{basename}/;
|
||||
} else {
|
||||
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>/$comp->{kitcompdeps}/;
|
||||
}
|
||||
s/<<<INSERT_kitcomponent_desc_HERE>>>/$comp->{description}/;
|
||||
s/<<<INSERT_kitcomponent_non_native_pkgs_HERE>>>/$nonnativepkgs/;
|
||||
s/<<<INSERT_kitcomponent_sourcetar_HERE>>>/$sourcetar/;
|
||||
|
@ -132,7 +132,7 @@ in the install image.
|
||||
|
||||
=item B<-g> I<krpmver>
|
||||
|
||||
This flag is for SLES only. Use this flag to specify the rpm version for kernel packages in the image. It must be present if -k flag is specified in the command for SLES.
|
||||
Use this flag to specify the rpm version for kernel packages in the image. It must be present if -k flag is specified in the command for SLES. Generally, the value of -g is the part after B<linux-> and before B<.rpm> in a kernel rpm name.
|
||||
|
||||
=item B<-m> statelite
|
||||
|
||||
|
@ -211,7 +211,7 @@ sub makescript {
|
||||
return;
|
||||
}
|
||||
|
||||
$mn = xCAT::Utils->noderangecontainsMn(@$nodes);
|
||||
@::mn = xCAT::Utils->noderangecontainsMn(@$nodes);
|
||||
|
||||
my $cfgflag=0;
|
||||
my $cloudflag=0;
|
||||
@ -652,7 +652,7 @@ sub getNodeType
|
||||
my $node = shift;
|
||||
my $result;
|
||||
|
||||
if ( $node =~ /^$mn$/) {
|
||||
if (grep(/^$node$/, @::mn)) { # is it in the Management Node array
|
||||
$result="MN";
|
||||
return $result;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ use xCAT::NetworkUtils;
|
||||
use Data::Dumper;
|
||||
use xCAT::MacMap;
|
||||
use Socket;
|
||||
use Net::Ping;
|
||||
|
||||
##########################################################################
|
||||
## Command handler method from tables
|
||||
@ -34,6 +35,41 @@ sub process_request {
|
||||
|
||||
$::CALLBACK = $callback;
|
||||
|
||||
if ( defined( @{$::args} ) ) {
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
Getopt::Long::Configure( "bundling", "no_ignore_case", "no_pass_through" );
|
||||
my $getopt_success = Getopt::Long::GetOptions(
|
||||
'help|h|?' => \$::opt_h,
|
||||
'i|I=s' => \$::opt_I,
|
||||
'verbose|V' => \$::opt_V,
|
||||
'version|v' => \$::opt_v,
|
||||
);
|
||||
|
||||
# Option -h for Help
|
||||
if ( defined($::opt_h) || (!$getopt_success) ) {
|
||||
&configfpc_usage;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( (!$::opt_I) ) { # missing required option - msg and return
|
||||
my $rsp;
|
||||
push @{ $rsp->{data} }, "Missing required option -i <adapter_interface> \n";
|
||||
xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK );
|
||||
&configfpc_usage;
|
||||
return 0;
|
||||
}
|
||||
|
||||
# Option -V for verbose output
|
||||
if ( defined($::opt_V) ) {
|
||||
$::VERBOSE=$::opt_V;
|
||||
}
|
||||
|
||||
# Option -i for kit component attributes
|
||||
if ( defined($::opt_I) ) {
|
||||
$::interface = $::opt_I;
|
||||
}
|
||||
|
||||
my $command = $request->{command}->[0];
|
||||
my $localhostname = hostname();
|
||||
|
||||
@ -53,6 +89,19 @@ sub process_request {
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub configfpc_usage {
|
||||
my $rsp;
|
||||
push @{ $rsp->{data} },
|
||||
"\nUsage: configfpc - Configure the NeXtScale FPCs.i This command requires the -i option to give specify which network adapter to use to look for the FPCs.\n";
|
||||
push @{ $rsp->{data} },
|
||||
" configfpc -i interface_adapter \n ";
|
||||
push @{ $rsp->{data} },
|
||||
" configfpc [-V|--verbose] -i adapter_interface \n ";
|
||||
push @{ $rsp->{data} }, " configfpc [-h|--help|-?] \n";
|
||||
xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK );
|
||||
return 0;
|
||||
}
|
||||
|
||||
#
|
||||
# Main process subroutine
|
||||
#
|
||||
@ -87,6 +136,14 @@ sub configfpc {
|
||||
|
||||
# This is the default FPC IP that we are looking for
|
||||
my $foundfpc = 0;
|
||||
|
||||
# Setup routing to 182.168.0.100 network
|
||||
if($::VERBOSE){
|
||||
my %rsp = {};
|
||||
push@{ $rsp{data} }, "Adding route definition for $::interface and 192.168.0.101 network";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
}
|
||||
my $setroute = `ip addr add dev $::interface 192.168.0.101/16`;
|
||||
|
||||
#
|
||||
# check for an FPC - this ping will also add the FPC IP and MAC to the ARP table
|
||||
@ -96,33 +153,25 @@ sub configfpc {
|
||||
if ( $res =~ /100% packet loss/g) {
|
||||
# xCAT::MsgUtils->message ("I", "There are no default $fpcip FPC IP addresses to process");
|
||||
$foundfpc = 0;
|
||||
|
||||
my %rsp = {};
|
||||
push@{ $rsp{data} }, "No nodes Found FPC with $fpcip address";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
exit; # EXIT if we find no more default IP addresses on the network
|
||||
}
|
||||
else {
|
||||
# xCAT::MsgUtils->message ("I", "Found $fpcip FPC IP addresses to process");
|
||||
if($::VERBOSE){
|
||||
my %rsp = {};
|
||||
push@{ $rsp{data} }, "Found FPC with $fpcip address";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
}
|
||||
$foundfpc = 1;
|
||||
}
|
||||
|
||||
#
|
||||
# make the FPC node definition - this is removed at the end of processing the FPCs
|
||||
# this default FPC node definition is used by rspconfig to change the netmask, default route, and IP address of the default FPC
|
||||
#
|
||||
# Object name: deffpc
|
||||
# bmc=deffpc
|
||||
# bmcpassword=PASSW0RD
|
||||
# bmcusername=USERID
|
||||
# cons=ipmi
|
||||
# groups=deffpc
|
||||
# mgt=ipmi
|
||||
# mpa=deffpc
|
||||
#
|
||||
my $out = xCAT::Utils->runxcmd(
|
||||
{
|
||||
command => ["mkdef"],
|
||||
arg => [ "-t","node","-o",$defnode,"bmc=deffpc","bmcpassword=Passw0rd","bmcusername=USERID","cons=ipmi","groups=deffpc","mgt=ipmi","mpa=deffpc" ]
|
||||
},
|
||||
$subreq, 0,1);
|
||||
|
||||
|
||||
my $addnode = &add_node($defnode,$callback);
|
||||
|
||||
#
|
||||
# Main loop - check to see if we found an FPC and continue to set the FPC infomration and look for the next one
|
||||
#
|
||||
@ -139,46 +188,55 @@ sub configfpc {
|
||||
|
||||
# Change the FPC network netmask, gateway, and ip
|
||||
&set_FPC_network_parms($defnode,$netmask,$gateway,$newfpcip,$callback,$subreq);
|
||||
|
||||
# message changed network settings
|
||||
my %rsp = {};
|
||||
push@{ $rsp{data} }, "Configured FPC with MAC $fpcmac as $node ($newfpcip)";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
|
||||
# sleep for 4 seconds to allow rspconfig to change the IP value before validating with ping
|
||||
sleep 5;
|
||||
|
||||
#
|
||||
# Validate that new IP is working - Use ping to check if the new IP has been set
|
||||
#
|
||||
$res = `LANG=C ping -c 1 -w 5 $newfpcip`;
|
||||
#$res = system("LANG=C ping -c 1 -w 5 $fpcip 2>&1");
|
||||
if ( $res =~ /100% packet loss/g) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "The new ip $newfpcip was not accessible";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
#xCAT::MsgUtils->message("I","The new ip $newfpcip was not accessible");
|
||||
} else {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "Changed the IP address for the FPC with $fpcmac MAC to $newfpcip IP for node $node";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
#xCAT::MsgUtils->message("I","Changed the IP address for the FPC with $fpcmac MAC to $newfpcip IP for node $node");
|
||||
my $p = Net::Ping->new();
|
||||
my $ping_success=1;
|
||||
while ($ping_success) {
|
||||
if ($p->ping($newfpcip)) {
|
||||
my %rsp = {};
|
||||
push@{ $rsp{data} }, "Verified the FPC with MAC $fpcmac is responding to the new IP $newfpcip as node $node";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
$ping_success=0;
|
||||
}
|
||||
else {
|
||||
if($::VERBOSE){
|
||||
my %rsp = {};
|
||||
push@{ $rsp{data} }, "ping to $newfpcip is unsuccessful. Retrying ";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
}
|
||||
}
|
||||
}
|
||||
$p->close();
|
||||
|
||||
# The Node associated with this MAC was not found - print an infomrational message and continue
|
||||
} else {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "No FPC node found that is associated with MAC address $fpcmac\nCheck to see if the switch and switch table conta ins the information needed to locate this FPC MAC";
|
||||
push@{ $rsp{data} }, "No FPC found that is associated with MAC address $fpcmac.\nCheck to see if the switch and switch table contain the information needed to locate this FPC MAC";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
# xCAT::MsgUtils->message("I","No FPC node found that is associated with MAC address $fpcmac\nCheck to see if the switch and switch table contains the information needed to locate this FPC MAC");
|
||||
}
|
||||
|
||||
#
|
||||
# Delete this FPC default IP Arp entry to get ready to look for another defautl FPC
|
||||
#
|
||||
if($::VERBOSE){
|
||||
my %rsp = {};
|
||||
push@{ $rsp{data} }, "Removing default IP $fpcip from the arp table";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
}
|
||||
my $arpout = `arp -d $fpcip`;
|
||||
|
||||
# check for another FPC
|
||||
$res = `LANG=C ping -c 1 -w 5 $fpcip 2>&1`;
|
||||
if ( $res =~ /100% packet loss/g) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "There are no more default $fpcip FPC IP addresses to process";
|
||||
push@{ $rsp{data} }, "There are no more FPCs with the default IP address to process";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
#xCAT::MsgUtils->message("I","There are no more default $fpcip FPC IP addresses to process");
|
||||
$foundfpc = 0;
|
||||
}
|
||||
else {
|
||||
@ -187,12 +245,30 @@ sub configfpc {
|
||||
}
|
||||
|
||||
#
|
||||
# Cleanup on the way out - Remove the deffpc node definition
|
||||
# Cleanup on the way out - Delete route and remove the deffpc node definition
|
||||
#
|
||||
$out=xCAT::Utils->runxcmd(
|
||||
# Delete routing to 182.168.0.100 network
|
||||
if($::VERBOSE){
|
||||
my %rsp = {};
|
||||
push@{ $rsp{data} }, "Deleting route definition for $::interface and 192.168.0.101 network";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
}
|
||||
my $setroute = `ip addr del dev $::interface 192.168.0.101/16`;
|
||||
|
||||
# Delete routing to 182.168.0.100 network
|
||||
if($::VERBOSE){
|
||||
my %rsp = {};
|
||||
push@{ $rsp{data} }, "Removing default FPC node definition $defnode";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
}
|
||||
|
||||
if($::VERBOSE){ $::VERBOSE = {}; }
|
||||
#if($::VERBOSE){ undef $::VERBOSE; }
|
||||
|
||||
my $out=xCAT::Utils->runxcmd(
|
||||
{
|
||||
command => ['rmdef'],
|
||||
arg => [ "deffpc"]
|
||||
arg => [ $defnode ]
|
||||
},
|
||||
$subreq, 0,1);
|
||||
|
||||
@ -265,16 +341,18 @@ sub set_FPC_network_parms {
|
||||
|
||||
# Proceed with changing the FPC network parameters.
|
||||
# Set FPC Netmask
|
||||
|
||||
|
||||
if($::VERBOSE){
|
||||
my %rsp = {};
|
||||
push@{ $rsp{data} }, "Use rspconfig to set the FPC netmask $netmask for node $defnode";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
}
|
||||
my $netmaskout = xCAT::Utils->runxcmd(
|
||||
{
|
||||
command => ["rspconfig"],
|
||||
node => [$defnode],
|
||||
node => ["$defnode"],
|
||||
arg => [ "netmask=$netmask" ]
|
||||
},
|
||||
$request, 0,1);
|
||||
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "Could not change nemask $netmask on default FPC";
|
||||
@ -283,14 +361,18 @@ sub set_FPC_network_parms {
|
||||
}
|
||||
|
||||
# Set FPC gateway
|
||||
if($::VERBOSE){
|
||||
my %rsp = {};
|
||||
push@{ $rsp{data} }, "Use rspconfig to set the FPC gateway $gateway";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
}
|
||||
my $gatewayout = xCAT::Utils->runxcmd(
|
||||
{
|
||||
command => ["rspconfig"],
|
||||
node => [$defnode],
|
||||
node => ["$defnode"],
|
||||
arg => [ "gateway=$gateway" ]
|
||||
},
|
||||
$request, 0,1);
|
||||
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "Could not change gateway $gateway on default FPC";
|
||||
@ -298,16 +380,19 @@ sub set_FPC_network_parms {
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
# Set FPC Ip address
|
||||
if($::VERBOSE){
|
||||
my %rsp = {};
|
||||
push@{ $rsp{data} }, "Use rspconfig to set the FPC IP address $newfpcip";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
}
|
||||
my $ipout = xCAT::Utils->runxcmd(
|
||||
{
|
||||
command => ["rspconfig"],
|
||||
node => [$defnode],
|
||||
node => ["$defnode"],
|
||||
arg => [ "ip=$newfpcip" ]
|
||||
},
|
||||
$request, 0,1);
|
||||
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "Could not change ip address $newfpcip on default FPC";
|
||||
@ -344,7 +429,46 @@ sub get_node {
|
||||
my $macmap = xCAT::MacMap->new();
|
||||
my $node = '';
|
||||
$node = $macmap->find_mac($fpcmac,0);
|
||||
# verbose
|
||||
if($::VERBOSE){
|
||||
my %rsp = {};
|
||||
push@{ $rsp{data} }, "Found FPC with MAC $fpcmac associated with node $node";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
}
|
||||
|
||||
return ($node,$fpcmac);
|
||||
}
|
||||
|
||||
#
|
||||
# This subroutine adds the deffpc node entry for use by rspconfig
|
||||
#
|
||||
sub add_node {
|
||||
my $defnode = shift;
|
||||
my $callback = shift;
|
||||
# add this node entry
|
||||
# Object name: feihu-fpc
|
||||
# bmc=feihu-fpc (Table:ipmi - Key:node - Column:bmc)
|
||||
# bmcpassword=PASSW0RD (Table:ipmi - Key:node - Column:password)
|
||||
# bmcusername=USERID (Table:ipmi - Key:node - Column:username)
|
||||
# cons=ipmi (Table:nodehm - Key:node - Column:cons)
|
||||
# groups=fpc (Table:nodelist - Key:node - Column:groups)
|
||||
# mgt=ipmi (Table:nodehm - Key:node - Column:mgt)
|
||||
#
|
||||
|
||||
if($::VERBOSE){
|
||||
my %rsp = {};
|
||||
push@{ $rsp{data} }, "Creating default FPC node deffpc with IP 192.168.0.100 for later use with rspconfig";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
}
|
||||
|
||||
my $nodelisttab = xCAT::Table->new('nodelist',-create=>1);
|
||||
$nodelisttab->setNodeAttribs($defnode, {groups =>'defaultfpc'});
|
||||
my $nodehmtab = xCAT::Table->new('nodehm',-create=>1);
|
||||
$nodehmtab->setNodeAttribs($defnode, {mgt => 'ipmi'});
|
||||
my $ipmitab = xCAT::Table->new('ipmi',-create=>1);
|
||||
$ipmitab->setNodeAttribs($defnode, {bmc => $defnode, username => 'USERID', password => 'PASSW0RD'});
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -295,14 +295,23 @@ sub process_request {
|
||||
my @networks = $networkstab->getAllAttribs('net','mask','ddnsdomain','domain','nameservers');
|
||||
|
||||
# exclude the net if it is using an external dns server.
|
||||
foreach (@networks)
|
||||
foreach my $net (@networks)
|
||||
{
|
||||
if ($_ and $_->{nameservers})
|
||||
if ($net and $net->{nameservers})
|
||||
{
|
||||
my $myip = xCAT::NetworkUtils->my_ip_facing($_->{net});
|
||||
unless (($_->{nameservers} eq $myip) || ($_->{nameservers} eq '<xcatmaster>') || ($_->{nameservers} eq $sitens))
|
||||
my $valid = 0;
|
||||
my $myip = xCAT::NetworkUtils->my_ip_facing($net->{net});
|
||||
foreach (split /,/, $net->{nameservers})
|
||||
{
|
||||
$_ = undef;
|
||||
chomp $_;
|
||||
if (($_ eq $myip) || ($_ eq '<xcatmaster>') || ($_ eq $sitens))
|
||||
{
|
||||
$valid += 1;
|
||||
}
|
||||
}
|
||||
unless ($valid > 0)
|
||||
{
|
||||
$net = undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -270,14 +270,6 @@ sub process_request {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($krpmver) {
|
||||
if ($osfamily ne "sles") {
|
||||
$krpmver="";
|
||||
$callback->({error=>["-g flag is valid for Sles only."],errorcode=>[1]});
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
my $cmd="cd $profDir; ./genimage";
|
||||
if ($arch) { $cmd .= " -a $arch";}
|
||||
if ($osver) { $cmd .= " -o $osver";}
|
||||
|
@ -2911,8 +2911,10 @@ sub parsefru {
|
||||
return "unknown-COULDGUESS",undef; #be lazy for now, TODO revisit this and add guessing if it ever matters
|
||||
}
|
||||
$currsize=($bytes->[$curridx+1])*8;
|
||||
@currarea=@{$bytes}[$curridx..($curridx+$currsize-1)]; #splice @$bytes,$curridx,$currsize;
|
||||
$fruhash->{chassis} = parsechassis(@currarea);
|
||||
if ($currsize > 0) {
|
||||
@currarea=@{$bytes}[$curridx..($curridx+$currsize-1)]; #splice @$bytes,$curridx,$currsize;
|
||||
$fruhash->{chassis} = parsechassis(@currarea);
|
||||
}
|
||||
}
|
||||
if ($bytes->[3]) { #Board info area, to be preserved
|
||||
$curridx=$bytes->[3]*8;
|
||||
@ -2920,8 +2922,10 @@ sub parsefru {
|
||||
return "unknown-COULDGUESS",undef;
|
||||
}
|
||||
$currsize=($bytes->[$curridx+1])*8;
|
||||
@currarea=@{$bytes}[$curridx..($curridx+$currsize-1)];
|
||||
$fruhash->{board} = parseboard(@currarea);
|
||||
if ($currsize > 0) {
|
||||
@currarea=@{$bytes}[$curridx..($curridx+$currsize-1)];
|
||||
$fruhash->{board} = parseboard(@currarea);
|
||||
}
|
||||
}
|
||||
if (ref $global_sessdata->{currmacs}) {
|
||||
$fruhash->{board}->{macaddrs}=[];
|
||||
@ -2938,8 +2942,10 @@ sub parsefru {
|
||||
return "unknown-COULDGUESS",undef;
|
||||
}
|
||||
$currsize=($bytes->[$curridx+1])*8;
|
||||
@currarea=@{$bytes}[$curridx..($curridx+$currsize-1)];
|
||||
$fruhash->{product} = parseprod(@currarea);
|
||||
if ($currsize > 0) {
|
||||
@currarea=@{$bytes}[$curridx..($curridx+$currsize-1)];
|
||||
$fruhash->{product} = parseprod(@currarea);
|
||||
}
|
||||
}
|
||||
if ($bytes->[5]) { #Generic multirecord present..
|
||||
$fruhash->{extra}=[];
|
||||
|
@ -2348,7 +2348,7 @@ sub power {
|
||||
$dom->shutdown();
|
||||
} else { $retstring .= "$status_noop"; }
|
||||
} elsif ($subcommand eq 'reset') {
|
||||
if ($dom) {
|
||||
if ($dom && $dom->is_active()) {
|
||||
my $oldxml=$dom->get_xml_description();
|
||||
my $newxml=reconfigvm($node,$oldxml);
|
||||
#This *was* to be clever, but libvirt doesn't even frontend the capability, great...
|
||||
|
@ -396,12 +396,13 @@ sub preprocess_updatenode
|
||||
|
||||
# check to see if the Management Node is in the noderange and
|
||||
# if it is abort
|
||||
my $mname = xCAT::Utils->noderangecontainsMn(@$nodes);
|
||||
if ($mname)
|
||||
my @mname = xCAT::Utils->noderangecontainsMn(@$nodes);
|
||||
if (@mname)
|
||||
{ # MN in the nodelist
|
||||
my $nodes=join(',', @mname);
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"You must not run -k option against the Management Node:$mname.";
|
||||
"You must not run -k option against a management node: $nodes.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
|
||||
return;
|
||||
}
|
||||
|
@ -2107,8 +2107,8 @@ sub cleanupPSTable
|
||||
|
||||
=head3 setupMNinDB
|
||||
|
||||
Will add/replace the management node to the noderes table with group=__mgmtnode
|
||||
Will add/replace the management node to the servicenode tble with group=__mgmtnode
|
||||
Will add the management node to the noderes table with group=__mgmtnode
|
||||
Will add the management node to the servicenode tble with group=__mgmtnode
|
||||
|
||||
|
||||
=cut
|
||||
@ -2124,23 +2124,20 @@ sub setupMNinDB
|
||||
|
||||
my $defined = 0;
|
||||
my $cmds="XCATBYPASS=Y $::XCATROOT/sbin/tabdump nodelist | grep __mgmtnode";
|
||||
my $output = xCAT::Utils->runcmd("$cmds", -1);
|
||||
if ($::RUNCMD_RC == 0) # found a management node defined
|
||||
my @output = xCAT::Utils->runcmd("$cmds", -1);
|
||||
|
||||
if ($::RUNCMD_RC == 0) # found nodes in __mgmtnode
|
||||
{
|
||||
my $chtabcmds;
|
||||
my @mn = split(",", $output);
|
||||
$mn[0] =~ s/"//g; # remove the quotes
|
||||
if ($mn[0] ne $mnname) { # does not match current host name,delete it
|
||||
$chtabcmds = "$::XCATROOT/sbin/chtab -d node=$mn[0] nodelist;";
|
||||
my $outref = xCAT::Utils->runcmd("$chtabcmds", 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message('E', "Could not run $chtabcmds.");
|
||||
return;
|
||||
# Look through the MN list and see if this MN is defined
|
||||
foreach my $line (@output) {
|
||||
my @mn = split(",", $line);
|
||||
$mn[0]=~ s/"//g; # remove the quotes
|
||||
if ($mn[0] eq $mnname) { # already in the database
|
||||
verbose("$mnname already defined in the the nodelist table.");
|
||||
$defined=1;
|
||||
last;
|
||||
}
|
||||
} else { # it is defined and good
|
||||
xCAT::MsgUtils->message('I', "$mnname already defined in the nodelist table.");
|
||||
$defined=1;
|
||||
}
|
||||
}
|
||||
# now add with the new name , if not already there
|
||||
@ -2195,9 +2192,10 @@ sub setupMNinDB
|
||||
}
|
||||
|
||||
} else { # it was already defined in the servicenode table
|
||||
xCAT::MsgUtils->message('I', "$mnname was already defined in the servicenode table.");
|
||||
verbose("$mnname already defined in the the servicenode table.");
|
||||
|
||||
}
|
||||
xCAT::MsgUtils->message('I', "Management Node defined in the database.");
|
||||
return;
|
||||
}
|
||||
#-----------------------------------------------------------------------------
|
||||
|
@ -2177,7 +2177,7 @@ sub enable_callingtrace{
|
||||
my @xcatdfuncs = (); # function list that will be enabled for xcatd
|
||||
|
||||
# call the subroutine scan_plugins to fill the symbol table
|
||||
scan_plugins();
|
||||
#scan_plugins();
|
||||
|
||||
# Backup the trace log
|
||||
my ($sec,$min,$hour,$mday,$mon,$year) = localtime();
|
||||
|
@ -48,6 +48,7 @@ my $tmplimit;
|
||||
my $installroot = "/install";
|
||||
my $kerneldir;
|
||||
my $kernelver = ""; #`uname -r`;
|
||||
my $krpmver;
|
||||
my $basekernelver; # = $kernelver;
|
||||
my $customdir=$fullpath;
|
||||
$customdir =~ s/.*share\/xcat/$installroot\/custom/;
|
||||
@ -80,6 +81,7 @@ GetOptions(
|
||||
'l=s' => \$rootlimit,
|
||||
't=s' => \$tmplimit,
|
||||
'k=s' => \$kernelver,
|
||||
'g=s' => \$krpmver,
|
||||
'permission=s' => \$permission,
|
||||
'kerneldir=s' => \$kerneldir,
|
||||
'tempfile=s' =>\$tempfile, #internal flag
|
||||
@ -266,16 +268,19 @@ unless ($onlyinitrd) {
|
||||
# replace the kernel package with the name has the specific version
|
||||
foreach my $p (@$pa) {
|
||||
if ($p =~ /^kernel$/ && $kernelver) {
|
||||
my $kernelname = "kernel-".$kernelver;
|
||||
my $kernelname;
|
||||
if ($krpmver) {
|
||||
$kernelname = "kernel-".$krpmver;
|
||||
} else {
|
||||
$kernelname = "kernel-".$kernelver;
|
||||
}
|
||||
my $searchkern = $yumcmd . " list $kernelname -q";
|
||||
my @kernpkgs = `$searchkern`;
|
||||
my $found = 0;
|
||||
foreach my $k (@kernpkgs) {
|
||||
if ($k =~ /\s*kernel[^\s]*\s+([\w\.-]+)/) {
|
||||
my $version = $1;
|
||||
my $relversion = $kernelver;
|
||||
$relversion =~ s/\.[^\.]+$//;
|
||||
if ($version == $relversion) {
|
||||
if ($kernelver =~ /$version/) {
|
||||
$found++;
|
||||
}
|
||||
}
|
||||
|
@ -272,6 +272,7 @@ rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/hmc.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/ivm.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/lsslp.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/slpdiscover.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/seqdiscovery.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/remoteimmsetup.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/IMMUtils.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/RShellAPI.pm
|
||||
|
Loading…
x
Reference in New Issue
Block a user