From 7a7ec4a77b9dd8d820c138b85e30c87fb3225929 Mon Sep 17 00:00:00 2001 From: jjhua Date: Wed, 7 Jan 2009 10:38:18 +0000 Subject: [PATCH] make the firmware upgrade command rflash support service node git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2573 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/PPC.pm | 87 +++++++++++++++++++++++ perl-xCAT/xCAT/PPCrflash.pm | 16 +++-- xCAT-client/pods/man1/rflash.1.pod | 109 +++++++++++++++++++++++++++-- 3 files changed, 200 insertions(+), 12 deletions(-) diff --git a/perl-xCAT/xCAT/PPC.pm b/perl-xCAT/xCAT/PPC.pm index bc3d492a0..b22e9723b 100644 --- a/perl-xCAT/xCAT/PPC.pm +++ b/perl-xCAT/xCAT/PPC.pm @@ -1030,7 +1030,94 @@ sub preprocess_request { } } } + + #################### + #suport for "rflash", copy the rpm and xml packages from user-spcefied-directory to /install/packages_fw + ##################### + if ( $command eq "rflash" ) { + my $packages_fw = "/install/packages_fw"; + my $c = 0; + my $packages_d; + foreach (@exargs) { + $c++; + if($_ eq "-p") { + $packages_d = $exargs[$c]; + last; + } + } + if($packages_d ne $packages_fw ) { + $exargs[$c] = $packages_fw; + if(! -d $packages_d) { + $callback->({data=>["The directory $packages_d doesn't exist!"]}); + $req = (); + return; + } + + #print "opening directory and reading names\n"; + opendir DIRHANDLE, $packages_d; + my @dirlist= readdir DIRHANDLE; + closedir DIRHANDLE; + @dirlist = File::Spec->no_upwards( @dirlist ); + + # Make sure we have some files to process + # + if( !scalar( @dirlist ) ) { + $callback->({data=>["The directory $packages_d is empty !"]}); + $req = (); + return; + } + + #Find the rpm lic file + my @rpmlist = grep /\.rpm$/, @dirlist; + my @xmllist = grep /\.xml$/, @dirlist; + if( @rpmlist == 0 | @xmllist == 0) { + $callback->({data=>["There isn't any rpm and xml files in the directory $packages_d!"]}); + $req = (); + return; + } + + my $rpm_list = join(" ", @rpmlist); + my $xml_list = join(" ", @xmllist); + + my $cmd; + if( -d $packages_fw) { + $cmd = "rm -rf $packages_fw"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $callback->({data=>["Failed to remove the old packages in $packages_fw."]}); + $req = (); + return; + + } + } + + $cmd = "mkdir $packages_fw"; + xCAT::Utils->runcmd("$cmd", 0); + if ($::RUNCMD_RC != 0) + { + $callback->({data=>["$cmd failed."]}); + $req = (); + return; + + } + + $cmd = "cp $packages_d/*.rpm $packages_d/*.xml $packages_fw"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $callback->({data=>["$cmd failed."]}); + $req = (); + return; + + } + + $req->{arg} = \@exargs; + } + } + + # find service nodes for the HCPs # build an individual request for each service node my $service = "xcat"; diff --git a/perl-xCAT/xCAT/PPCrflash.pm b/perl-xCAT/xCAT/PPCrflash.pm index d5accc367..dc0212982 100644 --- a/perl-xCAT/xCAT/PPCrflash.pm +++ b/perl-xCAT/xCAT/PPCrflash.pm @@ -331,7 +331,7 @@ sub rflash { my @xml_files; my $upgrade_required; my $stanza = undef; - + my $mtms_t; my @value; $hmc = @$exp[3]; @@ -356,6 +356,7 @@ sub rflash { while(($mtms,$h) = each(%$hash)) { dpush(\@value,[$hmc, "mtms:$mtms"]); + $mtms_t = "$mtms_t $mtms"; my $lflag = 0; my $managed_system = $mtms; if( defined( $housekeeping ) ) { @@ -388,7 +389,7 @@ sub rflash { } else { $component = "power"; } - dpush(\@value, [$hmc,"$mtms:componet:$component!"]); + dpush(\@value, [$hmc,"$mtms:component:$component!"]); my $values = xCAT::PPCcli::lslic( $exp, $d ); my $Rc = shift(@$values); @@ -414,6 +415,7 @@ sub rflash { ($rpm_file, $xml_file, $upgrade_required,$msg, $flag) = &get_lic_filenames($mtms); if( $flag == -1) { push (@value, [$hmc,"$mtms: $msg"]); + push (@value, [$hmc,"Failed to upgrade the firmware of $mtms on $hmc"]); return (\@value); } dpush ( \@value, [$hmc, $msg]); @@ -431,8 +433,8 @@ sub rflash { push @rpm_files, $rpm_file; push @xml_files, $xml_file; } - - push(@result,[$hmc, "Upgrade $mtms from release level:$release_level activated level:$active_level to $rpm_file successfully"]); + my ($volume,$directories,$file) = File::Spec->splitpath($rpm_file); + push(@result,[$hmc, "Upgrade $mtms from release level:$release_level activated level:$active_level to $file successfully"]); } @@ -487,6 +489,8 @@ sub rflash { xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); push(@value,[$hmc,$rsp->{data}->[0]]); push(@value,[$hmc,"Failed to copy $tmp_file $rpm_file_list $xml_file_list to $hmc"]); + push(@value,[$hmc,"Please check whether the HMC $hmc is configured to allow remote ssh connections"]); + push (@value, [$hmc,"Failed to upgrade the firmware of $mtms_t on $hmc"]); return(\@value); } @@ -514,7 +518,9 @@ sub rflash { xCAT::MsgUtils->message("S", $rsp, $::CALLBACK, 1); dpush(\@value,[$hmc,"failed to run xCAT::DSHCLI->runDsh_api()"]); push(@value,[$hmc,$rsp->{data}->[0]]); - push(@value,[$hmc,"Maybe need to configure the HMC to allow remote ssh connections"]); + push(@value,[$hmc,"Please check whether the HMC $hmc is configured to allow remote ssh connections"]); + #push (@value, [$hmc,"Failed to run the upgrade command \"rflash\" on $hmc"]); + push (@value, [$hmc,"Failed to upgrade the firmware of $mtms_t on $hmc"]); return(\@value); } diff --git a/xCAT-client/pods/man1/rflash.1.pod b/xCAT-client/pods/man1/rflash.1.pod index c77296364..e30070d5a 100644 --- a/xCAT-client/pods/man1/rflash.1.pod +++ b/xCAT-client/pods/man1/rflash.1.pod @@ -73,23 +73,118 @@ Displays the command's version. =over 4 +POWER5 and POWER6 Licensed Internal Code updates must meet the following B: + +(1)Enable the HMC to allow remote ssh connections. + +(2)Ensure that ssh is installed on the xCAT management node + +(3)The Lpar , CEC, or BPA has been defined in the nodelist, nodetype, ppc tables + +(4)Define the HMC related the above node as a node on the management node. For example, + +#nodeadd hmc01.clusters.com groups=hmc + +(5)Run the xdsh command to set up and generate the ssh keys on the xCAT management node and transfer the public key to the HMC. You must also manually configure the HMC to allow remote ssh connections. For example + +#xdsh hmc01.clusters.com -K + +or use other ways, for example: + +#ssh-keygen -t rsa; + +#ssh-keygen -t dsa; + +#cd /root/.ssh + +#ls; + +#firstkey=`cat id_dsa.pub` + +#ssh hscroot@c76v3hmc03.ppd.pok.ibm.com mkauthkeys -a \"$firstkey\" +Password: + +# secondkey=`cat id_rsa.pub` + +#ssh hscroot@c76v3hmc03.ppd.pok.ibm.com mkauthkeys -a \"$secondkey\" + +(6)If the firmware upgrade will be done through service node, the HMC or CEC and the corresponding service node have been add into the noderes table. + +(7)The update files are ready for the firmware upgrade. + +There are 2 B to show how to use this command. + =item 1 -To update only the power subsystem attached to a single HMC-attached pSeries CEC(cec_name), and recycle the power subsystem and all attached managed systems when the update is complete, and the Microcode update package and associated XML file are in /tmp/fw, enter: +To update only the power subsystem attached to a single HMC-attached pSeries CEC(Server-m_tmp-SNs_tmp), and recycle the power subsystem and all attached managed systems when the update is complete, and the Microcode update package and associated XML file are in /tmp/fw. -B I I<-p /tmp/fw> I<--activate disruptive> +(1) Define the CEC as a device on the management node. + +B + +Modify the table nodehm + +B + +Modify the table nodetype: + +B + +Modify the table ppc: + +B + +Modify the tab vpd: + +B + +Set the account of the HMC(Modify the ppchcp): + +B + +(2) Generate the ssh keys on the xCAT management node and transfer the public key to the HMC to configure the HMC to allow remote ssh connections(Please see the item 5 of the prerequisites) + +(3)If a service node will be used, define the attribute values for specified service node(service node01) in servicenode table. (optional) + +(4)If the service node will be used, define the service node attribute values for the CEC. For example, (optional) + +B + +(5)Use rinv to check current code level + +B + +(6) Download the Microcode update package and associated XML file from the IBM Web site: I. Create the /tmp/fw directory, if necessary, and copy the downloaded files to the /tmp/fw directory. + +(7) Run the rflash command with the --activate flag to specify the update mode to perform the updates. + +B + +B: + +(1)You Need check your update is concurrent or disruptive here!! other commands sample: rflash Server-m_tmp-SNs_tmp -p /tmp/fw --activate concurrent + +(2)If the noderange is BPA/Lpar, the upgrade steps are the same as the CEC's + +(3)System p5 and p6 updates can require time to complete and there is no visual indication that the command is proceeding. =item 2 -To update only the power subsystem attached to a single HMC-attached pSeries node, and recycle the power subsystem and all attached managed systems when the update is complete, and the Microcode update package and associated XML file are in /tmp/fw, enter: +To commit currently activated LIC updates(copy T to P) for HMC-attached System p5 and p6 CEC -B I I<-p /tmp/fw> I<--activate disruptive> +(1-5) The 1-5 steps are the same as the (1-5) steps in B -=item 3 +(6)Check the output of the step 5 that whether the LIC will be committed. If yes, run the step(7) -To commit a firmware update to permanent flash on an HMC-attached CEC, enter: +(7)Run the rflash command with “--commit” flag to finish the work -B I I<--commit> +B + +B: + +(1)If the noderange is BPA/Lpar, the commit steps are the same as the CEC's. + +(2)If recover the installed LIC updates , the steps are the same as the (1-6) steps of this B. Only the last step is different. =back