1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Adding 'Links' to the parameter list for data retrieved from get_disk_inventory (#6819)

* Adding 'Links' parameter to be retrieved from get_disk_inventory

* Adding changelog fragment

* Updating as per PR suggestions

* Updating to return volumes as a list of strings

* Updating code to retrieve only volumes under the Links parameter

* Updating changelog fragment

* Update changelogs/fragments/6819-redfish-utils-add-links-parameter-for-get_disk_inventory.yml

Agreed

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Kushal <t-s.kushal@hpe.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
TSKushal 2023-08-22 00:49:53 +05:30 committed by GitHub
parent eaf3926c2c
commit 17dce5a288
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- redfish_utils module utils - support ``Volumes`` in response for ``GetDiskInventory`` (https://github.com/ansible-collections/community.general/pull/6819).

View file

@ -791,7 +791,7 @@ class RedfishUtils(object):
properties = ['BlockSizeBytes', 'CapableSpeedGbs', 'CapacityBytes',
'EncryptionAbility', 'EncryptionStatus',
'FailurePredicted', 'HotspareType', 'Id', 'Identifiers',
'Manufacturer', 'MediaType', 'Model', 'Name',
'Links', 'Manufacturer', 'MediaType', 'Model', 'Name',
'PartNumber', 'PhysicalLocation', 'Protocol', 'Revision',
'RotationSpeedRPM', 'SerialNumber', 'Status']
@ -861,7 +861,12 @@ class RedfishUtils(object):
for property in properties:
if property in data:
if data[property] is not None:
drive_result[property] = data[property]
if property == "Links":
if "Volumes" in data["Links"].keys():
volumes = [v["@odata.id"] for v in data["Links"]["Volumes"]]
drive_result["Volumes"] = volumes
else:
drive_result[property] = data[property]
drive_results.append(drive_result)
drives = {'Controller': controller_name,
'Drives': drive_results}