add support for grub2-tftp and grub2-http as the netboot method

This commit is contained in:
immarvin 2015-01-28 01:14:43 -08:00
parent 9c45c6ee64
commit 1d6ba3646e
2 changed files with 36 additions and 7 deletions

View File

@ -643,7 +643,7 @@ noderes => {
descriptions => {
node => 'The node name or group name.',
servicenode => 'A comma separated list of node names (as known by the management node) that provides most services for this node. The first service node on the list that is accessible will be used. The 2nd node on the list is generally considered to be the backup service node for this node when running commands like snmove.',
netboot => 'The type of network booting to use for this node. Valid values: pxe or xnba for x86* architecture, yaboot for POWER architecture, grub2 for RHEL7 on Power. Notice: yaboot is not supported from rhels7 on Power,use grub2 instead',
netboot => 'The type of network booting to use for this node. Valid values: pxe or xnba for x86* architecture, yaboot for POWER architecture, grub2-tftp and grub2-http for RHEL7 on Power and all the os deployment on Power LE. Notice: yaboot is not supported from rhels7 on Power,use grub2-tftp or grub2-http instead, the difference between the 2 is the file transfer protocol(i.e, http or tftp)',
tftpserver => 'The TFTP server for this node (as known by this node). If not set, it defaults to networks.tftpserver.',
tftpdir => 'The directory that roots this nodes contents from a tftp and related perspective. Used for NAS offload by using different mountpoints.',
nfsserver => 'The NFS or HTTP server for this node (as known by this node).',

View File

@ -26,8 +26,10 @@ my %usage = (
"nodeset" => "Usage: nodeset <noderange> [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage[=<imagename>]|offline]",
);
sub handled_commands {
# process noderes:netboot like "grub2-<transfer protocol>"
# such as grub2-http and grub2-tftp
return {
nodeset => "noderes:netboot"
nodeset => "noderes:netboot=(grub2[-]?.*)"
}
}
@ -189,20 +191,47 @@ sub setstate {
}
$tftpserverip{$tftpserver} = $serverip;
}
my $grub2protocol="tftp";
if (defined ($nrhash{$node}->[0]) && $nrhash{$node}->[0]->{'netboot'}
&& ($nrhash{$node}->[0]->{'netboot'} =~ /grub2-(.*)/)) {
$grub2protocol = $1;
}
unless($grub2protocol =~ /^http|tftp$/ ){
$::callback->(
{
error => [
"Invalid netboot method, please check noderes.netboot for $node"
],
errorcode => [1]
}
);
return;
}
print $pcfg "set default=\"xCAT OS Deployment\"\n";
print $pcfg "menuentry \"xCAT OS Deployment\" {\n";
print $pcfg " insmod http\n";
print $pcfg " insmod tftp\n";
print $pcfg " set root=http,$serverip\n";
print $pcfg " set root=$grub2protocol,$serverip\n";
print $pcfg " echo Loading Install kernel ...\n";
my $protocolrootdir="";
if($grub2protocol =~ /^http$/)
{
$protocolrootdir=$tftpdir;
}
if ($kern and $kern->{kcmdline}) {
print $pcfg " linux $tftpdir/$kern->{kernel} $kern->{kcmdline}\n";
print $pcfg " linux $protocolrootdir/$kern->{kernel} $kern->{kcmdline}\n";
} else {
print $pcfg " linux $tftpdir/$kern->{kernel}\n";
print $pcfg " linux $protocolrootdir/$kern->{kernel}\n";
}
print $pcfg " echo Loading initial ramdisk ...\n";
if ($kern and $kern->{initrd}) {
print $pcfg " initrd $tftpdir/$kern->{initrd}\n";
print $pcfg " initrd $protocolrootdir/$kern->{initrd}\n";
}
print $pcfg "}";
@ -457,7 +486,7 @@ sub process_request {
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','tftpserver','xcatmaster']);
my $nrhash=$nrtab->getNodesAttribs(\@nodes,['servicenode','tftpserver','xcatmaster','netboot']);
my $typetab=xCAT::Table->new('nodetype',-create=>1);
my $typehash=$typetab->getNodesAttribs(\@nodes,['os','provmethod','arch','profile']);
my $linuximgtab=xCAT::Table->new('linuximage',-create=>1);