-
Notifications
You must be signed in to change notification settings - Fork 125
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 ID references to PhysicalDisks and Canisters #285
Add ID references to PhysicalDisks and Canisters #285
Conversation
bb47374
to
9ff263c
Compare
9ff263c
to
1e3ea87
Compare
@@ -0,0 +1,5 @@ | |||
class AddUidEmsToPhysicalDisks < ActiveRecord::Migration[5.0] | |||
def change | |||
add_column :physical_disks, :uid_ems, :string |
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.
These don't need to be in separate migrations
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.
@agrare Changed it to be in only one migration.
@@ -0,0 +1,5 @@ | |||
class AddCanisterIdToPhysicalDisks < ActiveRecord::Migration[5.0] | |||
def change | |||
add_column :physical_disks, :canister_id, :bigint |
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.
You can use add_reference
e.g. add_reference :physical_disks, :canister, :type => :bigint
ref
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.
@agrare In this case, this affect the way we use canister_id
on save_inventory_physical_infra
, right?
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.
Not sure what you mean
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.
@agrare What I asked is if this affects the way we update the associated IDs for PhysicalDisks on save_inventory_physical_infra
, more specifically on h[:canister_id] = h.delete(:canister).try(:[], :id)
, or if canister_id
column will still exist if we use add_reference
and nothing else has to change.
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.
add_reference will result in a canister_id
column
@EsdrasVP what was the primary unique reference in physical_disks if there wasn't a uid_ems? Addind a uid_ems implies like a physical disk can be uniquely identified across all providers, and an ems_ref would imply a physical disk can be uniquely identified under a single provider and should have an ems_id also. |
1e3ea87
to
95e3d01
Compare
@EsdrasVP wait a minute, looking at your physical infra save_inventory and the find_key for physical_disks is
Are you every seeing more than one disk on a physical storage today? |
@agrare The thing is there was no unique identifier on a PhysicalDisk, actually. As you said, the closest field that we can considerate a unique one is |
@agrare Yes, currently there is at least 12 disk slots on the storage. So what we parse could be an array of physical disks. Also, I changed it to adapt to this implementation here. |
No I mean looking at save_inventory_physical_infra I bet that there is only ever a single physical_disk because the find_key is Looking at the specs for physical storage/disks in your provider repo there are 0 checks for anything related to physical disks in the refresher_spec. There are checks on the parser but the storage being checked in Did you test a refresh and confirm that you got 1-12 physical disks on a physical storage?
These are things that need to be figured out the first time we add the schema. I don't see it in the PR but I talked to you offline and believed that you were using I'm okay adding this but really this should have been there from the start. What is the content of uid_ems going to be from the parser? Is it something that we can populate here with a data migration? If not now there are databases with records that we probably cannot update to a consistent state without running a refresh. |
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.
Going to put a block on this pending adequate specs in ManageIQ/manageiq-providers-lenovo#235 (review) and we have confirmed this works end-to-end.
@agrare The storage I test on
Sorry for the confusion, I must have interpreted it wrong because I thought that the
Since there is no unique identifier on a physical disk, we decided to use a concatenation of the physical disk parent uuid/serial_number with the disk index. I'm still trying to reach the team responsible for the response that we parse to confirm that, so that's why I let the PRs as WIP. |
95e3d01
to
ef2a7cd
Compare
Then they aren't being saved:
Nothing wrong with confusion but this would have been found out by either a quick test against a live system and confirming that physical_storage.physical_disks.count is what you expect it to be, or by good spec tests. |
@agrare They were not being saved on the second turn of full refresh on |
for graph refresh (ManageIQ/manageiq-providers-lenovo#236), In case of canisters I think there can be used @EsdrasVP I think there can be About
It seems like redundant information. @agrare Is there significant speed or other improvement when |
@slemrmartin yeah I agree it seems redundant to have the parent uuid in the unique ref when these already belong_to a physical_storage or canister. I'd be okay adding an ems_ref to physical_disks and just also storing the serial number there in the lenovo parser since other physical infra providers might have different unique values other than serial number. |
@slemrmartin I agree, it would be much better to do that, we would only have to change parser and inventory saving a little bit. I'll ask the team what they think of that, but for me that's fine.
I used the parent UUID in cases where |
@EsdrasVP ems_ref can't be nil but it also can't be parent_uuid if there are more than one disk under a parent which there can be right? |
@agrare Yeah, that's why I made Physical Disk |
@EsdrasVP so is parent_uuid the uid of the storage system or something else? This might be better discusses in the manageiq-providers-lenovo parser PR since from a schema point of view we just need some ems_ref which is unique under the parent. |
@agrare Yeah, it is the Physical Storage uid. We can migrate the discussion to the other PR then. |
ef2a7cd
to
08ab2a8
Compare
Checked commit EsdrasVP@08ab2a8 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
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 is generic enough that I'm okay with it, we can work through the issues with the parser on that PR
This PR is able to:
ems_ref
to PhysicalDisks