From 2e017e2c105c6f0a71eab8832137d31bf827b4a8 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 16 May 2017 15:56:49 -0400 Subject: [PATCH 1/3] OpenBMC rinv sorted output --- xCAT-server/lib/xcat/plugins/openbmc.pm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 4f0663d41..6014eb72b 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -876,6 +876,7 @@ sub rinv_response { my $grep_string = $status_info{RINV_RESPONSE}{argv}; my $src; my $content_info; + my @sorted_output; foreach my $key_url (keys %{$response_info->{data}}) { my %content = %{ ${ $response_info->{data} }{$key_url} }; @@ -893,19 +894,23 @@ sub rinv_response { } if (($grep_string eq "vpd" or $grep_string eq "mprom")) { - # wait for interface + xCAT::SvrUtils::sendmsg("No information can be obtained for $grep_string", $callback, $node); + last; } if (($grep_string eq "vpd" or $grep_string eq "deviceid")) { - # wait for interface + xCAT::SvrUtils::sendmsg("No information can be obtained for $grep_string", $callback, $node); + last; } if ($grep_string eq "uuid") { - # wait for interface + xCAT::SvrUtils::sendmsg("No information can be obtained for $grep_string", $callback, $node); + last; } if ($grep_string eq "guid") { - # wait for interface + xCAT::SvrUtils::sendmsg("No information can be obtained for $grep_string", $callback, $node); + last; } if ($grep_string eq "mac" and $key_url =~ /\/ethernet/) { @@ -923,10 +928,16 @@ sub rinv_response { foreach my $key (keys %content) { $content_info = uc ($src) . " " . $key . " : " . $content{$key}; - xCAT::SvrUtils::sendmsg("$content_info", $callback, $node); + push (@sorted_output, $node . ": ". $content_info); #Save output in array } } } + # If sorted array has any contents, sort it and print it + if (scalar @sorted_output > 0) { + @sorted_output = sort @sorted_output; #Sort all output + my $result = join "\n", @sorted_output; #Join into a single string for easier display + xCAT::SvrUtils::sendmsg("$result", $callback); + } if ($next_status{ $node_info{$node}{cur_status} }) { $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; From d30d0156e7ef5d65cfb2db653cc55221a361ed62 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 16 May 2017 16:07:44 -0400 Subject: [PATCH 2/3] rinv man page fix --- docs/source/guides/admin-guides/references/man1/rinv.1.rst | 4 ++-- xCAT-client/pods/man1/rinv.1.pod | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 9d44f4377..df454d284 100644 --- a/docs/source/guides/admin-guides/references/man1/rinv.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rinv.1.rst @@ -32,14 +32,14 @@ OpenPOWER (using ipmi) server specific: ======================================= -\ **rinv**\ \ *noderange*\ {\ **model | serial | deviceid | uuid | guid | vpd | mprom | firm | all**\ } +\ **rinv**\ \ *noderange*\ [\ **model | serial | deviceid | uuid | guid | vpd | mprom | firm | all**\ ] OpenPOWER (using openbmc) server specific: ========================================== -\ **rinv**\ \ *noderange*\ {\ **model | serial | deviceid | uuid | guid | vpd | mprom | firm | cpu | dimm | all**\ } +\ **rinv**\ \ *noderange*\ [\ **model | serial | deviceid | uuid | guid | vpd | mprom | firm | cpu | dimm | all**\ ] PPC (with HMC) specific: diff --git a/xCAT-client/pods/man1/rinv.1.pod b/xCAT-client/pods/man1/rinv.1.pod index e0799d15b..3a5c92f29 100644 --- a/xCAT-client/pods/man1/rinv.1.pod +++ b/xCAT-client/pods/man1/rinv.1.pod @@ -12,11 +12,11 @@ B I {B|B|B|B|B|B|B I {B|B|B|B|B|B|B|B|B} +B I [B|B|B|B|B|B|B|B|B] =head2 OpenPOWER (using openbmc) server specific: -B I {B|B|B|B|B|B|B|B|B|B|B} +B I [B|B|B|B|B|B|B|B|B|B|B] =head2 PPC (with HMC) specific: From e664018cc493b5453874aa6d7e637460f560cc99 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 17 May 2017 11:25:38 -0400 Subject: [PATCH 3/3] Changes after review comments --- xCAT-server/lib/xcat/plugins/openbmc.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 6014eb72b..3ea0c7419 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -893,23 +893,23 @@ sub rinv_response { next if ($grep_string eq "serial"); } - if (($grep_string eq "vpd" or $grep_string eq "mprom")) { - xCAT::SvrUtils::sendmsg("No information can be obtained for $grep_string", $callback, $node); - last; + if (($grep_string eq "vpd" or $grep_string eq "mprom") and $key_url =~ /\/motherboard$/) { + xCAT::SvrUtils::sendmsg("No mprom information is available", $callback, $node); + next if ($grep_string eq "mprom"); } - if (($grep_string eq "vpd" or $grep_string eq "deviceid")) { - xCAT::SvrUtils::sendmsg("No information can be obtained for $grep_string", $callback, $node); - last; + if (($grep_string eq "vpd" or $grep_string eq "deviceid") and $key_url =~ /\/motherboard$/) { + xCAT::SvrUtils::sendmsg("No deviceid information is available", $callback, $node); + next if ($grep_string eq "deviceid"); } if ($grep_string eq "uuid") { - xCAT::SvrUtils::sendmsg("No information can be obtained for $grep_string", $callback, $node); + xCAT::SvrUtils::sendmsg("No uuid information is available", $callback, $node); last; } if ($grep_string eq "guid") { - xCAT::SvrUtils::sendmsg("No information can be obtained for $grep_string", $callback, $node); + xCAT::SvrUtils::sendmsg("No guid information is available", $callback, $node); last; }