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

Provide base graph refresh attributes for ::Snapshot #17335

Merged
merged 1 commit into from
Apr 24, 2018

Conversation

miha-plesko
Copy link
Contributor

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

@miha-plesko
Copy link
Contributor Author

Ignoring rubocop comment because we're following pattern used many times in this same file. Sorry dude for offending you once again! 😀

Copy link
Contributor

@Ladas Ladas left a 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.

@Ladas
Copy link
Contributor

Ladas commented Apr 24, 2018

@miq-bot assign @agrare

@miq-bot miq-bot assigned agrare and unassigned Ladas Apr 24, 2018
attributes = {
:model_class => ::Snapshot,
:association => :snapshots,
:manager_ref => [:vm_or_template],
Copy link
Contributor

@Ladas Ladas Apr 24, 2018

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

Copy link
Contributor Author

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.

Copy link
Contributor

@Ladas Ladas Apr 24, 2018

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

Copy link
Contributor

@Ladas Ladas Apr 24, 2018

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>
@miha-plesko
Copy link
Contributor Author

miha-plesko commented Apr 24, 2018

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 👍

@miq-bot
Copy link
Member

miq-bot commented Apr 24, 2018

Checked commit miha-plesko@34e9197 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 2 offenses detected

app/models/manager_refresh/inventory_collection_default/cloud_manager.rb

@Ladas
Copy link
Contributor

Ladas commented Apr 24, 2018

@miha-plesko awesome, I am trying to put together better documentation for parent_inventory_collections here #17336

Copy link
Member

@agrare agrare left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@agrare agrare merged commit 9e84461 into ManageIQ:master Apr 24, 2018
@agrare agrare added this to the Sprint 84 Ending Apr 23, 2018 milestone Apr 26, 2018
simaishi pushed a commit that referenced this pull request May 31, 2018
Provide base graph refresh attributes for ::Snapshot
(cherry picked from commit 9e84461)

https://bugzilla.redhat.com/show_bug.cgi?id=1584727
@simaishi
Copy link
Contributor

Gaprindashvili backport details:

$ git log -1
commit b991f9cb9a855e007831aadba36ba1e2cbe2f055
Author: Adam Grare <agrare@redhat.com>
Date:   Tue Apr 24 07:55:57 2018 -0400

    Merge pull request #17335 from miha-plesko/graph-refresh-snapshot
    
    Provide base graph refresh attributes for ::Snapshot
    (cherry picked from commit 9e84461b9f0de87fd56b88e895bef2dce9cc7035)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1584727

@miha-plesko miha-plesko deleted the graph-refresh-snapshot branch January 7, 2019 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants