Merge branch 'master' of ssh://git.code.sf.net/p//xcat/xcat-core
This commit is contained in:
commit
d526bbaaa8
@ -949,9 +949,14 @@ sub kit_buildtar
|
||||
|
||||
my $tarfile = $::deploy_dir."/".$kitfilename;
|
||||
|
||||
if ( system("cd $::deploy_dir; cd ..; cp -r build_input $kitname" ) ) {
|
||||
print "Error: Could not copy building tarfile $tarfile \n";
|
||||
return 1;
|
||||
my $dir = dirname($::deploy_dir);
|
||||
my $bidir = "$dir/build_input";
|
||||
|
||||
if ( -d "$bidir") {
|
||||
if ( system("cd $::deploy_dir; cd ..; cp -r build_input $kitname" ) ) {
|
||||
print "Error: Could not copy building tarfile $tarfile \n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
print "Creating tar file $tarfile.\n";
|
||||
@ -1940,9 +1945,10 @@ sub build_kitcomp
|
||||
my $specfile = $::workdir."/tmp/$comp->{kitcompname}-prep.spec";
|
||||
my $rpmbuild_cmd = "rpmbuild --define \"_topdir $rpmbuild_dir\" -ba $specfile";
|
||||
|
||||
if (!$::VERBOSE) {
|
||||
# don't want debug info - 3845
|
||||
# if (!$::VERBOSE) {
|
||||
$rpmbuild_cmd .= ' --quiet ';
|
||||
}
|
||||
# }
|
||||
if ( system($rpmbuild_cmd) ) {
|
||||
print "Error running rpmbuild command for kit component $comp->{kitcompname} meta package\n";
|
||||
return 1;
|
||||
@ -1955,7 +1961,7 @@ sub build_kitcomp
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$::VALID_PRER_COMPONENT = 1;
|
||||
|
||||
}
|
||||
@ -2012,9 +2018,12 @@ sub build_kitcomp
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (!$::VERBOSE) {
|
||||
|
||||
# - don't want debug info - 3845
|
||||
# if (!$::VERBOSE) {
|
||||
$rpmbuild_cmd .= ' --quiet ';
|
||||
}
|
||||
# }
|
||||
|
||||
if ( system($rpmbuild_cmd) ) {
|
||||
print "Error running rpmbuild command for kit component $comp->{kitcompname} meta package\n";
|
||||
return 1;
|
||||
@ -2056,7 +2065,7 @@ sub update_kitcomp_kitpkgdeps
|
||||
my $repodir = shift;
|
||||
|
||||
if (defined($comp->{kitpkgdeps})) {
|
||||
# we have some rpms listed -n buildkit.conf file
|
||||
# we have some rpms listed in buildkit.conf file
|
||||
my $new_kitpkgdeps = '';
|
||||
foreach my $d (split(/,/, $comp->{kitpkgdeps})) {
|
||||
$d =~ s/\s+//g;
|
||||
@ -2073,7 +2082,6 @@ sub update_kitcomp_kitpkgdeps
|
||||
my @rpmlist = `$lscmd`;
|
||||
|
||||
if ( scalar(@rpmlist) == 0) {
|
||||
print "Error: Could not find rpm named $d in $repodir. \n";
|
||||
next;
|
||||
}
|
||||
|
||||
@ -3542,6 +3550,7 @@ sub NEW_kit_addpkgs
|
||||
system ("rm -Rf $tmpdir_base");
|
||||
return 1;
|
||||
}
|
||||
|
||||
my @fromfiles=@$files;
|
||||
|
||||
foreach my $repo (split(/,/, $ext_reponames)) {
|
||||
|
3766
xCAT-buildkit/bin/buildkit.fix
Executable file
3766
xCAT-buildkit/bin/buildkit.fix
Executable file
File diff suppressed because it is too large
Load Diff
55
xCAT-client/pods/man1/configfpc.1.pod
Normal file
55
xCAT-client/pods/man1/configfpc.1.pod
Normal file
@ -0,0 +1,55 @@
|
||||
=head1 NAME
|
||||
|
||||
B<configfpc> - discover the Fan Power Controllers (FPCs) and configure the FPC interface
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<configfpc> B<-i> I<interface>
|
||||
|
||||
B<configfpc> [B<-V>|B<--verbose>]
|
||||
|
||||
B<configfpc> [B<-h>|B<--help>|B<-?>]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<configfpc> will discover and configure all FPCs that are set to the default IP address.
|
||||
|
||||
The B<-i> B<interface> is required to direct B<configfpc> to the xCAT MN interface which is on the same VLAN as the FPCs.
|
||||
|
||||
There are several bits of information that must be included in the xCAT database before running this command.
|
||||
|
||||
You must create the FPC node definitions for all FPCs being discovered including the IP address and switch port information.
|
||||
|
||||
The B<configfpc> command discovers the FPCs and collects the MAC address. The MAC address is used to relate the FPC to a FPC node using the switch information for this MAC. Once the relationship is discovered the FPC is configured with the FPC node IP settings.
|
||||
|
||||
This process is repeated until no more FPCs are discovered.
|
||||
|
||||
For more information on xCAT support of NeXtScale and configfpc see:
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_NeXtScale_Clusters
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 6
|
||||
|
||||
=item B<-i> I<interface>
|
||||
|
||||
Use this flag to specify which xCAT MN interface (example: eth4) that is connected to the NeXtScale FPCs. This option is required.
|
||||
|
||||
=item B<-V>|B<--verbose>
|
||||
|
||||
Verbose mode
|
||||
|
||||
=back
|
||||
|
||||
=head1 Example
|
||||
|
||||
=over 6
|
||||
|
||||
=item 1
|
||||
|
||||
To discover and configure all NeXtScale Fan Power Controllers (FPCs) connected on eth0 interface.
|
||||
|
||||
B<configfpc> B<-i> I<eth0>
|
||||
|
||||
=back
|
||||
|
@ -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,40 @@ 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,
|
||||
);
|
||||
|
||||
# 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 +88,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 \n ";
|
||||
push @{ $rsp->{data} },
|
||||
" configfpc [-V|--verbose] -i interface \n ";
|
||||
push @{ $rsp->{data} }, " configfpc [-h|--help|-?] \n";
|
||||
xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK );
|
||||
return 0;
|
||||
}
|
||||
|
||||
#
|
||||
# Main process subroutine
|
||||
#
|
||||
@ -87,6 +135,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 +152,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,60 +187,91 @@ 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";
|
||||
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");
|
||||
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( "E", \%rsp, $callback );
|
||||
$foundfpc = 0;
|
||||
}
|
||||
|
||||
#
|
||||
# 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";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
#xCAT::MsgUtils->message("I","There are no more default $fpcip FPC IP addresses to process");
|
||||
$foundfpc = 0;
|
||||
}
|
||||
else {
|
||||
$foundfpc = 1;
|
||||
if ( ($foundfpc==1) ) { # if the last FPC was found and processed
|
||||
|
||||
# check for another FPC
|
||||
$res = `LANG=C ping -c 1 -w 5 $fpcip 2>&1`;
|
||||
if ( ($res =~ /100% packet loss/g) && ($foundfpc==1) ) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "There are no more FPCs with the default IP address to process";
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
$foundfpc = 0;
|
||||
}
|
||||
else {
|
||||
$foundfpc = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# 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 +344,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 +364,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 +383,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 +432,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;
|
||||
|
12
xCAT-server/lib/xcat/plugins/dhcp.pm
Normal file → Executable file
12
xCAT-server/lib/xcat/plugins/dhcp.pm
Normal file → Executable file
@ -1998,6 +1998,11 @@ sub addnet
|
||||
if ($ent[0] eq $net and $ent[2] eq $mask)
|
||||
{
|
||||
$nic = $ent[1];
|
||||
# The first nic that matches the network,
|
||||
# what will happen if there are more than one nics in the same subnet,
|
||||
# and we want to use the second nic as the dhcp interfaces?
|
||||
# this is a TODO
|
||||
last;
|
||||
}
|
||||
}
|
||||
#print " add $net $mask under $nic\n";
|
||||
@ -2014,6 +2019,13 @@ sub addnet
|
||||
}
|
||||
unless ($dhcpconf[$idx] =~ /\} # $nic nic_end\n/)
|
||||
{
|
||||
$callback->(
|
||||
{
|
||||
error =>
|
||||
["Could not add the subnet $net/$mask for nic $nic into $dhcpconffile."],
|
||||
errorcode => [1]
|
||||
}
|
||||
);
|
||||
return 1; #TODO: this is an error condition
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +125,8 @@ sub handled_commands{
|
||||
rpower => 'nodehm:power,mgt',
|
||||
rsetboot => 'nodehm:power,mgt',
|
||||
rmigrate => 'nodehm:power,mgt',
|
||||
formatdisk => "nodetype:os=(esxi.*)",
|
||||
rescansan => "nodetype:os=(esxi.*)",
|
||||
mkvm => 'nodehm:mgt',
|
||||
rmvm => 'nodehm:mgt',
|
||||
clonevm => 'nodehm:mgt',
|
||||
@ -210,7 +212,7 @@ sub preprocess_request {
|
||||
|
||||
my $vmtabhash = $vmtab->getNodesAttribs($noderange,['host','migrationdest']);
|
||||
foreach my $node (@$noderange){
|
||||
if ($command eq "rmhypervisor" or $command eq 'lsvm' or $command eq 'rshutdown' or $command eq "chhypervisor") {
|
||||
if ($command eq "rmhypervisor" or $command eq 'lsvm' or $command eq 'rshutdown' or $command eq "chhypervisor" or $command eq "formatdisk" or $command eq 'rescansan') {
|
||||
$hyp_hash{$node}{nodes} = [$node];
|
||||
} else {
|
||||
my $ent = $vmtabhash->{$node}->[0];
|
||||
@ -319,6 +321,7 @@ sub process_request {
|
||||
if ($request->{_xcat_authname}->[0]) {
|
||||
$requester=$request->{_xcat_authname}->[0];
|
||||
}
|
||||
%vcenterhash = ();#A data structure to reflect the state of vcenter connectivity to hypervisors
|
||||
my $level = shift;
|
||||
my $distname = undef;
|
||||
my $arch = undef;
|
||||
@ -636,6 +639,10 @@ sub do_cmd {
|
||||
generic_vm_operation(['config.name','runtime.host'],\&setboot,@exargs);
|
||||
} elsif ($command eq 'rinv') {
|
||||
generic_vm_operation(['config.name','config','runtime.host','layoutEx'],\&inv,@exargs);
|
||||
} elsif ($command eq 'formatdisk') {
|
||||
generic_hyp_operation(\&formatdisk,@exargs);
|
||||
} elsif ($command eq 'rescansan') {
|
||||
generic_hyp_operation(\&rescansan,@exargs);
|
||||
} elsif ($command eq 'rmhypervisor') {
|
||||
generic_hyp_operation(\&rmhypervisor,@exargs);
|
||||
} elsif ($command eq 'rshutdown') {
|
||||
@ -2173,6 +2180,48 @@ sub rshutdown_inmaintenance {
|
||||
return;
|
||||
}
|
||||
|
||||
sub rescansan {
|
||||
my %args = @_;
|
||||
my $hyp = $args{hyp};
|
||||
my $hostview = get_hostview(hypname=>$hyp,conn=>$hyphash{$hyp}->{conn},properties=>['config','configManager']);
|
||||
if (defined $hostview) {
|
||||
my $hdss = $hostview->{vim}->get_view(mo_ref=>$hostview->configManager->storageSystem);
|
||||
$hdss->RescanAllHba();
|
||||
$hdss->RescanVmfs();
|
||||
}
|
||||
}
|
||||
|
||||
sub formatdisk {
|
||||
my %args = @_;
|
||||
my $hyp = $args{hyp};
|
||||
$hyphash{$hyp}->{hostview} = get_hostview(hypname=>$hyp,conn=>$hyphash{$hyp}->{conn},properties=>['config','configManager']);
|
||||
@ARGV = @{$args{exargs}};
|
||||
my $nid;
|
||||
my $name;
|
||||
GetOptions(
|
||||
'id=s' => \$nid,
|
||||
'name=s' => \$name,
|
||||
);
|
||||
my $hostview = $hyphash{$hyp}->{hostview};
|
||||
if (defined $hyphash{$hyp}->{hostview}) {
|
||||
my $hdss = $hostview->{vim}->get_view(mo_ref=>$hostview->configManager->storageSystem);
|
||||
$hdss->RescanAllHba();
|
||||
my $dss = $hostview->{vim}->get_view(mo_ref=>$hostview->configManager->datastoreSystem);
|
||||
my $diskList = $dss->QueryAvailableDisksForVmfs();
|
||||
foreach my $disk (@$diskList) {
|
||||
foreach my $id (@{$disk->{descriptor}}) {
|
||||
if (lc($id->{id}) eq lc('naa.'.$nid)) {
|
||||
my $options = $dss->QueryVmfsDatastoreCreateOptions(devicePath => $disk->devicePath);
|
||||
@$options[0]->spec->vmfs->volumeName($name);
|
||||
my $newDatastore = $dss->CreateVmfsDatastore(spec => @$options[0]->spec );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub rmhypervisor {
|
||||
my %args = @_;
|
||||
my $hyp = $args{hyp};
|
||||
@ -4925,7 +4974,6 @@ sub cpNetbootImages {
|
||||
chdir($tmpDir);
|
||||
xCAT::SvrUtils::sendmsg("extracting netboot files from OS image. This may take about a minute or two...hopefully you have ~1GB free in your /tmp dir\n", $output_handler);
|
||||
my $cmd = "tar zxf $srcDir/image.tgz";
|
||||
print "\n$cmd\n";
|
||||
if(system($cmd)){
|
||||
xCAT::SvrUtils::sendmsg([1,"Unable to extract $srcDir/image.tgz\n"], $output_handler);
|
||||
}
|
||||
@ -4937,13 +4985,11 @@ sub cpNetbootImages {
|
||||
|
||||
# now we need to get partition 5 which has the installation goods in it.
|
||||
my $scmd = "fdisk -lu $tmpDir/usr/lib/vmware/installer/*dd 2>&1 | grep dd5 | awk '{print \$2}'";
|
||||
print "running: $scmd\n";
|
||||
my $sector = `$scmd`;
|
||||
chomp($sector);
|
||||
my $offset = $sector * 512;
|
||||
mkdir "/mnt/xcat";
|
||||
my $mntcmd = "mount $tmpDir/usr/lib/vmware/installer/*dd /mnt/xcat -o loop,offset=$offset";
|
||||
print "$mntcmd\n";
|
||||
if(system($mntcmd)){
|
||||
xCAT::SvrUtils::sendmsg([1,"unable to mount partition 5 of the ESX netboot image to /mnt/xcat"], $output_handler);
|
||||
return;
|
||||
@ -4965,7 +5011,6 @@ sub cpNetbootImages {
|
||||
}
|
||||
chdir("/tmp");
|
||||
system("umount /mnt/xcat");
|
||||
print "tempDir: $tmpDir\n";
|
||||
system("rm -rf $tmpDir");
|
||||
} elsif (-r "$srcDir/cim.vgz" and -r "$srcDir/vmkernel.gz" and -r "$srcDir/vmkboot.gz" and -r "$srcDir/sys.vgz") {
|
||||
use File::Basename;
|
||||
|
@ -1730,7 +1730,7 @@ sub validate_os{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( $osimage->{arch} ne $kitcomp->{osarch} ) {
|
||||
if ( $osimage->{arch} ne $kitcomp->{osarch} && $kitcomp->{osarch} ne 'noarch' ) {
|
||||
# my %rsp;
|
||||
# push@{ $rsp{data} }, "osimage $os is not compatible with kit component $kitcomp->{kitcompname} with attribute arch";
|
||||
# xCAT::MsgUtils->message( "E", \%rsp, $::CALLBACK );
|
||||
@ -2013,7 +2013,7 @@ sub addkitcomp
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( $os{$osimage}{arch} ne $kitcomps{$kitcomp}{osarch} ) {
|
||||
if ( $os{$osimage}{arch} ne $kitcomps{$kitcomp}{osarch} && $kitcomps{$kitcomp}{osarch} ne 'noarch' ) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "osimage $osimage is not compatible with kit component $kitcomp with attribute arch";
|
||||
xCAT::MsgUtils->message( "E", \%rsp, $callback );
|
||||
@ -3328,7 +3328,7 @@ sub chkkitcomp
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( $os{$osimage}{arch} ne $kitcomps{$kitcomp}{osarch} ) {
|
||||
if ( $os{$osimage}{arch} ne $kitcomps{$kitcomp}{osarch} && $kitcomps{$kitcomp}{osarch} ne 'noarch' ) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "kit component $kitcomp is not compatible with osimage $osimage with attribute arch";
|
||||
xCAT::MsgUtils->message( "E", \%rsp, $callback );
|
||||
@ -4516,7 +4516,7 @@ sub get_compat_kitreponames {
|
||||
if (defined($kitrepo->{osminorversion}) && $kitrepo->{osminorversion} ne $osdistro->{minorversion}) {
|
||||
next;
|
||||
}
|
||||
if (defined($kitrepo->{osarch}) && $kitrepo->{osarch} ne $osdistro->{arch}) {
|
||||
if (defined($kitrepo->{osarch}) && $kitrepo->{osarch} ne $osdistro->{arch} && $kitrepo->{osarch} ne 'noarch') {
|
||||
next;
|
||||
}
|
||||
|
||||
|
@ -133,12 +133,14 @@ sub mkstorage {
|
||||
my $pool;
|
||||
my $size;
|
||||
my $boot = 0;
|
||||
my $format = 0;
|
||||
unless (ref $request->{arg}) {
|
||||
die "TODO: usage";
|
||||
}
|
||||
my $name;
|
||||
@ARGV = @{$request->{arg}};
|
||||
unless (GetOptions(
|
||||
'format' => \$format,
|
||||
'shared' => \$shared,
|
||||
'controller=s' => \$controller,
|
||||
'boot' => \$boot,
|
||||
@ -183,6 +185,19 @@ sub mkstorage {
|
||||
my %namemap = makehosts($wwns, controller=>$controller, cfg=>$storents);
|
||||
my @names = values %namemap;
|
||||
bindhosts(\@names, $lun, controller=>$controller);
|
||||
if ($format) {
|
||||
my %request = (
|
||||
node => [$nodes[0]],
|
||||
command => [ 'formatdisk' ],
|
||||
arg => [ '--id', $lun->{wwn}, '--name', $lun->{name} ]
|
||||
);
|
||||
$dorequest->(\%request, $callback);
|
||||
%request = (
|
||||
node => \@nodes,
|
||||
command => [ 'rescansan' ],
|
||||
);
|
||||
$dorequest->(\%request, $callback);
|
||||
}
|
||||
} else {
|
||||
foreach my $node (@nodes) {
|
||||
mkstorage_single(node=>$node, size=>$size, pool=>$pool,
|
||||
|
@ -1051,6 +1051,20 @@ sub is_debian
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub is_redhat6sp4
|
||||
{
|
||||
if( -e "/etc/redhat-release" ){
|
||||
open(my $relfile, "<", "/etc/redhat-release");
|
||||
my $line = <$relfile>;
|
||||
close($relfile);
|
||||
if ( $line =~ /Red Hat Enterprise Linux Server release 6.4/i ){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
# on Ubuntu need to painstakingly compare /etc/localtime with files under
|
||||
# /usr/share/zoneinfo since /etc/localtime # isn't always a symbolic link
|
||||
sub discover_timezone_ubuntu
|
||||
@ -2233,6 +2247,13 @@ sub startnamedonboot
|
||||
$serv = "bind9";
|
||||
$cmd = "update-rc.d $serv enable";
|
||||
}
|
||||
|
||||
#"service named start" is very slowly,sometimes hang in rhels6.4 after installation
|
||||
#a work around is to generate /etc/rndc-key during xCAT installation
|
||||
if( is_redhat6sp4() ){
|
||||
system("rndc-confgen -a -r /dev/urandom");
|
||||
}
|
||||
|
||||
my $outref = xCAT::Utils->runcmd("$cmd", 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ sub run_cmd {
|
||||
print "\n\tExecuting: $Command \n";
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "Timeout\n" };
|
||||
alarm 60;
|
||||
alarm 600;
|
||||
@output = `$Command`;
|
||||
alarm 0;
|
||||
};
|
||||
@ -238,7 +238,7 @@ sub snap_it {
|
||||
"ls $installdir","/usr/bin/crontab -l",
|
||||
"find /tftpboot -size -32k","ls -lR $xcatroot",
|
||||
"arp -a","ps -edlf","ps -aux","ulimit -a","df -k",
|
||||
"cat /etc/issue","lsxcatd -a");
|
||||
"cat /etc/issue","lsxcatd -a","cat /proc/meminfo", "cat /proc/cpuinfo");
|
||||
}
|
||||
foreach my $item (@Commands_array) {
|
||||
$Command = $item;
|
||||
|
@ -52,6 +52,7 @@ echo -e "<xcatrequest>\n<command>nextdestiny</command>\n</xcatrequest>" | /bin/o
|
||||
chkconfig SSH on
|
||||
chkconfig ESXShell on
|
||||
esxcli system settings advanced set --int-value 0 --option /VMFS3/EnableBlockDelete
|
||||
esxcli system settings advanced set --int-value 1 --option /UserVars/SuppressShellWarning
|
||||
esxcli network ip set -e y
|
||||
esxcli network firewall ruleset set -r DHCPv6 -e y
|
||||
esxcli network firewall ruleset set -r sshServer -e y
|
||||
|
@ -4,48 +4,7 @@ if [ ! -c /dev/vcs ]; then
|
||||
mknod /dev/vcs c 7 0
|
||||
fi
|
||||
|
||||
while [ -z "$instdisk" ]; do
|
||||
VIRTDISKS=`ls /dev/vd*|wc -l`
|
||||
if [ $VIRTDISKS -gt 0 ]; then
|
||||
for disk in /dev/vd*[^0-9]; do
|
||||
if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
|
||||
#no edd_id in debian installer, no edd hints supported
|
||||
done
|
||||
fi
|
||||
if [ -z "$firstdirectdisk" ]; then
|
||||
SCSIDISKS=`ls /dev/sd*|wc -l`
|
||||
if [ $SCSIDISKS -gt 0 ]; then
|
||||
for disk in /dev/sd*[^0-9]; do
|
||||
currdriver=`udevadm info --attribute-walk --name $disk |grep DRIVERS|grep -v '""'|grep -v '"sd"'|head -n 1|sed -e 's/[^"]*"//' -e 's/"//'`
|
||||
case "$currdriver" in
|
||||
"ata_piix4"|"PMC MaxRAID"|"ahci"|"megaraid_sas") #certainly direct
|
||||
if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resor
|
||||
;;
|
||||
"mptsas"|"mpt2sas") #*PROBABLY* not SAN, but SAS SAN is possible
|
||||
if [ -z "$probablyfirstdirectdisk" ]; then probablyfirstdirectdisk=$disk; fi
|
||||
;;
|
||||
*) # could be san or who knows what, use it as a last resort
|
||||
if [ -z "$firstdisk" ]; then firstdisk=$disk; fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
fi
|
||||
if [ -z "$instdisk" ]; then
|
||||
if [ ! -z "$firstdirectdisk" ]; then
|
||||
instdisk=$firstdirectdisk
|
||||
elif [ ! -z "$probablyfirstdirectdisk" ]; then
|
||||
instdisk=$probablyfirstdirectdisk
|
||||
elif [ ! -z "$firstdisk" ]; then
|
||||
instdisk=$firstdisk
|
||||
fi
|
||||
fi
|
||||
if [ ! -z "$instdisk" ]; then debconf-set partman-auto/disk "$instdisk"; fi
|
||||
debconf-get open-iscsi/targets > /tmp/q
|
||||
sleep 0.1
|
||||
done &
|
||||
|
||||
|
||||
|
||||
cat >/tmp/foo.sh <<EOF
|
||||
#!/bin/sh
|
||||
|
@ -36,6 +36,8 @@ d-i partman-lvm/device_remove_lvm boolean true
|
||||
d-i partman-md/device_remove_md boolean true
|
||||
|
||||
#create the /tmp/partitioning based on the uefi or legacy bios
|
||||
d-i partman/early_command string \
|
||||
debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
|
||||
d-i partman-auto/expert_recipe_file string /tmp/partitioning
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
|
@ -36,6 +36,8 @@ d-i partman-lvm/device_remove_lvm boolean true
|
||||
d-i partman-md/device_remove_md boolean true
|
||||
|
||||
#create the /tmp/partitioning based on the uefi or legacy bios
|
||||
d-i partman/early_command string \
|
||||
debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
|
||||
d-i partman-auto/expert_recipe_file string /tmp/partitioning
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
#first off, let's ditch UNMAP, per vwmare's recall...
|
||||
localcli system settings advanced set --int-value 0 --option /VMFS3/EnableBlockDelete
|
||||
localcli system settings advanced set --int-value 1 --option /UserVars/SuppressShellWarning
|
||||
#ok, now let's turn on some SSH and ESXShell fun
|
||||
localcli network firewall ruleset set -r sshServer -e y
|
||||
chkconfig ESXShell on
|
||||
|
Loading…
x
Reference in New Issue
Block a user