-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add physical racks and chassis #33
Add physical racks and chassis #33
Conversation
This pull request is not mergeable. Please rebase and repush. |
733e690
to
aa08797
Compare
@miq-bot add_label hammer/yes |
end | ||
|
||
def physical_chassis | ||
rf_client.Chassis.Members.reject { |c| c.ChassisType == "Rack" } |
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.
Looks like this could be cached so you don't have to make the same call twice.
Could you add a private method chassis_members
where you @chassis_members ||= rf_client.Chassis.Members
?
Then you can just chassis_members.select
/ chassis_members.reject
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.
Redfish client already does caching on its own, so adding another layer of cache is not strictly necessary since data is already only fetched once. But I can add it if you feel that this would make things more obvious.
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.
Ah okay didn't know this
next unless enclosure_id | ||
|
||
rack = persister.physical_racks.lazy_find(enclosure_id) | ||
server.assign_attributes(:physical_rack => rack) |
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.
Hm since you're doing the .build
right above you can probably just do this above and pass these in to the .build
arg.
:ems_ref => c["@odata.id"], | ||
:health_state => c.Status.Health, | ||
:name => c.Id, | ||
:type => "ManageIQ::Providers::Redfish::PhysicalInfraManager::PhysicalChassis", |
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.
Try leaving the type out and see if it gets the right STI class, we should be automatically building this now.
next unless parent_id | ||
|
||
parent_chassis = persister.physical_chassis.lazy_find(parent_id) | ||
chassis.assign_attributes(:parent_physical_chassis => parent_chassis) |
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.
Similar comment here you should be able to just pass these into the build, instead of the next you can just do parent_chassis = persister.physical_chassis.lazy_find(parent_id) if parent_id
def physical_chassis_details | ||
collector.physical_chassis.each do |c| | ||
chassis = persister.physical_chassis.lazy_find(c["@odata.id"]) | ||
location = get_chassis_location(c) |
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.
More like this 👍
aa08797
to
1bc87c8
Compare
Checked commits xlab-si/manageiq-providers-redfish@2f6bcc7~...1bc87c8 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 **
|
Add physical racks and chassis (cherry picked from commit e691021)
Hammer backport details:
|
Depends on #32@miq-bot add_label wip