-
Notifications
You must be signed in to change notification settings - Fork 898
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
Provide base graph refresh attributes for ::Snapshot #17335
Conversation
Ignoring rubocop comment because we're following pattern used many times in this same file. Sorry dude for offending you once again! 😀 |
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 great 👍
yeah the rucocop rules were changed, I am ok with consistency, later we can run rubocop -a on all of these files, to enforce the new rules.
attributes = { | ||
:model_class => ::Snapshot, | ||
:association => :snapshots, | ||
:manager_ref => [:vm_or_template], |
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.
@miha-plesko hm, can we have more snapshots per Vm or Image? If yes, the manager_ref needs to have another column to uniquely identify them. Right now we are saying 1 snapshot per Vm/Image
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.
If I omit :manager_ref
it means it'll be inventoried based on snapshot's ems_ref
, right? We have unique ems_ref
on snapshot, let me try out.
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.
right, if you omit it, the default is manager_ref => [:ems_ref]
so might be that in this case we want manager_ref => [:vm_or_template, :ems_ref]
or if the :ems_ref is unique under the whole provider, just :manager_ref => [:ems_ref]
should be enough. Manager ref should serve as list of columns that are unique under manager
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.
to sum the choices:
1).
manager_ref => [:ems_ref]
which is the default, means :ems_ref is unique for the whole provider. Then we will just do .assign_attributes(:vm_or_template => parsed_vm)
in the parser to link them together, which will make sure we first save the Vm then Snapshot
2).
manager_ref => [:vm_or_template, :ems_ref]
means :ems_ref is unique under the Vm only.
Then with these we also have :parent_inventory_collections => [:vms, :miq_templates]
which says the Snapshot is nested to Vm(or template). That usually means we fetch it from DB through Vms. And the main implication for targeted refresh is we always need to provide all Snapshots with the Vm target. For API it usually means we can't we fetch me all snapshots
but we get them under the Vm only.
Witht this commit we provide base function to be used when inventoring snapshots. Signed-off-by: Miha Pleško <miha.plesko@xlab.si>
ebf8272
to
34e9197
Compare
Thanks for explanation @Ladas , for VMware option (2) seems more appropriate. I've updated the code accordingly . Will adjust the vmware PR as well, but locally it works already so many tanks 👍 |
Checked commit miha-plesko@34e9197 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 app/models/manager_refresh/inventory_collection_default/cloud_manager.rb
|
@miha-plesko awesome, I am trying to put together better documentation for |
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.
👍 LGTM
Provide base graph refresh attributes for ::Snapshot (cherry picked from commit 9e84461) https://bugzilla.redhat.com/show_bug.cgi?id=1584727
Gaprindashvili backport details:
|
With this commit we provide base function to be used when inventoring snapshots.
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1571120
@miq-bot assign @Ladas
@miq-bot add_label enhancement,gaprindashvili/yes
Related PR: ManageIQ/manageiq-providers-vmware#217