From a214cbb61c772f1990c6b0680fa36ca47cd6998f Mon Sep 17 00:00:00 2001 From: Ladislav Smola Date: Mon, 4 Sep 2017 15:35:32 +0200 Subject: [PATCH] Queue targeted refresh in a provisioning workflow Queue targeted refresh in a provisioning workflow if graph and targeted refresh are allowed. Otherwise queue a full refresh. --- .../cloud_manager/provision/state_machine.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/models/manageiq/providers/cloud_manager/provision/state_machine.rb b/app/models/manageiq/providers/cloud_manager/provision/state_machine.rb index 57b02c58e91..d0ab4a2e569 100644 --- a/app/models/manageiq/providers/cloud_manager/provision/state_machine.rb +++ b/app/models/manageiq/providers/cloud_manager/provision/state_machine.rb @@ -50,7 +50,18 @@ def poll_clone_complete if clone_status clone_task_ref = phase_context.delete(:clone_task_ref) phase_context[:new_vm_ems_ref] = clone_task_ref - EmsRefresh.queue_refresh(source.ext_management_system) + + manager_settings = Settings.ems_refresh[source.ext_management_system.class.ems_type] + if manager_settings[:inventory_object_refresh] && manager_settings[:allow_targeted_refresh] + # Queue new targeted refresh if allowed + vm_target = ManagerRefresh::Target.new(:manager => source.ext_management_system, + :association => :vms, + :manager_ref => {:ems_ref => clone_task_ref}) + EmsRefresh.queue_refresh(vm_target) + else + # Otherwise queue a full refresh + EmsRefresh.queue_refresh(source.ext_management_system) + end signal :poll_destination_in_vmdb else requeue_phase