more support for statelite
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5240 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
00f454c14c
commit
2d909fef9d
@ -266,7 +266,7 @@ sub makescript {
|
||||
#get packge names for extra rpms
|
||||
my $otherpkgdir;
|
||||
my $pkglist;
|
||||
if (($^O =~ /^linux/i) && ($provmethod) && ( $provmethod ne "install") && ($provmethod ne "netboot")) {
|
||||
if (($^O =~ /^linux/i) && ($provmethod) && ( $provmethod ne "install") && ($provmethod ne "netboot") && ($provmethod ne "statelite")) {
|
||||
#this is the case where image from the osimage table is used
|
||||
my $linuximagetab=xCAT::Table->new('linuximage', -create=>1);
|
||||
(my $ref1) = $linuximagetab->getAttribs({imagename => $provmethod}, 'otherpkglist', 'otherpkgdir');
|
||||
@ -331,7 +331,7 @@ sub makescript {
|
||||
|
||||
# check if there are sync files to be handled
|
||||
my $syncfile;
|
||||
if (($provmethod) && ( $provmethod ne "install") && ($provmethod ne "netboot")) {
|
||||
if (($provmethod) && ($provmethod ne "install") && ($provmethod ne "netboot") && ($provmethod ne "statelite")) {
|
||||
my $osimagetab=xCAT::Table->new('osimage', -create=>1);
|
||||
if ($osimagetab) {
|
||||
(my $ref) = $osimagetab->getAttribs({imagename => $provmethod}, 'osvers', 'osarch', 'profile', 'provmethod', 'synclists');
|
||||
|
@ -289,7 +289,7 @@ sub getsynclistfile()
|
||||
|
||||
foreach my $node (@$nodes) {
|
||||
my $provmethod=$nodetype_v->{$node}->[0]->{'provmethod'};
|
||||
if (($provmethod) && ( $provmethod ne "install") && ($provmethod ne "netboot")) {
|
||||
if (($provmethod) && ( $provmethod ne "install") && ($provmethod ne "netboot") && ($provmethod ne "statelite")) {
|
||||
# get the syncfiles base on the osimage
|
||||
my $osimage_t = xCAT::Table->new('osimage');
|
||||
unless ($osimage_t) {
|
||||
@ -644,6 +644,10 @@ sub update_tables_with_diskless_image
|
||||
}
|
||||
my $arch = shift; #like ppc64, x86, x86_64
|
||||
my $profile = shift;
|
||||
my $mode=shift;
|
||||
|
||||
my $provm="netboot";
|
||||
if ($mode) { $provm = $mode; }
|
||||
|
||||
my $osname=$osver;; #like sles, rh, centos, windows
|
||||
my $ostype="Linux"; #like Linux, Windows
|
||||
@ -716,7 +720,7 @@ sub update_tables_with_diskless_image
|
||||
my $tmp1=$osimagetab->getAllEntries();
|
||||
if (defined($tmp1) && (@$tmp1 > 0)) {
|
||||
foreach my $rowdata(@$tmp1) {
|
||||
if (($osver eq $rowdata->{osvers}) && ($arch eq $rowdata->{osarch}) && ($rowdata->{provmethod} eq "netboot") && ($profile eq $rowdata->{profile})){
|
||||
if (($osver eq $rowdata->{osvers}) && ($arch eq $rowdata->{osarch}) && ($rowdata->{provmethod} eq $provm) && ($profile eq $rowdata->{profile})){
|
||||
$found=1;
|
||||
last;
|
||||
}
|
||||
@ -724,12 +728,12 @@ sub update_tables_with_diskless_image
|
||||
}
|
||||
if ($found) { print "The image is already in the db.\n"; return (0, ""); }
|
||||
|
||||
my $imagename=$osver . "-" . $arch . "-netboot-" . $profile;
|
||||
my $imagename=$osver . "-" . $arch . "-$provm-" . $profile;
|
||||
#TODO: check if there happen to be a row that has the same imagename but with different contents
|
||||
#now we can wirte the info into db
|
||||
my %key_col = (imagename=>$imagename);
|
||||
my %tb_cols=(imagetype=>$imagetype,
|
||||
provmethod=>"netboot",
|
||||
provmethod=>$provm,
|
||||
profile=>$profile,
|
||||
osname=>$ostype,
|
||||
osvers=>$osver,
|
||||
|
@ -412,10 +412,10 @@ sub mknetboot
|
||||
|
||||
$kcmdline =
|
||||
"NFSROOT=$nfssrv:$nfsdir STATEMNT=";
|
||||
if($stateHash->{statemnt} ){
|
||||
$kcmdline .= $stateHash->{statemnt} . " ";
|
||||
}else{
|
||||
$kcmdline .= " ";
|
||||
if (exists($stateHash->{$node})) {
|
||||
$kcmdline .= $stateHash->{$node}->[0]->{statemnt} . " ";
|
||||
} else {
|
||||
$kcmdline .= " ";
|
||||
}
|
||||
$kcmdline .=
|
||||
"XCAT=$imgsrv:$xcatdport ";
|
||||
@ -528,7 +528,7 @@ sub mkinstall
|
||||
|
||||
my $osinst;
|
||||
my $ent = $osents{$node}->[0]; #$ostab->getNodeAttribs($node, ['profile', 'os', 'arch']);
|
||||
if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot')) {
|
||||
if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot') and ($ent->{provmethod} ne 'statelite')) {
|
||||
$imagename=$ent->{provmethod};
|
||||
#print "imagename=$imagename\n";
|
||||
if (!exists($img_hash{$imagename})) {
|
||||
|
@ -98,9 +98,9 @@ sub setdestiny {
|
||||
$state = $stents{$_}->[0]->{currstate};
|
||||
$state =~ s/ .*//;
|
||||
#get the osimagename if nodetype.provmethod has osimage specified
|
||||
if (($sninit ==1) && (($state eq 'install') || ($state eq 'netboot'))) {
|
||||
if (($sninit ==1) && (($state eq 'install') || ($state eq 'netboot') || ($state eq 'statelite'))) {
|
||||
my $osimage=$ntents{$_}->[0]->{provmethod};
|
||||
if (($osimage) && ($osimage ne 'install') && ($osimage ne 'netboot')) {
|
||||
if (($osimage) && ($osimage ne 'install') && ($osimage ne 'netboot') && ($osimage ne 'statelite')) {
|
||||
$state="osimage=$osimage";
|
||||
}
|
||||
}
|
||||
@ -297,7 +297,7 @@ sub setdestiny {
|
||||
#if the previous nodeset staute is not install, then blank nodetype.provmethod
|
||||
if ($ntent and $ntent->{provmethod}){
|
||||
my $provmethod=$ntent->{provmethod};
|
||||
if (($provmethod ne 'install') && ($provmethod ne 'netboot')) {
|
||||
if (($provmethod ne 'install') && ($provmethod ne 'netboot') && ($provmethod ne 'statelite')) {
|
||||
if (exists($osimage_hash{$provmethod})) {
|
||||
$provmethod= $osimage_hash{$provmethod};
|
||||
} else {
|
||||
|
@ -120,22 +120,31 @@ sub syncmount {
|
||||
my %osents;
|
||||
unless($syncType =~ /image/){
|
||||
$ostab = xCAT::Table->new('nodetype');
|
||||
%osents = %{$ostab->getNodesAttribs(\@nodes,['profile','os','arch'])};
|
||||
%osents = %{$ostab->getNodesAttribs(\@nodes,['profile','os','arch','provmethod'])};
|
||||
}
|
||||
foreach my $node (@nodes){
|
||||
# node may be an image...
|
||||
my $ent;
|
||||
if(! $syncType =~ /image/){
|
||||
$ent = $osents{$node}->[0];
|
||||
unless($ent->{os} && $ent->{arch} && $ent->{profile}){
|
||||
$callback->({error=>["$node does not have os, arch, or profile defined in nodetype table"],errorcode=>[1]});
|
||||
$request = {};
|
||||
return;
|
||||
}
|
||||
# node may be an image...
|
||||
my $image;
|
||||
my $ent;
|
||||
if($syncType !~ /image/){
|
||||
$ent = $osents{$node}->[0];
|
||||
|
||||
unless($ent->{os} && $ent->{arch} && $ent->{profile}){
|
||||
$callback->({error=>["$node does not have os, arch, or profile defined in nodetype table"],errorcode=>[1]});
|
||||
$request = {};
|
||||
next;
|
||||
}
|
||||
my $fData = getNodeData($syncType,$node,$ent,$tab,$callback);
|
||||
# now we go through each directory and search for the file.
|
||||
showSync($syncType,$callback, $node, $fData);
|
||||
if ((!$ent->{provmethod}) || ($ent->{provmethod} eq 'statelite') || ($ent->{provmethod} eq 'netboot') || ($ent->{provmethod} eq 'install')) {
|
||||
$image = $ent->{os} . "-" . $ent->{arch} . "-statelite-" . $ent->{profile};
|
||||
} elsif (($ent->{provmethod} ne 'netboot') && ($ent->{provmethod} ne 'install')) {
|
||||
$image=$ent->{provmethod};
|
||||
}
|
||||
} else {
|
||||
$image=$node;
|
||||
}
|
||||
my $fData = getNodeData($syncType,$node,$image,$tab,$callback);
|
||||
# now we go through each directory and search for the file.
|
||||
showSync($syncType,$callback, $node, $fData);
|
||||
}
|
||||
}
|
||||
|
||||
@ -308,16 +317,17 @@ sub subVar {
|
||||
sub getNodeData {
|
||||
my $type = shift;
|
||||
my $node = shift;
|
||||
my $ent = shift;
|
||||
my $image = shift;
|
||||
my $tab = shift;
|
||||
my $cb = shift; # callback to print messages!!
|
||||
# the image name will be something like rhels5.4-x86_64-nfsroot
|
||||
my $image;
|
||||
unless($type =~ /image/){
|
||||
$image = $ent->{os} . "-" . $ent->{arch} . "-" . $ent->{profile};
|
||||
}else{
|
||||
$image = $node;
|
||||
}
|
||||
#my $image;
|
||||
#unless($type =~ /image/){
|
||||
# $image = $ent->{os} . "-" . $ent->{arch} . "-statelite-" . $ent->{profile};
|
||||
#}else{
|
||||
# $image = $node;
|
||||
#}
|
||||
|
||||
my @imageInfo;
|
||||
my @attrs;
|
||||
if($type eq "dir"){
|
||||
|
@ -399,7 +399,7 @@ sub mkinstall
|
||||
my $osinst;
|
||||
my $ent = $ntents->{$node}->[0];
|
||||
|
||||
if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot')) {
|
||||
if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot') and ($ent->{provmethod} ne 'statelite')) {
|
||||
my $imagename=$ent->{provmethod};
|
||||
#print "imagename=$imagename\n";
|
||||
if (!exists($img_hash{$imagename})) {
|
||||
|
@ -173,11 +173,19 @@ sub process_request {
|
||||
# }
|
||||
#}
|
||||
|
||||
#store the image in the DB
|
||||
if (!$imagename) {
|
||||
my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($osver, $arch, $profile, 'statelite');
|
||||
if ($ret[0] != 0) {
|
||||
$callback->({error=>["Error when updating the osimage tables: " . $ret[1]]});
|
||||
}
|
||||
$imagename="$osver-$arch-statelite-$profile"
|
||||
}
|
||||
|
||||
# now get the files for the node
|
||||
my @synclist = xCAT::Utils->runcmd("ilitefile $osver-$arch-$profile", 0, 1);
|
||||
my @synclist = xCAT::Utils->runcmd("ilitefile $imagename", 0, 1);
|
||||
if(!@synclist){
|
||||
$callback->({error=>["There are no files to sync for $osver-$arch-$profile. You have to have some files read/write filled out in the synclist table."],errorcode=>[1]});
|
||||
$callback->({error=>["There are no files to sync for $imagename. You have to have some files read/write filled out in the synclist table."],errorcode=>[1]});
|
||||
return;
|
||||
}
|
||||
|
||||
@ -197,6 +205,8 @@ sub process_request {
|
||||
}
|
||||
|
||||
liteMe($rootimg_dir,\@files, $callback);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user