From 712ac48e82cfd287a963514548e4b3912e55b6af Mon Sep 17 00:00:00 2001 From: yinqing Date: Mon, 11 Nov 2013 17:24:10 +0800 Subject: [PATCH] merge 2.8.2-pcm code change from qing --- .../kit_template/plugins/sample/imageprofile.pm | 8 +++----- xCAT-server/lib/xcat/plugins/00kitnodebase.pm | 16 +++++++++++++++- xCAT-server/lib/xcat/plugins/destiny.pm | 7 ++++++- xCAT-server/lib/xcat/plugins/profilednodes.pm | 4 ++-- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/xCAT-buildkit/share/xcat/kits/kit_template/plugins/sample/imageprofile.pm b/xCAT-buildkit/share/xcat/kits/kit_template/plugins/sample/imageprofile.pm index 3f0059526..97195e80b 100644 --- a/xCAT-buildkit/share/xcat/kits/kit_template/plugins/sample/imageprofile.pm +++ b/xCAT-buildkit/share/xcat/kits/kit_template/plugins/sample/imageprofile.pm @@ -171,14 +171,12 @@ sub process_request { # Do the check my $imageprofile = parse_str_arg($request->{arg}->[0]); + my $kitdata = undef; if (! exists($request->{kitdata})) { - $rsp->{data}->[0] = "Skipped running \"$command\" plugin command for \"$PLUGIN_KITNAME\" kit."; - xCAT::MsgUtils->message("I", $rsp, $callback); - return; + $kitdata = $request->{kitdata}; } - my $kitdata = $request->{kitdata}; - if (! defined($kitdata) && !($command eq "kitimagepostdelete")) { + if (! defined($kitdata) && ! ($command eq 'kitimagepostdelete')) { $kitdata = xCAT::KitPluginUtils->get_kits_used_by_image_profiles([$imageprofile]); $request->{kitdata} = $kitdata; } diff --git a/xCAT-server/lib/xcat/plugins/00kitnodebase.pm b/xCAT-server/lib/xcat/plugins/00kitnodebase.pm index ea985c236..f92bd2482 100644 --- a/xCAT-server/lib/xcat/plugins/00kitnodebase.pm +++ b/xCAT-server/lib/xcat/plugins/00kitnodebase.pm @@ -92,6 +92,7 @@ sub process_request { my @commandslist; my %argslist; + my $noupdate_flag = 0; my %msghash = ( "makehosts" => "Updating hosts entries", "makedns" => "Updating DNS entries", "makedhcp" => "Update DHCP entries", @@ -143,6 +144,10 @@ sub process_request { if($macflag) { if ($chainarray[0]){ + if($chainarray[0] =~ m/^osimage=/) + { + $noupdate_flag = 1; + } push @commandslist, ['nodeset', $chainarray[0]]; } } @@ -161,6 +166,7 @@ sub process_request { my $firstnode = (@$nodelist)[0]; if (exists $profilehash{$firstnode}{"ImageProfile"}){ my $osimage = 'osimage='.$profilehash{$firstnode}{"ImageProfile"}; + $noupdate_flag = 1; push @commandslist, ['nodeset', $osimage]; } } @@ -170,7 +176,15 @@ sub process_request { my $current_cmd = $_->[0]; my $current_args = $_->[1]; setrsp_progress($msghash{$current_cmd}); - my $retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$nodelist, arg=>[$current_args]}, $request_command, 0, 2); + $retref = ""; + if(($current_cmd eq "nodeset") && $noupdate_flag) + { + $retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$nodelist, arg=>[$current_args, "--noupdateinitrd"]}, $reques t_command, 0, 2); + } + else + { + $retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$nodelist, arg=>[$current_args]}, $request_command, 0, 2); + } log_cmd_return($retref); } diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index a29818908..a4936eb8c 100644 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -576,13 +576,18 @@ sub nextdestiny { my %requ; $requ{node}=[$node]; $requ{arg}=[$ref->{currstate}]; + if($ref->{currstate} =~ /noupdateinitrd$/) + { + my @items = split /[:]/,$ref->{currstate}; + $requ{arg}= \@items; + } setdestiny(\%requ, $flag+1); } if ($callnodeset) { $subreq->({command=>['nodeset'], node=> \@nodes, - arg=>['enact']}); + arg=>['enact', '--noupdateinitrd']}); } } diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index ce03f9436..863ebb8a2 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -1790,11 +1790,11 @@ sub gen_new_hostinfo_dict{ if (exists $chain->{'chain'}) { my $hardwareprofile_chain = $chain->{'chain'}; - $hostinfo_dict{$item}{"chain"} = $hardwareprofile_chain.',osimage='.$provmethod; + $hostinfo_dict{$item}{"chain"} = $hardwareprofile_chain.',osimage='.$provmethod.":--noupdateinitrd"; } else { - $hostinfo_dict{$item}{"chain"} = 'osimage='.$provmethod; + $hostinfo_dict{$item}{"chain"} = 'osimage='.$provmethod.":--noupdateinitrd"; } if (exists $netprofileattr{"bmc"}){ # Update BMC records.