-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fixing bug in get_volume_inventory #6719
Fixing bug in get_volume_inventory #6719
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution. I've added a first comment.
changelogs/fragments/6719-redfish-utils-fix-for-get-volume-inventory.yml
Outdated
Show resolved
Hide resolved
…entory.yml Agreed Co-authored-by: Felix Fontein <felix@fontein.de>
changelogs/fragments/6719-redfish-utils-fix-for-get-volume-inventory.yml
Outdated
Show resolved
Hide resolved
…entory.yml Agreed Co-authored-by: Felix Fontein <felix@fontein.de>
else: | ||
sc_id = sc[0].get('Id', '1') | ||
controller_name = 'Controller %s' % sc_id | ||
if 'Name' in data: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic isn't correct; this pulls the name of the storage subsystem rather than of the storage controller.
Inside the Storage resource is a "StorageControllers" property; this property contains the set of storage controllers in the storage subsystem, which is what this controller_list
is intended to contain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this is under a for loop which is iterating through each controller.
for controller in data[u'Members']:
controller_list.append(controller[u'@odata.id'])
for c in controller_list:
uri = self.root_uri + c
response = self.get_request(uri)
if response['ret'] is False:
return response
data = response['data']
controller_name = 'Controller 1'
if 'StorageControllers' in data:
sc = data['StorageControllers']
if sc:
if 'Name' in sc[0]:
controller_name = sc[0]['Name']
else:
sc_id = sc[0].get('Id', '1')
controller_name = 'Controller %s' % sc_id
if 'Name' in data:
@TSKushal can you please show what's inside of your Storage resources? Reviewing the logic in place today I believe the behavior is correct and the issue lies with the Redfish service not providing proper names for storage controllers. |
This statement is not correct; the name at that level per the spec is for the Storage resource and not the individual controller (or controllers) inside that storage subsystem. Clients need to step into the controllers array to extract the name information for the controllers. |
Correct, I didn't mean at /redfish/v1/Systems/1/Storage/ level. |
Redfish responses /redfish/v1/Systems/1/Storage/
/redfish/v1/Systems/1/Storage/DE00B000/
/redfish/v1/Systems/1/Storage/DE00A000/
|
For /redfish/v1/Systems/1/Storage/DE00A000/, the StorageControllers array does not contain names of the storage controllers. It just contains "MemberId", but no "Name" property, which is why the logic is entering the default naming case. For /redfish/v1/Systems/1/Storage/DE00B000/, that storage resource instead contains a "Controllers" resource collection rather than "StorageControllers". This is valid, and I would propose we should modify the logic to step into "Controllers" and extract the controller names via their dedicated resources if this is present. |
This was going to be my initial change, but then I observed that "/redfish/v1/Systems/1/Storage/DE00A000#/StorageControllers/0" contains the same name,
Is there any case where the Name directly under "/redfish/v1/Systems/1/Storage/DE00A000" and "/redfish/v1/Systems/1/Storage/DE00A000#/StorageControllers/0" will not be same? |
I would never expect them to be the same; "Name" inside of "/redfish/v1/Systems/1/Storage/DE00A000" (or any Storage resource) is the name of the storage subsystem; this is independent of the controller name. |
Ah alright, I think I got confused with the subsystem name and the actual controller name. Will make the changes as suggested. |
@mraineri any updates on this? |
@@ -912,7 +912,26 @@ def get_volume_inventory(self, systems_uri): | |||
else: | |||
sc_id = sc[0].get('Id', '1') | |||
controller_name = 'Controller %s' % sc_id | |||
if 'Controllers' in data: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make this an elif
; if StorageControllers
was found, there's no need to step into Controllers
. Both will represent the same storage controllers in the storage subsystem. It's possible for a service to implement both in order to support clients that expect the older method (StorageControllers
) and to support clients that expect the newer method (Controllers
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point. Changing as suggested.
shipit |
Backport to stable-6: 💚 backport PR created✅ Backport PR branch: Backported as #6791 🤖 @patchback |
* Fixing bug in get_volume_inventory * Adding changelog fragment * sanity fix * Update changelogs/fragments/6719-redfish-utils-fix-for-get-volume-inventory.yml Agreed Co-authored-by: Felix Fontein <felix@fontein.de> * Updating changelog fragment * Update changelogs/fragments/6719-redfish-utils-fix-for-get-volume-inventory.yml Agreed Co-authored-by: Felix Fontein <felix@fontein.de> * Updating changes as per PR comments * PR comment changes --------- Co-authored-by: Kushal <t-s.kushal@hpe.com> Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 22efbcc)
Backport to stable-7: 💚 backport PR created✅ Backport PR branch: Backported as #6792 🤖 @patchback |
* Fixing bug in get_volume_inventory * Adding changelog fragment * sanity fix * Update changelogs/fragments/6719-redfish-utils-fix-for-get-volume-inventory.yml Agreed Co-authored-by: Felix Fontein <felix@fontein.de> * Updating changelog fragment * Update changelogs/fragments/6719-redfish-utils-fix-for-get-volume-inventory.yml Agreed Co-authored-by: Felix Fontein <felix@fontein.de> * Updating changes as per PR comments * PR comment changes --------- Co-authored-by: Kushal <t-s.kushal@hpe.com> Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 22efbcc)
…tory (#6792) Fixing bug in get_volume_inventory (#6719) * Fixing bug in get_volume_inventory * Adding changelog fragment * sanity fix * Update changelogs/fragments/6719-redfish-utils-fix-for-get-volume-inventory.yml Agreed Co-authored-by: Felix Fontein <felix@fontein.de> * Updating changelog fragment * Update changelogs/fragments/6719-redfish-utils-fix-for-get-volume-inventory.yml Agreed Co-authored-by: Felix Fontein <felix@fontein.de> * Updating changes as per PR comments * PR comment changes --------- Co-authored-by: Kushal <t-s.kushal@hpe.com> Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 22efbcc) Co-authored-by: TSKushal <44438079+TSKushal@users.noreply.github.com>
…tory (#6791) Fixing bug in get_volume_inventory (#6719) * Fixing bug in get_volume_inventory * Adding changelog fragment * sanity fix * Update changelogs/fragments/6719-redfish-utils-fix-for-get-volume-inventory.yml Agreed Co-authored-by: Felix Fontein <felix@fontein.de> * Updating changelog fragment * Update changelogs/fragments/6719-redfish-utils-fix-for-get-volume-inventory.yml Agreed Co-authored-by: Felix Fontein <felix@fontein.de> * Updating changes as per PR comments * PR comment changes --------- Co-authored-by: Kushal <t-s.kushal@hpe.com> Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 22efbcc) Co-authored-by: TSKushal <44438079+TSKushal@users.noreply.github.com>
SUMMARY
Fixing issues found in GetVolumeInventory. The issues are as below:
ISSUE TYPE
COMPONENT NAME
redfish_utils.py
ADDITIONAL INFORMATION
Sample .yaml used
Output before suggested code change:
Output after suggested code change: