2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 17:23:08 +00:00

Based on the OpenBMC Sensor API, complete the development code

for the supported options based on the possible values that are
currently allowed to be returned.  As more data is added, the code
should be able to handle the printing of the data automatically
This commit is contained in:
Victor Hu 2017-05-24 22:49:14 -04:00
parent f564dde262
commit 74769080c8
4 changed files with 59 additions and 11 deletions

View File

@ -56,20 +56,27 @@ BMC specific:
\ **rvitals**\ \ *noderange*\ {\ **temp | voltage | wattage | fanspeed | power | leds | all**\ }
OpenPOWER server specific:
OpenPOWER (IPMI) specific:
==========================
\ **rvitals**\ \ *noderange*\ [\ **temp | voltage | wattage | fanspeed | power | leds | all**\ ]
OpenPOWER (OpenBMC) specific:
=============================
\ **rvitals**\ \ *noderange*\ [\ **temp | voltage | wattage | fanspeed | power | length | all**\ ]
*******************
\ **Description**\
*******************
\ **rvitals**\ retrieves hardware vital information from the on-board Service
\ **rvitals**\ Retrieves hardware vital information from the on-board Service
Processor for a single or range of nodes and groups.
@ -133,6 +140,12 @@ Processor for a single or range of nodes and groups.
\ **length**\
Retrieves length related attributes.
\ **power**\
Retrieves power status.

View File

@ -81,8 +81,10 @@ my %usage = (
rvitals noderange {temp|wattage|fanspeed|leds|summary|all}
BMC specific:
rvitals noderange {temp|voltage|wattage|fanspeed|power|leds|all}
OpenPOWER server specific:
OpenPOWER (IPMI) specific:
rvitals noderange [temp|voltage|wattage|fanspeed|power|leds|all]
OpenPOWER (OpenBMC) specific:
rvitals noderange [temp|voltage|wattage|fanspeed|power|length|all]
MIC specific:
rvitals noderange {thermal|all}",
"reventlog" =>

View File

@ -26,13 +26,17 @@ B<rvitals> I<noderange> {B<temp>|B<wattage>|B<fanspeed>|B<leds>|B<summary>|B<all
B<rvitals> I<noderange> {B<temp>|B<voltage>|B<wattage>|B<fanspeed>|B<power>|B<leds>|B<all>}
=head2 OpenPOWER server specific:
=head2 OpenPOWER (IPMI) specific:
B<rvitals> I<noderange> [B<temp>|B<voltage>|B<wattage>|B<fanspeed>|B<power>|B<leds>|B<all>]
=head2 OpenPOWER (OpenBMC) specific:
B<rvitals> I<noderange> [B<temp>|B<voltage>|B<wattage>|B<fanspeed>|B<power>|B<length>|B<all>]
=head1 B<Description>
B<rvitals> retrieves hardware vital information from the on-board Service
B<rvitals> Retrieves hardware vital information from the on-board Service
Processor for a single or range of nodes and groups.
=head1 B<Options>
@ -75,6 +79,10 @@ Retrieves rack environmentals.
Retrieves LEDs status.
=item B<length>
Retrieves length related attributes.
=item B<power>
Retrieves power status.

View File

@ -458,7 +458,7 @@ sub parse_args {
} elsif ($command eq "rvitals") {
$check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; }
$subcommand = "all" if (!defined($ARGV[0]));
unless ($subcommand =~ /^temp$|^voltage$|^wattage$|^fanspeed$|^power$|^leds$|^all$/) {
unless ($subcommand =~ /^temp$|^voltage$|^wattage$|^fanspeed$|^power$|^length$|^all$/) {
return ([ 1, "Unsupported command: $command $subcommand" ]);
}
} else {
@ -1216,17 +1216,42 @@ sub rvitals_response {
foreach my $key_url (keys %{$response_info->{data}}) {
my %content = %{ ${ $response_info->{data} }{$key_url} };
print Dumper(%content) . "\n";
# $key_url is "/xyz/openbmc_project/sensors/xxx/yyy
# For now display xxx/yyy as a label
my ($junk, $label) = split("/sensors/", $key_url);
#
# Calculate the value based on the scale
# Skip over attributes that are not asked to be printed
#
if ($grep_string =~ "temp") {
unless ( $content{Unit} =~ "DegreesC") { next; }
}
if ($grep_string =~ "voltage") {
unless ( $content{Unit} =~ "Volts") { next; }
}
if ($grep_string =~ "wattage") {
unless ( $content{Unit} =~ "Watts") { next; }
}
if ($grep_string =~ "fanspeed") {
unless ( $content{Unit} =~ "RPMS") { next; }
}
if ($grep_string =~ "power") {
unless ( $content{Unit} =~ "Amperes" || $content{Unit} =~ "Joules" || $content{Unit} =~ "Watts" ) { next; }
}
if ($grep_string =~ "length") {
unless ( $content{Unit} =~ "Meters" ) { next; }
}
#
# $key_url is in the format: "/xyz/openbmc_project/sensors/xxx/yyy
# For now display xxx/yyy as a label
#
my ($junk, $label) = split("/sensors/", $key_url);
#
# Calculate the adjusted value based on the scale attribute
#
my $calc_value = $content{Value};
if ( $content{Scale} != 0 ) {
$calc_value = ($content{Value} * (10 ** $content{Scale}));
}
$sensor_value = $label . ": " . $calc_value . " " . $sensor_units{ $content{Unit} };
xCAT::SvrUtils::sendmsg("$sensor_value", $callback, $node);
}