Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose the ActionInfo property under Actions under the Managers colle… #345

Merged
merged 3 commits into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions redfish/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"`
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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{}{})
}
Expand Down