From c6cb1c9977604bab79eba7a92c559000d6595756 Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 21 Mar 2014 04:40:25 -0700 Subject: [PATCH] append some code logic and documentation for rhels7 support on grub2 --- perl-xCAT/xCAT/Schema.pm | 2 +- xCAT-server/lib/xcat/plugins/grub2.pm | 29 +++++++++++++++++--------- xCAT-server/lib/xcat/plugins/yaboot.pm | 11 +++++++++- xCAT-server/xCAT-server.spec | 2 +- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 0c0c96aa5..daefad9e9 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -599,7 +599,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.', + 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', 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).', diff --git a/xCAT-server/lib/xcat/plugins/grub2.pm b/xCAT-server/lib/xcat/plugins/grub2.pm index b26c16b36..04650a69d 100644 --- a/xCAT-server/lib/xcat/plugins/grub2.pm +++ b/xCAT-server/lib/xcat/plugins/grub2.pm @@ -515,16 +515,25 @@ sub process_request { unless (($args[0] eq 'stat') || ($inittime) || ($args[0] eq 'offline')) { foreach my $osimage (keys %osimagenodehash) { #TOTO check the existence of grub2 executable files for corresponding arch - my $osimgent = $osimagetab->getAttribs({imagename => $osimage },'arch'); - my $grub2 = "/boot/grub2/grub2.ppc"; - my $tftppath = $tftpdir . $grub2; - unless (-e "$tftppath") { - my $rsp; - push @{$rsp->{data}}, - "stop configuration, missing $tftppath.\n"; - xCAT::MsgUtils->message("E", $rsp, $callback); - return; - } + my $osimgent = $osimagetab->getAttribs({imagename => $osimage },'osarch'); + my $validarch=undef; + if($osimgent and $osimgent->{'osarch'}) + { + $validarch = $osimgent->{'osarch'}; + } + if ($validarch =~ /ppc64/i) + { + $validarch="ppc" + } + my $grub2 = "/boot/grub2/grub2.".$validarch; + my $tftppath = $tftpdir . $grub2; + unless (-e "$tftppath") { + my $rsp; + push @{$rsp->{data}}, + "stop configuration, missing $tftppath.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + return; + } if ($do_dhcpsetup) { if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command $sub_req->({command=>['makedhcp'], diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index 73cbd6d5e..c8ae4c1a7 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -571,7 +571,16 @@ sub process_request { $osn = $2; $osm = 0; } - + + #Redhat recommend to use grub2 instead of yaboot for rhels7 provision + if ( $osv =~ /rh/ and int($osn) == 7 ){ + my $rsp; + push @{$rsp->{data}}, + "stop configuration because yaboot DOES NOT work for $os provision, please change noderes.netboot=grub2 instead.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + return; + } + if (($osv =~ /rh/ and int($osn) < 6) or ($osv =~ /sles/ and int($osn) < 11)) { # check if yaboot-xcat installed diff --git a/xCAT-server/xCAT-server.spec b/xCAT-server/xCAT-server.spec index f3ec85b2e..eab526467 100755 --- a/xCAT-server/xCAT-server.spec +++ b/xCAT-server/xCAT-server.spec @@ -20,7 +20,7 @@ AutoReqProv: no # also need to fix Requires for AIX %ifos linux BuildArch: noarch -Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser +Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser grub2-xcat Obsoletes: atftp-xcat %endif