diff --git a/docs/source/guides/admin-guides/references/man1/rinv.1.rst b/docs/source/guides/admin-guides/references/man1/rinv.1.rst index 214b06e13..d760fc576 100644 --- a/docs/source/guides/admin-guides/references/man1/rinv.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rinv.1.rst @@ -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. diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index b733daca9..b0348dd53 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -100,7 +100,7 @@ my %usage = ( OpenPOWER (IPMI) server specific: rinv [model|serial|deviceid|uuid|guid|vpd|mprom|firm|all] OpenPOWER (OpenBMC) server specific: - rinv [model|serial|firm|cpu|dimm|all] + rinv [model|serial|firm|cpu|dimm|all] [-V|--verbose] PPC specific(with HMC): rinv [all|bus|config|serial|model|firm] PPC specific(using Direct FSP Management): diff --git a/xCAT-client/pods/man1/rinv.1.pod b/xCAT-client/pods/man1/rinv.1.pod index 090194df1..52ed22ccc 100644 --- a/xCAT-client/pods/man1/rinv.1.pod +++ b/xCAT-client/pods/man1/rinv.1.pod @@ -16,7 +16,7 @@ B I [B|B|B|B|B|B|B I [B|B|B|B|B|B] +B I [B|B|B|B|B|B] [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. diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index cf9b9cc60..3c30b1407 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -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: Software: () - # 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); }