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

This commit is contained in:
Jarrod Johnson 2013-10-02 08:36:30 -04:00
commit c440e892da
13 changed files with 144 additions and 50 deletions

View File

@ -172,6 +172,7 @@ sub mknetboot
my $nodes = @{$req->{node}};
my @args = @{$req->{arg}} if(exists($req->{arg}));
my @nodes = @{$req->{node}};
my $noupdateinitrd = $req->{'noupdateinitrd'};
my $ostab = xCAT::Table->new('nodetype');
#my $sitetab = xCAT::Table->new('site');
my $linuximagetab;
@ -522,7 +523,7 @@ sub mknetboot
}
}
if ($docopy) {
if ($docopy && !$noupdateinitrd) {
mkpath("$tftppath");
if (-f "$rootimgdir/hypervisor") {
copy("$rootimgdir/hypervisor", "$tftppath");

View File

@ -138,7 +138,7 @@ sub process_request
} elsif (/ssh_dsa_hostkey/) {
if (-r "/etc/xcat/hostkeys/$client/ssh_host_dsa_key") {
$tfilename="/etc/xcat/hostkeys/$client/ssh_host_rsa_key";
$tfilename="/etc/xcat/hostkeys/$client/ssh_host_dsa_key";
} elsif (-r "/etc/xcat/hostkeys/ssh_host_dsa_key") {
$tfilename="/etc/xcat/hostkeys/ssh_host_dsa_key";
} else {

View File

@ -770,7 +770,7 @@ sub mkinstall
# . $node;
#} else
#{
my $kcmdline = "quiet auto url=http://"
my $kcmdline = "nofb utf8 auto url=http://"
. $instserver
. "/install/autoinst/"
. $node;
@ -831,7 +831,7 @@ sub mkinstall
#}
# need to add these in, otherwise aptitude will ask questions
$kcmdline .= " locale=en_US console-setup/layoutcode=us";
$kcmdline .= " locale=en_US";
#$kcmdline .= " netcfg/wireless_wep= netcfg/get_hostname= netcfg/get_domain=";
# default answers as much as possible, we don't want any interactiveness :)
@ -849,11 +849,16 @@ sub mkinstall
#$kcmdline .= " DEBCONF_DEBUG=5";
# I don't need the timeout for ubuntu, but for debian there is a problem with getting dhcp in a timely manner
$kcmdline .= " netcfg/dhcp_timeout=120";
# safer way to set hostname, avoid problems with nameservers
$kcmdline .= " hostname=".$node;
#from 12.10, the live install changed, so add the live-installer
if ( -r "$pkgdir/install/filesystem.squashfs")
{
$kcmdline .= " live-installer/net-image=http://${instserver}${pkgdir}/install/filesystem.squashfs";
}
$bptab->setNodeAttribs(
$node,
{

View File

@ -10,6 +10,7 @@ use xCAT::SvrUtils;
use xCAT::Table;
#use Data::Dumper;
use File::Path;
use File::Copy;
use Getopt::Long;
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("pass_through");
@ -169,6 +170,7 @@ sub process_request {
$otherpkglist = $ref_linuximage_tab->{'otherpkglist'};
$postinstall_filename = $ref_linuximage_tab->{'postinstall'};
$destdir = $ref_linuximage_tab->{'rootimgdir'};
$rootimg_dir = $ref_linuximage_tab->{'rootimgdir'};
$driverupdatesrc = $ref_linuximage_tab->{'driverupdatesrc'};
# TODO: how can we do if the user specifies one wrong value to the following attributes?
@ -363,6 +365,31 @@ sub process_request {
# print FILE "\n";
#}
#close FILE;
# update the generated initrd to /tftpboot/xcat so that don't need to rerun nodeset to update them
if (($::RUNCMD_RC == 0) && $imagename) {
my $tftpdir = "/tftpboot";
my @siteents = xCAT::TableUtils->get_site_attribute("tftpdir");
if ($#siteents >= 0)
{
$tftpdir = $siteents[0];
}
my $tftppath = "$tftpdir/xcat/osimage/$imagename";
my $installdir = "/install";
@siteents = xCAT::TableUtils->get_site_attribute("installdir");
if ($#siteents >= 0)
{
$installdir = $siteents[0];
}
unless (-d $tftppath) {
mkpath $tftppath;
}
copy("$rootimg_dir/initrd-stateless.gz", "$tftppath");
copy("$rootimg_dir/initrd-statelite.gz", "$tftppath");
copy("$rootimg_dir/kernel", "$tftppath");
}
#parse the output and save the image data to osimage and linuximage table
save_image_data($callback, $doreq, $tempfile);

View File

@ -5489,6 +5489,57 @@ sub sensor_was_read {
if (@exparts) {
$extext = join(",",@exparts);
}
} elsif ($sdr->sensor_type == 0x28) {
if ($exdata1 & 1) {
push @exparts,"Degraded or unavailable";
}
if ($exdata1 & 1<<1) {
push @exparts,"Degraded or unavailable";
}
if ($exdata1 & 1<<2) {
push @exparts,"Offline";
}
if ($exdata1 & 1<<3) {
push @exparts,"Unavailable";
}
if ($exdata1 & 1<<4) {
push @exparts,"Failure";
}
if ($exdata1 & 1<<5) {
push @exparts,"FRU Failure";
}
} elsif ($sdr->sensor_type == 0x2b) {
if ($exdata1 & 1) {
push @exparts,"Change detected";
}
if ($exdata1 & 1<<1) {
push @exparts,"Firmware change detected";
}
if ($exdata1 & 1<<2) {
push @exparts,"Hardware incompatibility detected";
}
if ($exdata1 & 1<<3) {
push @exparts,"Firmware incompatibility detected";
}
if ($exdata1 & 1<<4) {
push @exparts,"Unsupported hardware version";
}
if ($exdata1 & 1<<5) {
push @exparts,"Unsupported firmware verion";
}
if ($exdata1 & 1<<6) {
push @exparts,"Hardware change successful";
}
if ($exdata1 & 1<<7) {
push @exparts,"Firmware change successful";
}
} elsif ($sdr->sensor_type == 0x1b) {
if ($exdata1 & 1) {
push @exparts,"Cable connected";
}
if ($exdata1 & 1<<1) {
push @exparts,"Incorrect cable connection";
}
} else {
$extext = "xCAT needs to add support for ".$sdr->sensor_type;
}

View File

@ -56,6 +56,7 @@ sub mknetboot
my $globaltftpdir = "/tftpboot";
my $nodes = @{$req->{node}};
my @nodes = @{$req->{node}};
my $noupdateinitrd = $req->{'noupdateinitrd'};
my $ostab = xCAT::Table->new('nodetype');
#my $sitetab = xCAT::Table->new('site');
my $linuximagetab;
@ -405,7 +406,7 @@ sub mknetboot
}
}
if ($docopy) {
if ($docopy && !$noupdateinitrd) {
mkpath("$tftppath");
copy("$rootimgdir/kernel", "$tftppath");
if ($statelite) {

View File

@ -41,6 +41,7 @@ if [ -z "$instdisk" ]; then
fi
fi
if [ ! -z "$instdisk" ]; then debconf-set partman-auto/disk "$instdisk"; fi
debconf-get open-iscsi/targets > /tmp/q
sleep 0.1
done &

View File

@ -5,14 +5,14 @@ d-i localechooser/supported-locales multiselect en_US.UTF-8
# Keyboard Selection
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string en
d-i keyboard-configuration/layoutcode string en
### Network Configuration
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/wireless_wep string
d-i netcfg/dhcp_timeout string 120
### Mirror settings
# If you select ftp, the mirror/country string does not need to be set.

View File

@ -5,14 +5,14 @@ d-i localechooser/supported-locales multiselect en_US.UTF-8
# Keyboard Selection
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string en
d-i keyboard-configuration/layoutcode string en
### Network Configuration
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/wireless_wep string
d-i netcfg/dhcp_timeout string 120
### Mirror settings
# If you select ftp, the mirror/country string does not need to be set.

View File

@ -174,15 +174,13 @@ if ($netdriver) {
}
}
# Use the default list if not specified
unless (@ndrivers) {
if ($arch eq 'x86' or $arch eq 'x86_64') {
@ndrivers = qw/tg3 bnx2 bnx2x e1000 e1000e igb mlx_en virtio_net be2net/;
} elsif ($arch eq 'ppc64') {
@ndrivers = qw/e1000 e1000e igb ibmveth ehea/;
} elsif ($arch eq 's390x') {
@ndrivers = qw/qdio ccwgroup/;
}
# Add the default driver list
if ($arch eq 'x86' or $arch eq 'x86_64') {
push @ndrivers, qw/tg3 bnx2 bnx2x e1000 e1000e igb mlx_en virtio_net be2net/;
} elsif ($arch eq 'ppc64') {
push @ndrivers, qw/e1000 e1000e igb ibmveth ehea/;
} elsif ($arch eq 's390x') {
push @ndrivers, qw/qdio ccwgroup/;
}
foreach (@ndrivers) {
@ -491,10 +489,6 @@ foreach my $dd (@dd_drivers) {
print "Added driver $dd from driver update disk or driver rpm\n";
}
foreach my $driver (@ndrivers) {
print "Added driver $driver from root image\n";
}
if (@new_order) {
@ndrivers = (@new_order, @ndrivers);
}
@ -514,14 +508,24 @@ while (scalar @checkdeps) {
foreach $dep (@deps) {
$dep =~ s/.*\///;
unless (grep { $_ eq $dep } @ndrivers) { #only add if not added
unshift (@checkdeps,$dep); #recursively check dependencies
unshift (@ndrivers,$dep);
print "Added $dep as an autodetected depedency\n";
}
unshift (@checkdeps,$dep); #recursively check dependencies
unshift (@ndrivers,$dep);
}
}
}
close($moddeps);
#remove the duplicated drivers
my @fulldrivers;
foreach my $dn (@ndrivers) {
unless (grep {$_ eq $dn} @fulldrivers) {
push @fulldrivers, $dn;
}
}
@ndrivers = @fulldrivers;
unlink "/tmp/genimage.$$.yum.conf";
if (-d "$rootimg_dir/usr/share/dracut") {
$dracutmode = 1;
@ -770,7 +774,17 @@ sub mkinitrd_dracut {
# Add drivers to support local disk
push @ndrivers, "ext3";
push @ndrivers, "ext4";
#remove the duplicated drivers
my @fulldrivers;
foreach my $dn (@ndrivers) {
unless (grep {$_ eq $dn} @fulldrivers) {
push @fulldrivers, $dn;
}
}
@ndrivers = @fulldrivers;
my $add_drivers = join(' ', @ndrivers);
print "Try to load drivers: $add_drivers to initrd.\n";
my $DRACUTCONF;
if ($mode eq "statelite") {
@ -1529,6 +1543,7 @@ sub isnetdriver {
my $filetoadd = $File::Find::name;
$filetoadd =~ s!$rootimg_dir/!!;
push @filestoadd,[$filetoadd,"lib/$_"];
print "Added driver $_ to initrd\n";
}
}
}
@ -1889,7 +1904,7 @@ sub load_dd ()
system ("cp -rf $real_path $rootimg_dir$1");
push @rpm_drivers, $driver;
} else {
print "Error: cannot find the driver $driver from the driver rpms\n";
print "Warning: cannot find the driver $driver from the driver rpms\n";
}
}
} elsif ($Injectalldriver) {

View File

@ -173,15 +173,13 @@ if ($netdriver) {
}
}
# Use the default list if not specified
unless (@ndrivers) {
if ($arch eq 'x86' or $arch eq 'x86_64') {
@ndrivers = qw/tg3 bnx2 bnx2x e1000 e1000e igb mlx_en be2net/;
} elsif ($arch eq 'ppc64') {
@ndrivers = qw/tg3 e1000 e1000e igb ibmveth ehea be2net/;
} elsif ($arch eq "s390x") {
@ndrivers = qw/qdio ccwgroup qeth qeth_l2 qeth_l3/;
}
# Add the default driver list
if ($arch eq 'x86' or $arch eq 'x86_64') {
push @ndrivers, qw/tg3 bnx2 bnx2x e1000 e1000e igb mlx_en be2net/;
} elsif ($arch eq 'ppc64') {
push @ndrivers, qw/tg3 e1000 e1000e igb ibmveth ehea be2net/;
} elsif ($arch eq "s390x") {
push @ndrivers, qw/qdio ccwgroup qeth qeth_l2 qeth_l3/;
}
foreach (@ndrivers) {
@ -785,10 +783,6 @@ foreach my $dd (@dd_drivers) {
print "Added driver $dd from driver update disk or driver rpm\n";
}
foreach my $driver (@ndrivers) {
print "Added driver $driver from root image\n";
}
if (@new_order) {
@ndrivers = (@new_order, @ndrivers);
}
@ -1563,7 +1557,7 @@ EOMS
print "The initial ramdisk for statelite has been generated successfully!\n";
} else {
system("cd /tmp/xcatinitrd.$$;find .|cpio -H newc -o|gzip -9 -c - > $destdir/initrd-stateless.gz");
print "The initial ramdisk for statelite has been generated successfully!\n";
print "The initial ramdisk for stateless has been generated successfully!\n";
}
system("rm -rf /tmp/xcatinitrd.$$");
@ -1583,6 +1577,7 @@ sub isnetdriver {
my $filetoadd = $File::Find::name;
$filetoadd =~ s!$rootimg_dir!!;
push @filestoadd,[$filetoadd,"lib/$_"];
print "Added driver $_ to initrd\n";
}
}
}
@ -2001,7 +1996,7 @@ sub load_dd()
system ("cp -rf $real_path $rootimg_dir$1");
push @rpm_drivers, $driver;
} else {
print "Error: cannot find the driver $driver from the driver rpms\n";
print "Warning: cannot find the driver $driver from the driver rpms\n";
}
}
} elsif ($Injectalldriver) {

View File

@ -203,7 +203,7 @@ do
echo "confignics on $NODE: processing custom scripts: ${array_temp[3]} for interface $key"
${array_temp[3]}
else
if [ -n "${array_temp[2]}" ];then
if [ -z "${array_temp[2]}" ];then
logger -t xcat -p local4.info "confignics: ip address,nic type and network are required. $key: $str_value ."
echo "confignics on $NODE: ip address,nic type and network are required. $key: $str_value ."
continue

View File

@ -5,22 +5,21 @@
# It is called by xcatdsklspost before calling getpostscripts.awk
# it is called by remoteshell before calling getcredentials.awk
#
exec {REMOTEFD}<>/dev/udp/$1/$2
echo "resourcerequest: xcatd" >&$REMOTEFD
exec 50<>/dev/udp/$1/$2
echo "resourcerequest: xcatd" >&50
parpid=$$
touch /tmp/goahead.$parpid
touch /tmp/killme.$parpid
exec 2> /dev/null
while ! grep 'resourcerequest: ok' /tmp/goahead.$parpid > /dev/null; do
(
echo "resourcerequest: xcatd" >&$REMOTEFD
exec {LOCALFD}<>/proc/self/stat
read mystat<&$LOCALFD
echo "resourcerequest: xcatd" >&50
exec 51<>/proc/self/stat
read mystat<&51
mypid=$(echo $mystat|cut -d " " -f 4)
(sleep $(((RANDOM%60)+120)).$((RANDOM%50)); if [ -f /tmp/killme.$parpid ]; then kill -TERM $mypid; fi) &
echo $! > /tmp/sleeperpid.$parpid
exec awk '{print $0 > "/tmp/goahead.'$parpid'";exit}' <&$REMOTEFD
exec {LOCALFD}>&-
exec awk '{print $0 > "/tmp/goahead.'$parpid'";exit}' <&50
)
done
sleeper=$(cat /tmp/sleeperpid.$parpid)
@ -28,5 +27,4 @@ sleeper=$(ps -ef|awk "\$3==$sleeper"|awk '{print $2}')
rm /tmp/goahead.$parpid
rm /tmp/sleeperpid.$parpid
rm /tmp/killme.$parpid
exec {REMOTEFD}>&-
kill -TERM $sleeper