Update buildcore.sh to reflect xCATsn

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@813 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2008-03-18 20:02:53 +00:00
parent 67385332c2
commit 6828430247
4 changed files with 110 additions and 35 deletions

View File

@ -55,7 +55,17 @@ if $GREP xCAT-nbroot ../coresvnup; then
mv /usr/src/$pkg/SRPMS/xCAT-nbroot-core-*rpm $SRCDIR
cd ..
fi
if $GREP "U xCAT/" ../coresvnup; then
if $GREP "U xCATsn/" ../coresvnup || $GREP "A xCATsn/" ../coresvnup; then
UPLOAD=1
cd xCATsn
./mkrpm
rm -f $DESTDIR/xCATsn-2.0*rpm
rm -f $SRCDIR/xCATsn-2.0*rpm
mv /usr/src/$pkg/RPMS/*/xCATsn-2*rpm $DESTDIR
mv /usr/src/$pkg/SRPMS/xCATsn-2*rpm $SRCDIR
cd ..
fi
if $GREP "U xCAT/" ../coresvnup || $GREP "A xCAT/" ../coresvnup; then
UPLOAD=1
cd xCAT
./mkrpm
@ -72,9 +82,10 @@ fi
createrepo $DESTDIR
createrepo $SRCDIR
cd $DESTDIR/..
export CFNAME=core-rpms-snap.`date +%Y.%m.%d`.tar.bz2
export DFNAME=dep-rpms-snap.`date +%Y.%m.%d`.tar.bz2
tar jcvf $CFNAME core-snap
export CFNAME=core-rpms-snap.tar.bz2
export DFNAME=dep-rpms-snap.tar.bz2
#tar jcvf $DFNAME dep-snap
scp $CFNAME jbjohnso@shell1.sf.net:/home/groups/x/xc/xcat/htdocs/yum/
ssh jbjohnso@shell1.sf.net "cd /home/groups/x/xc/xcat/htdocs/yum/; rm -rf core-snap; tar jxvf $CFNAME"
#scp $CFNAME jbjohnso@shell1.sf.net:/home/groups/x/xc/xcat/htdocs/yum/
rsync -av --delete core-snap jbjohnso@shell1.sf.net:/home/groups/x/xc/xcat/htdocs/yum/
ssh jbjohnso@shell1.sf.net "cd /home/groups/x/xc/xcat/htdocs/yum; tar jcvf $CFNAME core-snap"
#ssh jbjohnso@shell1.sf.net "cd /home/groups/x/xc/xcat/htdocs/yum/; rm -rf core-snap; tar jxvf $CFNAME"

View File

@ -8,6 +8,7 @@ fi
cd `dirname $0`
tar --exclude .svn -czvf xcat-nbrootoverlay.tar.gz -C overlay/ .
mv -f *.gz /usr/src/$pkg/SOURCES
cp LICENSE.html /usr/src/$pkg/BUILD
cp xcat-core-nbroot.spec /usr/src/$pkg/SOURCES
rpmbuild -ba xcat-core-nbroot.spec --target $1
cd -

View File

@ -260,7 +260,7 @@ sub getdestiny {
$ref->{currstate} = shift @chain;
$chaintab->setNodeAttribs($node,{currstate=>$ref->{currstate}});
}
my $noderestab = xCAT::Table->new('noderes'); #In case client decides to download images, get data out to it
my $noderestab = xCAT::Table->new('noderes',-create=>1); #In case client decides to download images, get data out to it
my %response;
$response{name}=[$node];
$response{data}=[$ref->{currstate}];

View File

@ -2,7 +2,9 @@ package xCAT_plugin::nodestat;
use Socket;
use IO::Handle;
use Storable qw/freeze thaw/;
my $stat;
my $children;
sub handled_commands {
return {
@ -65,37 +67,98 @@ sub process_request {
my $doreq = shift;
my @nodes = @{$request->{node}};
my $node;
my $child_handles = new IO::Select;
$children=0;
$SIG{CHLD} = sub {while (waitpid(-1, WNOHANG) > 0) { $children--; }};
foreach $node (@nodes) {
my %rsp;
my $text="";
$rsp{name}=[$node];
unless (pinghost($node)) {
$rsp{data} = [ 'noping' ];
$callback->({node=>[\%rsp]});
next;
}
if (nodesockopen($node,15002)) {
$rsp{data} = [ 'pbs' ];
$callback->({node=>[\%rsp]});
next;
} elsif (nodesockopen($node,22)) {
$rsp{data} = [ 'sshd' ];
$callback->({node=>[\%rsp]});
next;
} elsif ($text = installer_query($node)) {
$rsp{data} = [ $text ];
$callback->({node=>[\%rsp]});
next;
} else {
$doreq->({command=>['nodeset'],
node=>[$node],
arg=>['stat']},
\&getstat);
$rsp{data} = [ 'ping '.$stat ];
$callback->({node=>[\%rsp]});
next;
my $parent;
my $childfd;
undef ($parent);
undef ($childfd);
socketpair($childfd,$parent,AF_UNIX,SOCK_STREAM,PF_UNSPEC) or die "socketpair: $!";
my $child;
$child = xCAT::Utils->xfork;
unless (defined $child) { die "Fork failure"; }
if ($child==0) { #This is the child
close($childfd);
undef $SIG{CHLD};
my %rsp;
my $text="";
$rsp{name}=[$node];
unless (pinghost($node)) {
$rsp{data} = [ 'noping' ];
$callback->({node=>[\%rsp]});
next;
}
if (nodesockopen($node,15002)) {
$rsp{data} = [ 'pbs' ];
print $parent freeze({node=>[\%rsp]})
} elsif (nodesockopen($node,22)) {
$rsp{data} = [ 'sshd' ];
print "$node is sshd\n";
print $parent freeze({node=>[\%rsp]});
} elsif ($text = installer_query($node)) {
$rsp{data} = [ $text ];
print $parent freeze({node=>[\%rsp]});
} else {
$doreq->({command=>['nodeset'],
node=>[$node],
arg=>['stat']},
\&getstat);
$rsp{data} = [ 'ping '.$stat ];
print $parent freeze({node=>[\%rsp]});
}
print $parent "\nENDOFFREEZEx3a93\n";
$parent->flush;
print "Wait for $node ack...\n";
<$parent>;
print "$node acked...\n";
close($parent);
exit 0;
}
close($parent);
$children++;
$child_handles->add($childfd);
}
print "wait for kids\n";
while ($children) {
relay_responses($child_handles,$callback);
}
print "kids gone\n";
while (relay_responses($child_handles,$callback)) {}
print "out i go\n";
}
sub relay_responses {
my $fhs = shift;
my $callback = shift;
my @handles = $fhs->can_read(0.2);
foreach my $input (@handles) {
print "I can haz input\n";
my $data;
$data = "";
print "here\n";
if ($data = <$input>) {
print $data;
while ($data !~ /ENDOFFREEZEx3a93/) { #<$input>) {
$data .= <$input>;
}
my $response = thaw($data);
print "fin issued\n";
print $input "fin\n";
$input->flush;
$callback->($response);
} else {
print "not here....\n";
$fhs->remove($input);
close($input);
}
}
return scalar(@handles);
}
1;