Fix: Get Payload info for non active payload
Return 0 as session id, for non active payload instance instead
of failure error code. This is as per IPMI specification
Get Payload Instance Info command.
Unit-test:
1. Verified the reponse of
ipmitool -I lanplus -H 127.0.0.1 -U root -P 0penBmc raw 6 0x4B 1 1
with session id 0, when no SOL is session is active, and with proper
session id, when SOL session is active
Change-Id: I41e5378606f8f4d4c15f1bb07fd635098b837f4a
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/command/payload_cmds.cpp b/command/payload_cmds.cpp
index 2e8ac6f..33b6914 100644
--- a/command/payload_cmds.cpp
+++ b/command/payload_cmds.cpp
@@ -213,16 +213,18 @@
auto status = std::get<sol::Manager&>(singletonPool)
.isPayloadActive(request->payloadInstance);
- if (!status)
+ if (status)
{
- response->completionCode = IPMI_CC_RESPONSE_ERROR;
- return outPayload;
+ auto& context = std::get<sol::Manager&>(singletonPool)
+ .getContext(request->payloadInstance);
+ response->sessionID = context.sessionID;
}
-
- auto& context = std::get<sol::Manager&>(singletonPool)
- .getContext(request->payloadInstance);
- response->sessionID = context.sessionID;
-
+ else
+ {
+ // No active payload - return session id as 0
+ response->sessionID = 0;
+ }
+ response->completionCode = IPMI_CC_OK;
return outPayload;
}