mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-18 20:30:56 +00:00
Merge pull request #3306 from whowutwut/rinv_firm_verbose
[openbmc] Add --verbose option and improve readability for `rinv <> firm`
This commit is contained in:
@ -39,7 +39,7 @@ OpenPOWER (OpenBMC) server specific:
|
||||
====================================
|
||||
|
||||
|
||||
\ **rinv**\ \ *noderange*\ [\ **model | serial | firm | cpu | dimm | all**\ ]
|
||||
\ **rinv**\ \ *noderange*\ [\ **model | serial | firm | cpu | dimm | all**\ ] [\ **-V | -**\ **-verbose**\ ]
|
||||
|
||||
|
||||
PPC (with HMC) specific:
|
||||
@ -234,6 +234,12 @@ Calling \ **rinv**\ for VMware will display the UUID/GUID, number of CPUs, amou
|
||||
|
||||
|
||||
|
||||
\ **-V | -**\ **-verbose**\
|
||||
|
||||
Prints verbose output, if available.
|
||||
|
||||
|
||||
|
||||
\ **-t**\
|
||||
|
||||
Set the values in the vm table to what vCenter has for the indicated nodes.
|
||||
|
@ -100,7 +100,7 @@ my %usage = (
|
||||
OpenPOWER (IPMI) server specific:
|
||||
rinv <noderange> [model|serial|deviceid|uuid|guid|vpd|mprom|firm|all]
|
||||
OpenPOWER (OpenBMC) server specific:
|
||||
rinv <noderange> [model|serial|firm|cpu|dimm|all]
|
||||
rinv <noderange> [model|serial|firm|cpu|dimm|all] [-V|--verbose]
|
||||
PPC specific(with HMC):
|
||||
rinv <noderange> [all|bus|config|serial|model|firm]
|
||||
PPC specific(using Direct FSP Management):
|
||||
|
@ -16,7 +16,7 @@ B<rinv> I<noderange> [B<model>|B<serial>|B<deviceid>|B<uuid>|B<guid>|B<vpd>|B<mp
|
||||
|
||||
=head2 OpenPOWER (OpenBMC) server specific:
|
||||
|
||||
B<rinv> I<noderange> [B<model>|B<serial>|B<firm>|B<cpu>|B<dimm>|B<all>]
|
||||
B<rinv> I<noderange> [B<model>|B<serial>|B<firm>|B<cpu>|B<dimm>|B<all>] [B<-V>|B<--verbose>]
|
||||
|
||||
=head2 PPC (with HMC) specific:
|
||||
|
||||
@ -149,6 +149,10 @@ Print help.
|
||||
|
||||
Print version.
|
||||
|
||||
=item B<-V>|B<--verbose>
|
||||
|
||||
Prints verbose output, if available.
|
||||
|
||||
=item B<-t>
|
||||
|
||||
Set the values in the vm table to what vCenter has for the indicated nodes.
|
||||
|
@ -29,6 +29,7 @@ use xCAT::SvrUtils;
|
||||
use xCAT::GlobalDef;
|
||||
use xCAT_monitoring::monitorctrl;
|
||||
|
||||
$::VERBOSE = 0;
|
||||
# String constants for rpower states
|
||||
$::POWER_STATE_OFF="off";
|
||||
$::POWER_STATE_ON="on";
|
||||
@ -409,16 +410,27 @@ sub parse_args {
|
||||
my $extrargs = shift;
|
||||
my $noderange = shift;
|
||||
my $check = undef;
|
||||
|
||||
|
||||
if (!defined($extrargs) and $command =~ /rpower|rsetboot|rspconfig|rflash/) {
|
||||
return ([ 1, "No option specified for $command" ]);
|
||||
}
|
||||
|
||||
if (scalar(@ARGV) > 1 and ($command =~ /rpower|rinv|rsetboot|rvitals/)) {
|
||||
my $subcommand = undef;
|
||||
if (scalar(@ARGV) > 2 and ($command =~ /rpower|rinv|rsetboot|rvitals/)) {
|
||||
return ([ 1, "Only one option is supported at the same time" ]);
|
||||
} elsif (scalar(@ARGV) == 2) {
|
||||
# Check if one is calling for Verbose output
|
||||
foreach (@ARGV) {
|
||||
if ($_ =~ /V|verbose/) {
|
||||
$::VERBOSE=1;
|
||||
} else {
|
||||
$subcommand = $_
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$subcommand = $ARGV[0]
|
||||
}
|
||||
|
||||
my $subcommand = $ARGV[0];
|
||||
if ($command eq "rpower") {
|
||||
unless ($subcommand =~ /^on$|^off$|^reset$|^boot$|^status$|^stat$|^state$/) {
|
||||
return ([ 1, "Unsupported command: $command $subcommand" ]);
|
||||
@ -526,6 +538,14 @@ sub parse_command_status {
|
||||
|
||||
$next_status{LOGIN_REQUEST} = "LOGIN_RESPONSE";
|
||||
|
||||
my $verbose = undef;
|
||||
unless (GetOptions(
|
||||
'V|verbose' => \$verbose,
|
||||
)) {
|
||||
xCAT::SvrUtils::sendmsg("Error parsing arguments.", $callback);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($command eq "rpower") {
|
||||
$subcommand = $ARGV[0];
|
||||
|
||||
@ -1063,30 +1083,27 @@ sub rinv_response {
|
||||
|
||||
if ($grep_string eq "firm") {
|
||||
# This handles the data from the /xyz/openbmc_project/Software endpoint.
|
||||
#
|
||||
# Handle printing out all posssible Software values in a generic format:
|
||||
# node: <Purpose> Software: <version> (<Activation>)
|
||||
#
|
||||
my $sw_id = (split(/\//, $key_url))[-1];
|
||||
if (defined($content{Version}) and $content{Version}) {
|
||||
my $purpose_value = uc ((split(/\./, $content{Purpose}))[-1]);
|
||||
$purpose_value = "[$sw_id]$purpose_value";
|
||||
my $activation_value = (split(/\./, $content{Activation}))[-1];
|
||||
#
|
||||
# For 'rinv firm', only print Active software. 'rflash list' will handle others
|
||||
# For 'rinv firm', only print Active software, unless verbose is specified
|
||||
#
|
||||
if ($activation_value =~ "Active") {
|
||||
if ($activation_value =~ "Active" or $::VERBOSE) {
|
||||
#
|
||||
# The space below between "SOFTWARE:" and $content{Version} is intentional
|
||||
# The space below between "Firmware Product Version:" and $content{Version} is intentional
|
||||
# to cause the sorting of this line before any additional info lines
|
||||
#
|
||||
$content_info = "$purpose_value SOFTWARE[$sw_id]: $content{Version} ($activation_value)";
|
||||
$content_info = "$purpose_value Firmware Product: $content{Version} ($activation_value)";
|
||||
push (@sorted_output, $content_info);
|
||||
|
||||
if (defined($content{ExtendedVersion}) and $content{ExtendedVersion} ne "") {
|
||||
# ExtendedVersion is going to be a comma separated list of additional software
|
||||
my @versions = split(',', $content{ExtendedVersion});
|
||||
foreach my $ver (@versions) {
|
||||
$content_info = "$purpose_value SOFTWARE[$sw_id]: -- additional info: $ver";
|
||||
$content_info = "$purpose_value Firmware Product: -- additional info: $ver";
|
||||
push (@sorted_output, $content_info);
|
||||
}
|
||||
}
|
||||
@ -1129,7 +1146,14 @@ sub rinv_response {
|
||||
# sort alpha, then numeric
|
||||
my @sorted_output = grep {s/(^|\D)0+(\d)/$1$2/g,1} sort
|
||||
grep {s/(\d+)/sprintf"%06.6d",$1/ge,1} @sorted_output;
|
||||
xCAT::SvrUtils::sendmsg("$_", $callback, $node) foreach (@sorted_output);
|
||||
foreach (@sorted_output) {
|
||||
#
|
||||
# The firmware output requires the ID to be part of the string to sort correctly.
|
||||
# Remove this ID from the output to the user
|
||||
#
|
||||
$_ =~ s/\[.*?\]//;
|
||||
xCAT::SvrUtils::sendmsg("$_", $callback, $node);
|
||||
}
|
||||
} else {
|
||||
xCAT::SvrUtils::sendmsg("$::NO_ATTRIBUTES_RETURNED", $callback, $node);
|
||||
}
|
||||
|
Reference in New Issue
Block a user