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

Fixing Computer System relationship on Physical Storage #17945

Merged
merged 1 commit into from
Sep 5, 2018
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
10 changes: 6 additions & 4 deletions app/models/physical_storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ class PhysicalStorage < ApplicationRecord
has_one :asset_detail, :as => :resource, :dependent => :destroy, :inverse_of => false

has_many :canisters, :dependent => :destroy, :inverse_of => false
has_many :computer_system, :through => :canisters
has_many :hardware, :through => :computer_system
has_many :guest_devices, :through => :canisters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to delete these? Thought you just had to change to `:computer_systems

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agrare Initially I thought that just fix the pluralization would do the job, but talking with the team we noted that it didn't make sense to let these relationships on PhysicalStorage since they're already in Canister. So I updated this PR title and description to fit the changes.

Copy link
Contributor

@himdel himdel Sep 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from the UI side, no problem with this, the failing test caused by the other PR was really just the rename, fixed in ManageIQ/manageiq-ui-classic#4602 (so we're no longer touching PhysicalStorage#computer_system at all)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 sorry for the disruption @himdel


has_many :physical_disks, :dependent => :destroy, :inverse_of => :physical_storage

has_one :computer_system, :as => :managed_entity, :dependent => :destroy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're still missing the previous relations (:hardware, :guest_devices)

IMO this should go back to before #17706 and just add has_many :canisters and has_many :canister_computer_systems

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agrare Fixed it, and put :guest_devices through :hardware in order to be more general for other providers.

has_one :hardware, :through => :computer_system

has_many :canister_computer_systems, :through => :canisters, :source => :computer_system
has_many :guest_devices, :through => :hardware

supports :refresh_ems

def my_zone
Expand Down