mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-07-01 10:13:35 +00:00
ID: 70 - Fixes and updates for ipmitool hpm
Fixed the hpm upgstatus command to print the results of the command without having to specify -v to enable verbose operation. It's not clear that this command is even useful to the user at all. Perhaps it should be removed entirely. Commit for Dan Gora
This commit is contained in:
@ -1067,9 +1067,7 @@ static int HpmfwupgFinishFirmwareUpload(struct ipmi_intf *intf,
|
|||||||
static int HpmfwupgActivateFirmware(struct ipmi_intf *intf,
|
static int HpmfwupgActivateFirmware(struct ipmi_intf *intf,
|
||||||
struct HpmfwupgActivateFirmwareCtx* pCtx,
|
struct HpmfwupgActivateFirmwareCtx* pCtx,
|
||||||
struct HpmfwupgUpgradeCtx* pFwupgCtx);
|
struct HpmfwupgUpgradeCtx* pFwupgCtx);
|
||||||
static int HpmfwupgGetUpgradeStatus(struct ipmi_intf *intf,
|
static int HpmfwupgGetUpgradeStatus(struct ipmi_intf *intf, struct HpmfwupgGetUpgradeStatusCtx* pCtxstruct, struct HpmfwupgUpgradeCtx* pFwupgCtx, int silent);
|
||||||
struct HpmfwupgGetUpgradeStatusCtx* pCtxstruct,
|
|
||||||
struct HpmfwupgUpgradeCtx* pFwupgCtx);
|
|
||||||
static int HpmfwupgManualFirmwareRollback(struct ipmi_intf *intf,
|
static int HpmfwupgManualFirmwareRollback(struct ipmi_intf *intf,
|
||||||
struct HpmfwupgManualFirmwareRollbackCtx* pCtx,
|
struct HpmfwupgManualFirmwareRollbackCtx* pCtx,
|
||||||
struct HpmfwupgUpgradeCtx* pFwupgCtx);
|
struct HpmfwupgUpgradeCtx* pFwupgCtx);
|
||||||
@ -3154,68 +3152,63 @@ int HpmfwupgActivateFirmware(struct ipmi_intf *intf, struct HpmfwupgActivateFirm
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int HpmfwupgGetUpgradeStatus(struct ipmi_intf *intf, struct HpmfwupgGetUpgradeStatusCtx* pCtx,
|
int HpmfwupgGetUpgradeStatus(struct ipmi_intf *intf,
|
||||||
struct HpmfwupgUpgradeCtx* pFwupgCtx)
|
struct HpmfwupgGetUpgradeStatusCtx *pCtx,
|
||||||
|
struct HpmfwupgUpgradeCtx *pFwupgCtx,
|
||||||
|
int silent)
|
||||||
{
|
{
|
||||||
int rc = HPMFWUPG_SUCCESS;
|
int rc = HPMFWUPG_SUCCESS;
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
|
|
||||||
pCtx->req.picmgId = HPMFWUPG_PICMG_IDENTIFIER;
|
pCtx->req.picmgId = HPMFWUPG_PICMG_IDENTIFIER;
|
||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
req.msg.netfn = IPMI_NETFN_PICMG;
|
req.msg.netfn = IPMI_NETFN_PICMG;
|
||||||
req.msg.cmd = HPMFWUPG_GET_UPGRADE_STATUS;
|
req.msg.cmd = HPMFWUPG_GET_UPGRADE_STATUS;
|
||||||
req.msg.data = (unsigned char*)&pCtx->req;
|
req.msg.data = (unsigned char*)&pCtx->req;
|
||||||
req.msg.data_len = sizeof(struct HpmfwupgGetUpgradeStatusReq);
|
req.msg.data_len = sizeof(struct HpmfwupgGetUpgradeStatusReq);
|
||||||
|
|
||||||
rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx);
|
rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx);
|
||||||
|
if (!rsp){
|
||||||
|
lprintf(LOG_NOTICE,
|
||||||
|
"Error getting upgrade status. Failed to get response.");
|
||||||
|
return HPMFWUPG_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if ( rsp )
|
if ( rsp->ccode == 0x00 ) {
|
||||||
{
|
memcpy(&pCtx->resp, rsp->data,
|
||||||
if ( rsp->ccode == 0x00 )
|
sizeof(struct HpmfwupgGetUpgradeStatusResp));
|
||||||
{
|
if (!silent)
|
||||||
memcpy(&pCtx->resp, rsp->data, sizeof(struct HpmfwupgGetUpgradeStatusResp));
|
{
|
||||||
if ( verbose > 1 )
|
lprintf(LOG_NOTICE,"Upgrade status:");
|
||||||
{
|
lprintf(LOG_NOTICE," Command in progress: %x",
|
||||||
lprintf(LOG_NOTICE,"Upgrade status:");
|
pCtx->resp.cmdInProcess);
|
||||||
lprintf(LOG_NOTICE," Command in progress: %x", pCtx->resp.cmdInProcess);
|
lprintf(LOG_NOTICE," Last command completion code: %x",
|
||||||
lprintf(LOG_NOTICE," Last command completion code: %x", pCtx->resp.lastCmdCompCode);
|
pCtx->resp.lastCmdCompCode);
|
||||||
}
|
}
|
||||||
}
|
} else if ( HPMFWUPG_IS_RETRYABLE(rsp->ccode) ) {
|
||||||
/*
|
/*
|
||||||
* PATCH --> This validation is to handle retryables errors codes on IPMB bus.
|
* PATCH --> This validation is to handle retryable errors
|
||||||
* This will be fixed in the next release of open ipmi and this
|
* codes on the IPMB bus.
|
||||||
* check will have to be removed. (Buggy version = 39)
|
* This will be fixed in the next release of
|
||||||
*/
|
* open ipmi and this check can be removed.
|
||||||
else if ( HPMFWUPG_IS_RETRYABLE(rsp->ccode) )
|
* (Buggy version = 39)
|
||||||
{
|
*/
|
||||||
lprintf(LOG_DEBUG,"HPM: [PATCH]Retryable error detected");
|
if (!silent)
|
||||||
|
{
|
||||||
pCtx->resp.lastCmdCompCode = HPMFWUPG_COMMAND_IN_PROGRESS;
|
lprintf(LOG_DEBUG,"HPM: Retryable error detected");
|
||||||
}
|
}
|
||||||
else
|
pCtx->resp.lastCmdCompCode = HPMFWUPG_COMMAND_IN_PROGRESS;
|
||||||
{
|
} else {
|
||||||
if ( verbose )
|
|
||||||
{
|
|
||||||
lprintf(LOG_NOTICE,"Error getting upgrade status");
|
lprintf(LOG_NOTICE,"Error getting upgrade status");
|
||||||
lprintf(LOG_NOTICE,"compcode=0x%x: %s",
|
lprintf(LOG_NOTICE,"compcode=0x%x: %s",
|
||||||
rsp->ccode,
|
rsp->ccode,
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
rc = HPMFWUPG_ERROR;
|
return HPMFWUPG_ERROR;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( verbose )
|
|
||||||
{
|
|
||||||
lprintf(LOG_NOTICE,"Error getting upgrade status");
|
|
||||||
rc = HPMFWUPG_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
return HPMFWUPG_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int HpmfwupgManualFirmwareRollback(struct ipmi_intf *intf, struct HpmfwupgManualFirmwareRollbackCtx* pCtx,
|
int HpmfwupgManualFirmwareRollback(struct ipmi_intf *intf, struct HpmfwupgManualFirmwareRollbackCtx* pCtx,
|
||||||
@ -3698,7 +3691,7 @@ int HpmfwupgWaitLongDurationCmd(struct ipmi_intf *intf, struct HpmfwupgUpgradeCt
|
|||||||
/* Poll upgrade status until completion or timeout*/
|
/* Poll upgrade status until completion or timeout*/
|
||||||
timeoutSec1 = time(NULL);
|
timeoutSec1 = time(NULL);
|
||||||
timeoutSec2 = time(NULL);
|
timeoutSec2 = time(NULL);
|
||||||
rc = HpmfwupgGetUpgradeStatus(intf, &upgStatusCmd, pFwupgCtx);
|
rc = HpmfwupgGetUpgradeStatus(intf, &upgStatusCmd, pFwupgCtx, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
while(
|
while(
|
||||||
@ -3711,7 +3704,7 @@ int HpmfwupgWaitLongDurationCmd(struct ipmi_intf *intf, struct HpmfwupgUpgradeCt
|
|||||||
/* Must wait at least 1000 ms between status requests */
|
/* Must wait at least 1000 ms between status requests */
|
||||||
usleep(1000000);
|
usleep(1000000);
|
||||||
timeoutSec2 = time(NULL);
|
timeoutSec2 = time(NULL);
|
||||||
rc = HpmfwupgGetUpgradeStatus(intf, &upgStatusCmd, pFwupgCtx);
|
rc = HpmfwupgGetUpgradeStatus(intf, &upgStatusCmd, pFwupgCtx, 1);
|
||||||
//printf("Get Status: %x - %x = %x _ %x [%x]\n", timeoutSec2, timeoutSec1,(timeoutSec2 - timeoutSec1),upgradeTimeout, rc);
|
//printf("Get Status: %x - %x = %x _ %x [%x]\n", timeoutSec2, timeoutSec1,(timeoutSec2 - timeoutSec1),upgradeTimeout, rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3937,7 +3930,7 @@ int ipmi_hpmfwupg_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
{
|
{
|
||||||
struct HpmfwupgGetUpgradeStatusCtx cmdCtx;
|
struct HpmfwupgGetUpgradeStatusCtx cmdCtx;
|
||||||
verbose++;
|
verbose++;
|
||||||
rc = HpmfwupgGetUpgradeStatus(intf, &cmdCtx, NULL);
|
rc = HpmfwupgGetUpgradeStatus(intf, &cmdCtx, NULL, 0);
|
||||||
}
|
}
|
||||||
else if ( (argc == 1) && (strcmp(argv[0], "rollback") == 0) )
|
else if ( (argc == 1) && (strcmp(argv[0], "rollback") == 0) )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user