Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8

This commit is contained in:
Jarrod Johnson 2013-10-30 16:31:54 -04:00
commit 735127be0b
9 changed files with 102 additions and 83 deletions

View File

@ -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)) {

View File

@ -43,7 +43,6 @@ sub process_request {
'help|h|?' => \$::opt_h,
'i|I=s' => \$::opt_I,
'verbose|V' => \$::opt_V,
'version|v' => \$::opt_v,
);
# Option -h for Help
@ -94,9 +93,9 @@ sub configfpc_usage {
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 ";
" configfpc -i interface \n ";
push @{ $rsp->{data} },
" configfpc [-V|--verbose] -i adapter_interface \n ";
" configfpc [-V|--verbose] -i interface \n ";
push @{ $rsp->{data} }, " configfpc [-h|--help|-?] \n";
xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK );
return 0;
@ -140,7 +139,7 @@ sub configfpc {
# 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";
push@{ $rsp{data} }, "Adding route definition for 192.168.0.101/16 to the $::interface network interface";
xCAT::MsgUtils->message( "I", \%rsp, $callback );
}
my $setroute = `ip addr add dev $::interface 192.168.0.101/16`;
@ -155,7 +154,7 @@ sub configfpc {
$foundfpc = 0;
my %rsp = {};
push@{ $rsp{data} }, "No nodes Found FPC with $fpcip address";
push@{ $rsp{data} }, "No default $fpcip IP addresses found";
xCAT::MsgUtils->message( "I", \%rsp, $callback );
exit; # EXIT if we find no more default IP addresses on the network
}
@ -163,14 +162,14 @@ sub configfpc {
# xCAT::MsgUtils->message ("I", "Found $fpcip FPC IP addresses to process");
if($::VERBOSE){
my %rsp = {};
push@{ $rsp{data} }, "Found FPC with $fpcip address";
push@{ $rsp{data} }, "Found $fpcip address";
xCAT::MsgUtils->message( "I", \%rsp, $callback );
}
$foundfpc = 1;
}
my $addnode = &add_node($defnode,$callback);
my $addnode = &add_node($defnode,$fpcip,$callback);
#
# Main loop - check to see if we found an FPC and continue to set the FPC infomration and look for the next one
@ -218,7 +217,8 @@ sub configfpc {
} else {
my %rsp;
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( "E", \%rsp, $callback );
$foundfpc = 0;
}
#
@ -231,16 +231,19 @@ sub configfpc {
}
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 FPCs with the default IP address to process";
xCAT::MsgUtils->message( "I", \%rsp, $callback );
$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 default IP address to process";
xCAT::MsgUtils->message( "I", \%rsp, $callback );
$foundfpc = 0;
}
else {
$foundfpc = 1;
}
}
}
@ -250,7 +253,7 @@ sub configfpc {
# 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";
push@{ $rsp{data} }, "Deleting route definition for 192.168.0.101/16 on interface $::interface";
xCAT::MsgUtils->message( "I", \%rsp, $callback );
}
my $setroute = `ip addr del dev $::interface 192.168.0.101/16`;
@ -343,7 +346,7 @@ sub set_FPC_network_parms {
# Set FPC Netmask
if($::VERBOSE){
my %rsp = {};
push@{ $rsp{data} }, "Use rspconfig to set the FPC netmask $netmask for node $defnode";
push@{ $rsp{data} }, "Use rspconfig to set the FPC netmask $netmask";
xCAT::MsgUtils->message( "I", \%rsp, $callback );
}
my $netmaskout = xCAT::Utils->runxcmd(
@ -355,7 +358,7 @@ sub set_FPC_network_parms {
$request, 0,1);
if ($::RUNCMD_RC != 0) {
my %rsp;
push@{ $rsp{data} }, "Could not change nemask $netmask on default FPC";
push@{ $rsp{data} }, "Could not change nemask $netmask";
xCAT::MsgUtils->message( "I", \%rsp, $callback );
$error++;
}
@ -375,7 +378,7 @@ sub set_FPC_network_parms {
$request, 0,1);
if ($::RUNCMD_RC != 0) {
my %rsp;
push@{ $rsp{data} }, "Could not change gateway $gateway on default FPC";
push@{ $rsp{data} }, "Could not change gateway $gateway";
xCAT::MsgUtils->message( "I", \%rsp, $callback );
$error++;
}
@ -419,9 +422,12 @@ sub get_node {
# extract the MAC address
my ($junk1, $junk2, $junk3, $fpcmac, $junk4, $junk5, $junk6) = split(" ", $arpout);
# set the FPC MAC as static for the arp table
my $arpout = `arp -s $fpcip $fpcmac`;
# Print a message that this MAC has been found
my %rsp;
push@{ $rsp{data} }, "Found FPC with default IP $fpcip and MAC $fpcmac";
push@{ $rsp{data} }, "Found IP $fpcip and MAC $fpcmac";
xCAT::MsgUtils->message( "I", \%rsp, $callback );
# Usee find_mac to 1) look for which switch port contains this MAC address
@ -432,7 +438,7 @@ sub get_node {
# verbose
if($::VERBOSE){
my %rsp = {};
push@{ $rsp{data} }, "Found FPC with MAC $fpcmac associated with node $node";
push@{ $rsp{data} }, "Found IP $fpcip with MAC $fpcmac associated with node $node";
xCAT::MsgUtils->message( "I", \%rsp, $callback );
}
@ -444,6 +450,7 @@ sub get_node {
#
sub add_node {
my $defnode = shift;
my $fpcip = shift;
my $callback = shift;
# add this node entry
# Object name: feihu-fpc
@ -466,8 +473,7 @@ sub add_node {
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'});
$ipmitab->setNodeAttribs($defnode, {bmc => $fpcip, username => 'USERID', password => 'PASSW0RD'});
return 0;
}

20
xCAT-server/lib/xcat/plugins/dhcp.pm Normal file → Executable file
View File

@ -868,6 +868,14 @@ sub check_options
return 1;
}
# check to see if -n is listed with any other options which is not allowed
if ($::opt_n and ($::opt_a || $::opt_d || $::opt_q || $::opt_r || $::opt_l || $statements)) {
my $rsp = {};
$rsp->{data}->[0] = "The -n option cannot be used with other options.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return 1;
}
unless (($req->{arg} and (@{$req->{arg}}>0)) or $req->{node})
{
my $rsp = {};
@ -1927,6 +1935,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";
@ -1943,6 +1956,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
}
}

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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