From 077a5e290169fc0edb3259b90f710d90420e70b9 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Tue, 15 May 2012 02:36:36 +0000 Subject: [PATCH] perl code of Deferred Firmware Update item git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@12670 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/FSPflash.pm | 21 +++++++++++---------- perl-xCAT/xCAT/PPCrflash.pm | 20 ++++++++++++++------ perl-xCAT/xCAT/Usage.pm | 5 +++-- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/perl-xCAT/xCAT/FSPflash.pm b/perl-xCAT/xCAT/FSPflash.pm index c02d140e5..ac2a5b937 100644 --- a/perl-xCAT/xCAT/FSPflash.pm +++ b/perl-xCAT/xCAT/FSPflash.pm @@ -146,9 +146,9 @@ sub get_lic_filenames { # return ("", "","", $msg, -1); # } } else { - $msg = $msg . "Upgrade $mtms disruptively!"; - if($activate ne "disruptive") { - $msg = "Option --activate's value shouldn't be concurrent, and it must be disruptive"; + $msg = $msg . "Upgrade $mtms!"; + if($activate !~ /^(disruptive|deferred)$/ { + $msg = "Option --activate's value shouldn't be $activate, and it must be disruptive or deferred"; return ("", "","", $msg, -1); } } @@ -261,7 +261,7 @@ sub rflash { my $frame = $$d[5]; my $type = xCAT::DBobjUtils->getnodetype($frame); - if ( ( $frame ne $name ) && ( $type eq "frame" ) ){ + if ( ( $frame ne $name ) && ( $type eq "frame" ) && $activate !~ /^deferred$/){ my @frame_d = (0, 0, 0, $frame, "frame", 0); $action = "list_firmware_level"; @@ -327,14 +327,15 @@ sub rflash { if($housekeeping =~ /^commit$/) { $action = "code_commit"} if($housekeeping =~ /^recover$/) { $action = "code_reject"} - if($activate =~ /^disruptive$/) { + if($housekeeping =~ /^bpa_acdl$/) { $action = "acdl"} + if($activate =~ /^(disruptive|deferred)$/) { $action = "code_update"; - } - if($activate =~ /^concurrent$/) { - my $res = "\'concurrent\' option not supported in FSPflash.Please use disruptive mode"; + } elsif (exists($activate)){ + #if($activate =~ /^concurrent$/) { + my $res = "\'$activate\' option not supported in FSPflash. Please use disruptive or deferred mode"; push @value, [$name, $res, -1]; - next; - } + next; + } my $msg; if(!defined($housekeeping)) { diff --git a/perl-xCAT/xCAT/PPCrflash.pm b/perl-xCAT/xCAT/PPCrflash.pm index db5fec182..deeebeba4 100644 --- a/perl-xCAT/xCAT/PPCrflash.pm +++ b/perl-xCAT/xCAT/PPCrflash.pm @@ -94,7 +94,7 @@ sub parse_args { $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt, qw(h|help v|version V|verbose p=s d=s activate=s commit recover) )) { + if ( !GetOptions( \%opt, qw(h|help v|version V|verbose p=s d=s activate=s commit recover bpa_acdl) )) { return( usage() ); } @@ -112,6 +112,11 @@ sub parse_args { ################################# #Option --activate not valid with --commit or --recover ################################# + if (exists($opt{bpa_acdl}) && (exists($opt{activate}) || exists($opt{commit}) || + exists($opt{recover}) || exists($opt{p}) || exists($opt{d}))) { + return ( usage("Option --bpa_acdl not valid with other options ")); + } + if( exists( $opt{activate} ) && (exists( $opt{commit}) || exists( $opt{recover}))) { return( usage("Option --activate not valid with --commit or --recover ") ); } @@ -149,8 +154,8 @@ sub parse_args { #--activate's value only can be concurrent and disruptive ################################ if(exists($opt{activate})) { - if( ($opt{activate} ne "concurrent") && ($opt{activate} ne "disruptive")) { - return (usage("--activate's value can only be concurrent or disruptive")); + if( ($opt{activate} ne "deferred") && ($opt{activate} ne "disruptive")) { + return (usage("--activate's value can only be deferred or disruptive")); } if(!exists( $opt{d} )) { @@ -181,6 +186,9 @@ sub parse_args { } elsif( defined( $opt{ recover }) ) { print "recover flag\n"; $housekeeping = "recover"; + } elsif (defined( $opt{ bpa_acdl})) { + print "bpa_acdl flag\n"; + $housekeeping = "bpa_acdl"; } else { print "no housekeeping - update mode\n"; $housekeeping = undef; @@ -526,9 +534,9 @@ sub get_lic_filenames { # return ("", "","", $msg, -1); # } } else { - $msg = $msg . "Upgrade $mtms disruptively!"; - if($activate ne "disruptive") { - $msg = "Option --activate's value shouldn't be concurrent, and it must be disruptive"; + $msg = $msg . "Upgrade $mtms!"; + if($activate !~ /^(disruptive|deferred)$/) { + $msg = "Option --activate's value shouldn't be $activate, and it must be disruptive or deferred"; return ("", "","", $msg, -1); } } diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 078e9df52..d2dd18ca3 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -268,8 +268,9 @@ my %usage = ( rflash -p [--activate concurrent | disruptive][-V|--verbose] rflash [--commit | --recover] [-V|--verbose] PPC (using Direct FSP Management) specific: - rflash -p --activate disruptive [-d ] - rflash [--commit | --recover] [-V|--verbose]", + rflash -p --activate [-d ] + rflash [--commit | --recover] [-V|--verbose] + rflash [--bpa_acdl]", "mkhwconn" => "Usage: mkhwconn [-h|--help]