[PR #8164/e4e091ac backport][stable-8] Redfish: implementing ResetToDefaults (#8182)

Redfish: implementing ResetToDefaults (#8164)

Fixing #8163

Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
(cherry picked from commit e4e091acca)

Co-authored-by: Boris Glimcher <36732377+glimchb@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2024-04-03 19:55:35 +02:00 committed by GitHub
parent bdd046b411
commit 07f1e0feba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 67 additions and 0 deletions

View file

@ -281,6 +281,12 @@ options:
- BIOS attributes that needs to be verified in the given server.
type: dict
version_added: 6.4.0
reset_to_defaults_mode:
description:
- Mode to apply when reseting to default.
type: str
choices: [ ResetAll, PreserveNetworkAndUsers, PreserveNetwork ]
version_added: 8.6.0
author:
- "Jose Delarosa (@jose-delarosa)"
@ -714,6 +720,13 @@ EXAMPLES = '''
command: PowerReboot
resource_id: BMC
- name: Factory reset manager to defaults
community.general.redfish_command:
category: Manager
command: ResetToDefaults
resource_id: BMC
reset_to_defaults_mode: ResetAll
- name: Verify BIOS attributes
community.general.redfish_command:
category: Systems
@ -764,6 +777,7 @@ CATEGORY_COMMANDS_ALL = {
"UpdateAccountServiceProperties"],
"Sessions": ["ClearSessions", "CreateSession", "DeleteSession"],
"Manager": ["GracefulRestart", "ClearLogs", "VirtualMediaInsert",
"ResetToDefaults",
"VirtualMediaEject", "PowerOn", "PowerForceOff", "PowerForceRestart",
"PowerGracefulRestart", "PowerGracefulShutdown", "PowerReboot"],
"Update": ["SimpleUpdate", "MultipartHTTPPushUpdate", "PerformRequestedOperations"],
@ -825,6 +839,7 @@ def main():
)
),
strip_etag_quotes=dict(type='bool', default=False),
reset_to_defaults_mode=dict(choices=['ResetAll', 'PreserveNetworkAndUsers', 'PreserveNetwork']),
bios_attributes=dict(type="dict")
),
required_together=[
@ -1017,6 +1032,8 @@ def main():
result = rf_utils.virtual_media_insert(virtual_media, category)
elif command == 'VirtualMediaEject':
result = rf_utils.virtual_media_eject(virtual_media, category)
elif command == 'ResetToDefaults':
result = rf_utils.manager_reset_to_defaults(module.params['reset_to_defaults_mode'])
elif category == "Update":
# execute only if we find UpdateService resources