Provide enhanced iSCSI support for the opportunity for more seamless operation
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@280 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
36a754d5eb
commit
decc71ac21
@ -45,6 +45,8 @@ sub writescript {
|
||||
}
|
||||
print $script "MASTER=".$master."\n";
|
||||
print $script "export MASTER\n";
|
||||
print $script "NODE=$node\n";
|
||||
print $script "export NODE\n";
|
||||
my $et = $typetab->getNodeAttribs($node,['os','arch']);
|
||||
unless ($et and $et->{'os'} and $et->{'arch'}) {
|
||||
die "No os/arch setting in nodetype table for $node";
|
||||
|
@ -189,6 +189,9 @@ ALL {
|
||||
updateflag.awk $MASTER 3002
|
||||
}
|
||||
|
||||
NODERANGE=iscsi {
|
||||
uploadboot
|
||||
}
|
||||
# hardcode networking
|
||||
#OSVER=sl[34].* or OSVER=centos.* or OSVER=rh.* or OSVER=sles.* or OSVER=suse.* {
|
||||
# hardnis
|
||||
|
@ -6,6 +6,7 @@ BEGIN
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use xCAT::Utils;
|
||||
use File::Path;
|
||||
|
||||
use IO::Socket::SSL;
|
||||
if (xCAT::Utils->isLinux()) {
|
||||
@ -135,6 +136,7 @@ if (xCAT::Utils->isLinux()) {
|
||||
close($conn);
|
||||
next;
|
||||
}
|
||||
my $tftpdir = "/tftpboot/";
|
||||
eval {
|
||||
alarm(2);
|
||||
print $conn "ready\n";
|
||||
@ -154,7 +156,40 @@ if (xCAT::Utils->isLinux()) {
|
||||
plugin_command(\%request,undef,\&convey_response);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
} elsif ($text =~ /^unlocktftpdir/) { #TODO: only nodes in install state should be allowed
|
||||
close($conn);
|
||||
mkpath("$tftpdir/xcat/$node");
|
||||
chmod 01777,"$tftpdir/xcat/$node";
|
||||
chmod 0666,glob("$tftpdir/xcat/$node/*");
|
||||
} elsif ($text =~ /locktftpdir/) {
|
||||
chmod 0755,"$tftpdir/xcat/$node";
|
||||
chmod 0644,glob("$tftpdir/xcat/$node/*");
|
||||
} elsif ($text =~ /^setnetboot/) {
|
||||
$text =~ s/^setnetboot\s+//;
|
||||
my $kname;
|
||||
my $iname;
|
||||
my $kcmdline;
|
||||
($kname,$iname,$kcmdline) = split(/\s+/,$text,3);
|
||||
chomp($kcmdline);
|
||||
my $noderestab = xCAT::Table->new('noderes',-create=>1);
|
||||
$noderestab->setNodeAttribs($node,{kernel=>"xcat/$node/$kname",initrd=>"xcat/$node/$iname",kcmdline=>$kcmdline});
|
||||
my $chaintab = xCAT::Table->new('chain',-create=>1);
|
||||
$chaintab->setNodeAttribs($node,{currstate=>'netboot',currchain=>'netboot'});
|
||||
$noderestab->close;
|
||||
$chaintab->close;
|
||||
undef $noderestab;
|
||||
undef $chaintab;
|
||||
my %request = (
|
||||
command => [ 'nodeset' ],
|
||||
node => [ $node ],
|
||||
arg => [ 'enact' ],
|
||||
);
|
||||
my $pid=fork();
|
||||
unless ($pid) { #fork off the nodeset and potential slowness
|
||||
plugin_command(\%request,undef,\&convey_response);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
alarm(2);
|
||||
}
|
||||
alarm(0);
|
||||
|
@ -39,7 +39,6 @@ iscsi --ipaddr #TABLE:iscsi:$NODE:server# --user "#TABLE:iscsi:$NODE:userid#" --
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
part None --fstype "PPC PReP Boot" --size 8
|
||||
part /boot --size 50 --fstype ext3
|
||||
part swap --size 1024
|
||||
part / --size 1 --grow --fstype ext3
|
||||
|
||||
#RAID 0 /scr for performance
|
||||
|
@ -38,7 +38,6 @@ iscsi --ipaddr #TABLE:iscsi:$NODE:server# --user "#TABLE:iscsi:$NODE:userid#" --
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
part swap --size 1024
|
||||
part / --size 1 --grow --fstype ext3
|
||||
|
||||
#RAID 0 /scr for performance
|
||||
|
@ -39,7 +39,6 @@ iscsi --ipaddr #TABLE:iscsi:$NODE:server# --user "#TABLE:iscsi:$NODE:userid#" --
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
part None --fstype "PPC PReP Boot" --size 8
|
||||
part /boot --size 50 --fstype ext3
|
||||
part swap --size 1024
|
||||
part / --size 1 --grow --fstype ext3
|
||||
|
||||
#RAID 0 /scr for performance
|
||||
|
@ -38,7 +38,6 @@ iscsi --ipaddr #TABLE:iscsi:$NODE:server# --user "#TABLE:iscsi:$NODE:userid#" --
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
part swap --size 1024
|
||||
part / --size 1 --grow --fstype ext3
|
||||
|
||||
#RAID 0 /scr for performance
|
||||
|
20
xCAT/postscripts/locktftpdir.awk
Executable file
20
xCAT/postscripts/locktftpdir.awk
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/awk -f
|
||||
BEGIN {
|
||||
xcatdhost = ARGV[1]
|
||||
xcatdport = ARGV[2]
|
||||
|
||||
ns = "/inet/tcp/0/" ARGV[1] "/" xcatdport
|
||||
|
||||
while(1) {
|
||||
if((ns |& getline) > 0)
|
||||
print $0 | "logger -t xcat"
|
||||
|
||||
if($0 == "ready")
|
||||
print "locktftpdir" |& ns
|
||||
if($0 == "done")
|
||||
break
|
||||
}
|
||||
close(ns)
|
||||
|
||||
exit 0
|
||||
}
|
21
xCAT/postscripts/setnetboot.awk
Executable file
21
xCAT/postscripts/setnetboot.awk
Executable file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/awk -f
|
||||
BEGIN {
|
||||
xcatdhost = ARGV[1]
|
||||
xcatdport = ARGV[2]
|
||||
kernel = ARGV[3]
|
||||
initrd = ARGV[4]
|
||||
kcmd = ARGV[5]
|
||||
ns = "/inet/tcp/0/" ARGV[1] "/" xcatdport
|
||||
|
||||
while(1) {
|
||||
if((ns |& getline) > 0)
|
||||
print $0 | "logger -t xcat"
|
||||
|
||||
if($0 == "ready")
|
||||
print "setnetboot "kernel" "initrd" "kcmd |& ns
|
||||
if($0 == "done")
|
||||
break
|
||||
}
|
||||
close(ns)
|
||||
exit 0
|
||||
}
|
20
xCAT/postscripts/unlocktftpdir.awk
Executable file
20
xCAT/postscripts/unlocktftpdir.awk
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/awk -f
|
||||
BEGIN {
|
||||
xcatdhost = ARGV[1]
|
||||
xcatdport = ARGV[2]
|
||||
|
||||
ns = "/inet/tcp/0/" ARGV[1] "/" xcatdport
|
||||
|
||||
while(1) {
|
||||
if((ns |& getline) > 0)
|
||||
print $0 | "logger -t xcat"
|
||||
|
||||
if($0 == "ready")
|
||||
print "unlocktftpdir" |& ns
|
||||
if($0 == "done")
|
||||
break
|
||||
}
|
||||
close(ns)
|
||||
|
||||
exit 0
|
||||
}
|
28
xCAT/postscripts/uploadboot
Executable file
28
xCAT/postscripts/uploadboot
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
if [ -r /boot/etc/yaboot.conf ]; then
|
||||
KNAME=`grep ^image /boot/etc/yaboot.conf|head -n 1|cut -d= -f 2|sed -e 's!^/!!'`
|
||||
KERNEL=/boot/$KNAME
|
||||
KERNEL=`echo $KERNEL|sed -e 's!//!/!g'`
|
||||
INAME=`grep initrd /boot/etc/yaboot.conf|head -n 1|cut -d= -f 2|sed -e 's!^/!!'`
|
||||
INITRD=/boot/$INAME
|
||||
INITRD=`echo $INITRD|sed -e 's!//!/!g'`
|
||||
KCMDLINE=`grep append= /boot/etc/yaboot.conf|head -n 1|cut -d= -f 2-`
|
||||
KCMDLINE=`echo $KCMDLINE|sed -e 's! rhgb!!'|sed -e 's!"!!g'`
|
||||
elif [ -r /boot/grub/menu.lst ]; then
|
||||
KNAME=`grep -v ^# /boot/grub/menu.lst|grep -v title|grep kernel|cut -d' ' -f 2|sed -e 's!/boot/!!'`
|
||||
KERNEL=/boot/$KNAME
|
||||
KCMDLINE=`grep -v ^# /boot/grub/menu.lst|grep -v title|grep kernel|cut -d' ' -f 3-|sed -e 's! rhgb!!'`
|
||||
INAME=`grep -v ^# /boot/grub/menu.lst|grep -v title|grep initrd|cut -d' ' -f 2|sed -e 's!/boot/!!'`
|
||||
INITRD=/boot/$INAME
|
||||
INITRD=`echo $INITRD|sed -e 's!//!/!g'`
|
||||
|
||||
fi
|
||||
mkdir /servboot
|
||||
`dirname $0`/unlocktftpdir.awk $MASTER 3002
|
||||
mount -o nolock $MASTER:/tftpboot/xcat/$NODE /servboot
|
||||
cp $KERNEL /servboot/$KNAME
|
||||
cp $INITRD /servboot/$INAME
|
||||
umount /servboot
|
||||
`dirname $0`/locktftpdir.awk $MASTER 3002
|
||||
rmdir /servboot
|
||||
`dirname $0`/setnetboot.awk $MASTER 3002 $KNAME $INAME "$KCMDLINE"
|
@ -66,6 +66,9 @@ if [ "$1" = "1" ]; then #Only if installing for the fist time..
|
||||
cp /root/.ssh/id_rsa.pub /install/postscripts/.ssh/authorized_keys
|
||||
|
||||
mkdir -p /var/log/consoles
|
||||
if ! grep /tftpboot /etc/exports; then
|
||||
echo '/tftpboot *(rw,root_squash,sync)' >> /etc/exports #SECURITY: this has potential for sharing private host/user keys
|
||||
fi
|
||||
if ! grep /install /etc/exports; then
|
||||
echo '/install *(ro,no_root_squash,sync)' >> /etc/exports #SECURITY: this has potential for sharing private host/user keys
|
||||
service nfs restart
|
||||
|
Loading…
Reference in New Issue
Block a user