-Change name for booting to iscsi device to iscsiboot from netboot

-Save the singular set of kernel/initrd/command line arguments when switching away from iscsi to, say, shell
-Add implicit imgserver to destiny, assume the management node if nothing else specified
-Reorder tftp boot directory hosting iscsi bootstrap, avoid race condition
-Change wcons to a perl script in preparation for more sophisticated operation/syntax
-Schema changes to iscsi table, place the vlan column after port to reflect relative importance to user


git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@420 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2008-02-07 21:48:21 +00:00
parent 4124788d7f
commit b271ec7039
5 changed files with 71 additions and 19 deletions

View File

@ -31,7 +31,7 @@ package xCAT::Schema;
keys => [qw(node)],
},
iscsi => {
cols => [qw(node server target file userid passwd comments disable)],
cols => [qw(node server target file userid passwd kernel kcmdline initrd comments disable)],
keys => [qw(node)],
},
vpd => {
@ -79,7 +79,7 @@ package xCAT::Schema;
keys => [qw(groupname)]
},
switch => {
cols => [qw(node switch vlan port comments disable)],
cols => [qw(node switch port vlan comments disable)],
keys => [qw(node switch port)]
},
nodelist => {

View File

@ -1,12 +1,41 @@
#!/bin/sh
#!/usr/bin/env perl
#A placeholder wcons, a fuller port from 1.3 is needed
if [ -z "$DISPLAY" ]; then
echo '$DISPLAY not set'
exit 1
fi
NODES=`nodels $1`
MYDIR=`dirname $0`
for n in $NODES
do
xterm -rv -name wcons -T $n -n $n -e $MYDIR/rcons $n &
done
use Getopt::Long qw(:config getopt_compat);
use File::Basename;
use Data::Dumper;
unless ($ENV{DISPLAY}) {
print '$DISPLAY not set';
exit 1;
}
my $mydir = dirname($0);
my $sb;
my $tilefact;
my $font;
GetOptions(
'sb' => \$sb,
'tile|t:i' => \$tilefact,
'font|f=s' => \$font
);
my $nodes=`nodels $ARGV[0]`;
my @nodes = split /\n/,$nodes;
my $firstnode = shift @nodes;
if (defined($tilefact)) {
system("xterm -name $firstnode -title $firstnode -n $firstnode -geometry +0+0 -e $mydir/rcons $firstnode &");
sleep(1);
my $xinfo = `xwininfo -name $firstnode`
} else {
system("xterm -name $firstnode -title $firstnode -n $firstnode -e $mydir/rcons $firstnode &");
}
foreach (@nodes) {
system("xterm -name $_ -title $_ -n $_ -e $mydir/rcons $_ &");
}
#print Dumper(\@ARGV);
#MYDIR=`dirname $0`
#for n in $NODES
#do
# xterm -name wcons -T $n -n $n -e $MYDIR/rcons $n &
#done

View File

@ -2,6 +2,7 @@
package xCAT_plugin::destiny;
use xCAT::NodeRange;
use Data::Dumper;
use xCAT::Utils;
use Sys::Syslog;
use strict;
@ -48,6 +49,24 @@ sub setdestiny {
my %nstates;
if ($state eq "next") {
return nextdestiny();
} elsif ($state eq "iscsiboot") {
my $iscsitab=xCAT::Table->new('iscsi');
unless ($iscsitab) {
$callback->({error=>"Unable to open iscsi table to get iscsiboot parameters",errorcode=>[1]});
}
my $noderestab = xCAT::Table->new('noderes');
foreach (@{$req->{node}}) {
my $ient = $iscsitab->getNodeAttribs($_,[qw(kernel kcmdline initrd)]);
unless ($ient and $ient->{kernel}) {
$callback->({error=>"$_: No iscsi boot data available",errorcode=>[1]});
next;
}
my $hash;
$hash->{kernel} = $ient->{kernel};
if ($ient->{initrd}) { $hash->{initrd} = $ient->{initrd} }
if ($ient->{kcmdline}) { $hash->{kcmdline} = $ient->{kcmdline} }
$noderestab->setNodeAttribs($_,$hash);
}
} elsif ($state =~ /^install$/ or $state eq "install" or $state eq "netboot") {
chomp($state);
$subreq->({command=>["mk$state"],
@ -255,6 +274,8 @@ sub getdestiny {
$response{imgserver}=$nrent->{xcatmaster};
} elsif (defined($sent->{value})) {
$response{imgserver}=$sent->{value};
} else {
$response{imgserver} = xCAT::Utils->my_ip_facing($node);
}
$callback->({node=>[\%response]});

View File

@ -165,15 +165,15 @@ if (xCAT::Utils->isLinux()) {
# exit(0);
#}
} elsif ($text =~ /^unlocktftpdir/) { #TODO: only nodes in install state should be allowed
close($conn);
mkpath("$tftpdir/xcat/$node");
mkpath("$tftpdir/xcat/$node");
chmod 01777,"$tftpdir/xcat/$node";
chmod 0666,glob("$tftpdir/xcat/$node/*");
close($conn);
} elsif ($text =~ /locktftpdir/) {
chmod 0755,"$tftpdir/xcat/$node";
chmod 0644,glob("$tftpdir/xcat/$node/*");
} elsif ($text =~ /^setnetboot/) {
$text =~ s/^setnetboot\s+//;
} elsif ($text =~ /^setiscsiparms/) {
$text =~ s/^setiscsiparms\s+//;
my $kname;
my $iname;
my $kcmdline;
@ -181,8 +181,10 @@ if (xCAT::Utils->isLinux()) {
chomp($kcmdline);
my $noderestab = xCAT::Table->new('noderes',-create=>1);
$noderestab->setNodeAttribs($node,{kernel=>"xcat/$node/$kname",initrd=>"xcat/$node/$iname",kcmdline=>$kcmdline});
my $iscsitab = xCAT::Table->new('iscsi',-create=>1);
$iscsitab->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'});
$chaintab->setNodeAttribs($node,{currstate=>'iscsiboot',currchain=>'netboot'});
$noderestab->close;
$chaintab->close;
undef $noderestab;

View File

@ -25,4 +25,4 @@ cp $INITRD /servboot/$INAME
umount /servboot
`dirname $0`/locktftpdir.awk $MASTER 3002
rmdir /servboot
`dirname $0`/setnetboot.awk $MASTER 3002 $KNAME $INAME "$KCMDLINE"
`dirname $0`/setiscsiparms.awk $MASTER 3002 $KNAME $INAME "$KCMDLINE"