ID: 70 - Fixes and updates for ipmitool hpm

Added a '^' character to the ID field which will be set if the
component can be upgraded with the specified file with the 'hpm check
<file>' subcommand.

Commit for Dan Gora
This commit is contained in:
Zdenek Styblik 2013-07-17 10:22:37 +00:00
parent bf8acad458
commit 30e4efe8a4

View File

@ -1133,10 +1133,10 @@ void HpmDisplayLine(char *s, int n)
void HpmDisplayUpgradeHeader(int option) void HpmDisplayUpgradeHeader(int option)
{ {
printf("\n"); printf("\n");
HpmDisplayLine("-",78 ); HpmDisplayLine("-",79 );
printf("|ID | Name | Versions | %% |\n"); printf("|ID | Name | Versions | %% |\n");
printf("| | | Active | Backup | File | |\n"); printf("| | | Active | Backup | File | |\n");
printf("|---|-----------|-----------------|-----------------|-----------------|------|\n"); printf("|----|-----------|-----------------|-----------------|-----------------|------|\n");
} }
/**************************************************************************** /****************************************************************************
@ -1187,17 +1187,17 @@ void HpmDisplayVersionHeader(int mode)
{ {
if ( mode & IMAGE_VER) if ( mode & IMAGE_VER)
{ {
HpmDisplayLine("-",71 ); HpmDisplayLine("-",72 );
printf("|ID | Name | Versions |\n"); printf("|ID | Name | Versions |\n");
printf("| | | Active | Backup | File |\n"); printf("| | | Active | Backup | File |\n");
HpmDisplayLine("-",71 ); HpmDisplayLine("-",72 );
} }
else else
{ {
HpmDisplayLine("-",53 ); HpmDisplayLine("-",54 );
printf("|ID | Name | Versions |\n"); printf("|ID | Name | Versions |\n");
printf("| | | Active | Backup |\n"); printf("| | | Active | Backup |\n");
HpmDisplayLine("-",53 ); HpmDisplayLine("-",54 );
} }
} }
@ -1208,7 +1208,7 @@ void HpmDisplayVersionHeader(int mode)
* Description: This function displays the version of the image and target * Description: This function displays the version of the image and target
* *
*****************************************************************************/ *****************************************************************************/
void HpmDisplayVersion(int mode,VERSIONINFO *pVersion) void HpmDisplayVersion(int mode, VERSIONINFO *pVersion, int upgradable)
{ {
char descString[12]; char descString[12];
memset(&descString,0x00,12); memset(&descString,0x00,12);
@ -1222,7 +1222,10 @@ void HpmDisplayVersion(int mode,VERSIONINFO *pVersion)
* so that user is aware that he needs to do payload power * so that user is aware that he needs to do payload power
* cycle after upgrade * cycle after upgrade
*/ */
printf("|%c%-2d|%-11s|",pVersion->coldResetRequired?'*':' ',pVersion->componentId,descString); printf("|%c%c%2d|%-11s|",
pVersion->coldResetRequired?'*':' ',
upgradable ? '^': ' ',
pVersion->componentId,descString);
if (mode & TARGET_VER) if (mode & TARGET_VER)
{ {
@ -1411,7 +1414,7 @@ int HpmfwupgTargetCheck(struct ipmi_intf * intf, int option)
} }
if (option & VIEW_MODE) if (option & VIEW_MODE)
{ {
HpmDisplayVersion(mode,&gVersionInfo[componentId]); HpmDisplayVersion(mode,&gVersionInfo[componentId], 0);
printf("\n"); printf("\n");
} }
} }
@ -2017,7 +2020,7 @@ int HpmfwupgPreUpgradeCheck(struct ipmi_intf *intf,
if (option & VIEW_MODE) { if (option & VIEW_MODE) {
if (pVersionInfo->rollbackSupported) if (pVersionInfo->rollbackSupported)
mode |= ROLLBACK_VER; mode |= ROLLBACK_VER;
HpmDisplayVersion(mode,pVersionInfo); HpmDisplayVersion(mode,pVersionInfo, upgrade_comp);
printf("\n"); printf("\n");
} }
pImagePtr = pData + firmwareLength; pImagePtr = pData + firmwareLength;
@ -2032,10 +2035,11 @@ int HpmfwupgPreUpgradeCheck(struct ipmi_intf *intf,
} }
if (option & VIEW_MODE) { if (option & VIEW_MODE) {
HpmDisplayLine("-",71); HpmDisplayLine("-",72);
if (flagColdReset) { if (flagColdReset) {
fflush(stdout); fflush(stdout);
lprintf(LOG_NOTICE,"(*) Component requires Payload Cold Reset"); lprintf(LOG_NOTICE,"(*) Component requires Payload Cold Reset");
lprintf(LOG_NOTICE,"(^) Indicates component would be upgraded");
} }
} }
return HPMFWUPG_SUCCESS; return HPMFWUPG_SUCCESS;
@ -2255,7 +2259,7 @@ static int HpmFwupgActionUploadFirmware
} }
else else
{ {
HpmDisplayVersion(mode,pVersionInfo); HpmDisplayVersion(mode,pVersionInfo, 0);
} }
if( (1 << componentId) & pFwupgCtx->compUpdateMask.ComponentBits.byte) if( (1 << componentId) & pFwupgCtx->compUpdateMask.ComponentBits.byte)