From 0ad809aff0cd21ed0964d4c2f6d59eb9c8649a9c Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 18 Aug 2009 18:59:20 +0000 Subject: [PATCH] -In ESXi, support splicing in addkcmdline in intelligent places -Provide a method for plugins to declare custom processing of addkcmdline rather than the default append to the end git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4009 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/esx.pm | 15 ++++++++++++--- xCAT-server/lib/xcat/plugins/pxe.pm | 12 +++++++++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/esx.pm b/xCAT-server/lib/xcat/plugins/esx.pm index cac5c3aae..aefff5377 100644 --- a/xCAT-server/lib/xcat/plugins/esx.pm +++ b/xCAT-server/lib/xcat/plugins/esx.pm @@ -2064,16 +2064,25 @@ e.g: nodech $node nodetype.arch=x86\n"]); # now make file entry stuff my $tp = "xcat/netboot/$osver/$arch"; my $kernel = "$tp/mboot.c32"; - my $append = "$tp/vmkboot.gz"; - $append .= " --- $tp/vmk.gz"; + my $prepend = "$tp/vmkboot.gz"; + my $append = " --- $tp/vmk.gz"; $append .= " --- $tp/sys.vgz"; $append .= " --- $tp/cim.vgz"; $append .= " --- $tp/oem.tgz"; $append .= " --- $tp/license.tgz"; $append .= " --- $tp/mod.tgz"; if (defined $bpadds->{$node}->[0]->{addkcmdline}) { - $append .= $bpadds->{$node}->[0]->{addkcmdline}; + my $modules; + my $kcmdline; + ($kcmdline,$modules) = split /---/,$bpadds->{$node}->[0]->{addkcmdline},2; + if ($modules) { + $append .= " --- ".$modules; + } + $prepend .= " ".$kcmdline; } + $append = $prepend.$append; + $output_handler->({node=>[{name=>[$node],'_addkcmdlinehandled'=>[1]}]}); + $bptab->setNodeAttribs( diff --git a/xCAT-server/lib/xcat/plugins/pxe.pm b/xCAT-server/lib/xcat/plugins/pxe.pm index 491ffd8f2..59db3fb83 100644 --- a/xCAT-server/lib/xcat/plugins/pxe.pm +++ b/xCAT-server/lib/xcat/plugins/pxe.pm @@ -1,12 +1,12 @@ # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html package xCAT_plugin::pxe; -use Data::Dumper; use Sys::Syslog; use Socket; use File::Copy; use File::Path; use Getopt::Long; +my $addkcmdlinehandled; my $request; my $callback; my $dhcpconf = "/etc/dhcpd.conf"; @@ -77,9 +77,11 @@ sub setstate { my %chainhash = %{shift()}; my %machash = %{shift()}; my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']); - if ($kern->{addkcmdline}) { #Implement the kcmdline append here for + unless ($addkcmdlinehandled->{$node}) { #Tag to let us know the plugin had a special syntax implemented for addkcmdline + if ($kern->{addkcmdline}) { #Implement the kcmdline append here for #most generic, least code duplication $kern->{kcmdline} .= " ".$kern->{addkcmdline}; + } } if ($kern->{kcmdline} =~ /!myipfn!/) { my $ipfn = xCAT::Utils->my_ip_facing($node); @@ -210,7 +212,6 @@ sub setstate { my $errored = 0; sub pass_along { my $resp = shift; - $callback->($resp); if ($resp and ($resp->{errorcode} and $resp->{errorcode}->[0]) or ($resp->{error} and $resp->{error}->[0])) { $errored=1; } @@ -218,7 +219,12 @@ sub pass_along { if ($_->{error} or $_->{errorcode}) { $errored=1; } + if ($_->{_addkcmdlinehandled}) { + $addkcmdlinehandled->{$_->{name}->[0]}=1; + return; #Don't send back to client this internal hint + } } + $callback->($resp); }