Fixed issues in service node pool working with diskful and diskless installation

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11636 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
wanghuaz 2012-02-20 07:20:41 +00:00
parent 84adefc1e3
commit cda0df7b5c
3 changed files with 55 additions and 16 deletions

View File

@ -788,7 +788,7 @@ sub mkinstall
my %osents = %{$ostab->getNodesAttribs(\@nodes, ['profile', 'os', 'arch', 'provmethod'])};
my %rents =
%{$restab->getNodesAttribs(\@nodes,
['nfsserver', 'tftpdir', 'primarynic', 'installnic'])};
['xcatmaster', 'nfsserver', 'tftpdir', 'primarynic', 'installnic'])};
my %hents =
%{$hmtab->getNodesAttribs(\@nodes,
['serialport', 'serialspeed', 'serialflow'])};
@ -806,6 +806,15 @@ sub mkinstall
my $pkglistfile;
my $imagename;
my $platform;
my $xcatmaster;
my $ient = $rents->{$node}->[0];
if ($ient and $ient->{xcatmaster})
{
$xcatmaster = $ient->{xcatmaster};
} else {
$xcatmaster = '!myipfn!';
}
my $osinst;
if ($rents{$node}->[0] and $rents{$node}->[0]->{tftpdir}) {
@ -1058,7 +1067,7 @@ sub mkinstall
# 'serialport', 'serialspeed', 'serialflow'
# ]
# );
my $instserver='!myipfn!'; #default to autodetect from boot server
my $instserver = $xcatmaster;
if ($ent and $ent->{nfsserver}) {
$instserver=$ent->{nfsserver};
}

View File

@ -562,7 +562,7 @@ sub mkinstall
$restab->getNodesAttribs(
\@nodes,
[
'nfsserver', 'tftpdir',
'nfsserver', 'tftpdir','xcatmaster',
'primarynic', 'installnic'
]
);
@ -776,7 +776,13 @@ sub mkinstall
#We have a shot...
my $ent = $resents->{$node}->[0];
my $sent = $hments->{$node}->[0]; #hmtab->getNodeAttribs($node, ['serialport', 'serialspeed', 'serialflow']);
my $netserver = '!myipfn!';
my $netserver;
if ($ent and $ent->{xcatmaster}) {
$netserver = $ent->{xcatmaster};
} else {
$netserver = '!myipfn!';
}
if ($ent and $ent->{nfsserver})
{
$netserver = $ent->{nfsserver};

View File

@ -73,22 +73,44 @@ sub setstate {
my %chainhash = %{shift()};
my %machash = %{shift()};
my $tftpdir = shift;
my %nrhash = %{shift()};
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
if ($kern->{kcmdline} =~ /!myipfn!/) {
my $ipfn = xCAT::Utils->my_ip_facing($node);
unless ($ipfn) {
my @myself = xCAT::Utils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$callback->(
{
error => [
"$myname: Unable to determine the image server for $node"
],
errorcode => [1]
}
);
my $servicenodes = $nrhash{$node}->[0];
if ($servicenodes and $servicenodes->{servicenode}) {
my @sns = split /,/, $servicenodes->{servicenode};
foreach my $sn ( @sns ) {
# We are in the service node pools, print error if no facing ip.
if (xCAT::InstUtils->is_me($sn)) {
my @myself = xCAT::Utils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$callback->(
{
error => [
"$myname: Unable to determine the image server for $node on service node $sn"
],
errorcode => [1]
}
);
return;
}
}
} else {
$callback->(
{
error => [
"$myname: Unable to determine the image server for $node"
],
errorcode => [1]
}
);
return;
}
} else {
$kern->{kcmdline} =~ s/!myipfn!/$ipfn/g;
}
$kern->{kcmdline} =~ s/!myipfn!/$ipfn/g;
}
if ($kern->{addkcmdline}) {
$kern->{kcmdline} .= " ".$kern->{addkcmdline};
@ -453,6 +475,8 @@ sub process_request {
my $nodereshash=$noderestab->getNodesAttribs(\@nodes,['tftpdir']);
my $mactab=xCAT::Table->new('mac',-create=>1);
my $machash=$mactab->getNodesAttribs(\@nodes,['mac']);
my $nrtab=xCAT::Table->new('noderes',-create=>1);
my $nrhash=$nrtab->getNodesAttribs(\@nodes,['servicenode']);
my $rc;
my $errstr;
@ -469,7 +493,7 @@ sub process_request {
$response{node}->[0]->{data}->[0]= getstate($_,$tftpdir);
$callback->(\%response);
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
($rc,$errstr) = setstate($_,$bphash,$chainhash,$machash,$tftpdir);
($rc,$errstr) = setstate($_,$bphash,$chainhash,$machash,$tftpdir,$nrhash);
if ($rc) {
$response{node}->[0]->{errorcode}->[0]= $rc;
$response{node}->[0]->{errorc}->[0]= $errstr;