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

Use targeted refresh during transformation #381

Merged
merged 2 commits into from
Jul 30, 2018

Conversation

ghost
Copy link

@ghost ghost commented Jul 30, 2018

Previously, during transformation, we triggered a full refresh to be sure that the VM was in the inventory for the post migration steps. But, this consumed a lot of resources compared to the single VM we want to track. And on a huge inventory with thousands of VMs, triggering a full refresh for each migration can soon be problematic.

This PR adds a new instance in the event switchboard that triggers a targeted refresh for the associated VM. The event is named VM_IMPORT_FROM_CONFIGURATION_EXECUTED_SUCCESSFULLY.

Associated RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1607368

@ghost
Copy link
Author

ghost commented Jul 30, 2018

@miq-bot add-label transformation
@miq-bot add-label enhancement
@miq-bot add-label gaprindashvili/yes
@miq-bot add-label blocker

@@ -16,27 +16,13 @@ def main
destination_vm = ManageIQ::Automate::Transformation::Infrastructure::VM::RedHat::Utils.new(destination_ems).vm_find_by_name(source_vm.name)
raise "VM #{source_vm.name} not found in destination provider #{destination_ems.name}" if destination_vm.nil?

finished = false

destination_vm_vmdb = @handle.vmdb(:vm).where(["ems_ref = ?", destination_vm.href.gsub(/^\/ovirt-engine/, '')]).first
Copy link
Member

Choose a reason for hiding this comment

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

Realize this is outside of the changes in this PR but future refactorings should be:

destination_vm_vmdb = @handle.vmdb(:vm).find_by(:ems_ref => destination_vm.href.gsub(/^\/ovirt-engine/, ''))

Copy link
Author

Choose a reason for hiding this comment

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

Changed. I suppose it has better performance.

@gmcculloug gmcculloug changed the title Use targeted refresh during transofrmation Use targeted refresh during transformation Jul 30, 2018
@miq-bot
Copy link
Member

miq-bot commented Jul 30, 2018

Checked commits fabiendupont/manageiq-content@c8cfa2c~...7be7554 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 👍

@gmcculloug gmcculloug self-assigned this Jul 30, 2018
@gmcculloug gmcculloug merged commit 4a91827 into ManageIQ:master Jul 30, 2018
@gmcculloug gmcculloug added this to the Sprint 91 Ending Jul 30, 2018 milestone Jul 30, 2018
@ghost ghost deleted the v2v_use_targeted_refresh branch July 31, 2018 07:13
simaishi pushed a commit that referenced this pull request Jul 31, 2018
@simaishi
Copy link
Contributor

Gaprindashvili backport details:

$ git log -1
commit f559300aad804be604f5b8bc3f5f9fd0a22e36dd (HEAD -> gaprindashvili, origin/gaprindashvili)
Author: Greg McCullough <[email protected]>
Date:   Mon Jul 30 15:33:29 2018 -0400

    Merge pull request #381 from fdupont-redhat/v2v_use_targeted_refresh
    
    Use targeted refresh during transformation
    (cherry picked from commit 4a918271d51c80cfc56941501754249b9ef1767a)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1610550

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.

4 participants