-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass ResetType to Manager.Reset (#345)
* expose the ActionInfo property under Actions under the Managers collection * differentiate between HPE systems and system that report SupportedResetTypes under actionsInfo
- Loading branch information
Showing
1 changed file
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -379,6 +379,8 @@ type Manager struct { | |
modifyRedundancySetTarget string | ||
// resetTarget is the internal URL to send reset targets to. | ||
resetTarget string | ||
// resetInfo contains URI for an ActionInfo Resource that describes this action. | ||
actionInfo string | ||
// SupportedResetTypes, if provided, is the reset types this system supports. | ||
SupportedResetTypes []ResetType | ||
resetToDefaultsTarget string | ||
|
@@ -393,6 +395,7 @@ func (manager *Manager) UnmarshalJSON(b []byte) error { | |
ForceFailover common.ActionTarget `json:"#Manager.ForceFailover"` | ||
ModifyRedundancySet common.ActionTarget `json:"#Manager.ModifyRedundancySet"` | ||
Reset struct { | ||
ActionInfo string `json:"@Redfish.ActionInfo"` | ||
AllowedResetTypes []ResetType `json:"[email protected]"` | ||
Target string | ||
} `json:"#Manager.Reset"` | ||
|
@@ -479,6 +482,7 @@ func (manager *Manager) UnmarshalJSON(b []byte) error { | |
manager.SupportedResetTypes = t.Actions.Reset.AllowedResetTypes | ||
manager.resetTarget = t.Actions.Reset.Target | ||
manager.resetToDefaultsTarget = t.Actions.ResetToDefaults.Target | ||
manager.actionInfo = t.Actions.Reset.ActionInfo | ||
|
||
// This is a read/write object, so we need to save the raw object data for later | ||
manager.rawData = b | ||
|
@@ -584,6 +588,14 @@ func (manager *Manager) ModifyRedundancySet(addManagers, removeManagers []*Manag | |
// Reset shall perform a reset of the manager. | ||
func (manager *Manager) Reset(resetType ResetType) error { | ||
if len(manager.SupportedResetTypes) == 0 { | ||
if manager.actionInfo != "" { | ||
// reset without confirming the type is supported by the manager. | ||
// done to minimize overhead though technically not as correct as first checking the supported reset types | ||
t := struct { | ||
ResetType ResetType | ||
}{ResetType: resetType} | ||
return manager.Post(manager.resetTarget, t) | ||
} | ||
// reset directly without reset type. HPE server has the behavior | ||
return manager.Post(manager.resetTarget, struct{}{}) | ||
} | ||
|