From 9c6163198970f467e03b14a6009d4824e7856360 Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Thu, 20 Jul 2017 12:31:14 -0400 Subject: [PATCH] Collect storage profiles only on full refresh The collection of storage profiles can take a long time and cannot be filtered by target causing targeted refreshes to take significantly longer under certain circumstances. https://bugzilla.redhat.com/show_bug.cgi?id=1473379 --- .../providers/vmware/infra_manager/refresher.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/models/manageiq/providers/vmware/infra_manager/refresher.rb b/app/models/manageiq/providers/vmware/infra_manager/refresher.rb index 0109b196f..bd994924e 100644 --- a/app/models/manageiq/providers/vmware/infra_manager/refresher.rb +++ b/app/models/manageiq/providers/vmware/infra_manager/refresher.rb @@ -21,8 +21,8 @@ def provider.use_vim_broker?; @__use_vim_broker; end def collect_inventory_for_targets(ems, targets) Benchmark.realtime_block(:get_vc_data) { get_vc_data(ems) } - Benchmark.realtime_block(:get_vc_data_storage_profile) { get_vc_data_storage_profile(ems) } + Benchmark.realtime_block(:get_vc_data_storage_profile) { get_vc_data_storage_profile(ems, targets) } Benchmark.realtime_block(:get_vc_data_ems_customization_specs) { get_vc_data_ems_customization_specs(ems) } if targets.include?(ems) # Filter the data, and determine for which hosts we will need to get extended data @@ -132,7 +132,7 @@ def get_vc_data(ems, accessors = VC_ACCESSORS_HASH, mor_filters = {}) EmsRefresh.log_inv_debug_trace(@vc_data, "#{_log.prefix} #{log_header} @vc_data:", 2) end - def get_vc_data_storage_profile(ems) + def get_vc_data_storage_profile(ems, targets) cleanup_callback = proc { @vc_data = nil } retrieve_from_vc(ems, cleanup_callback) do @@ -141,8 +141,11 @@ def get_vc_data_storage_profile(ems) unless @vc_data[:storage_profile].blank? storage_profile_ids = @vc_data[:storage_profile].keys - collect_and_log_inventory(ems, :storage_profile_datastore) { @vi.pbmQueryMatchingHub(storage_profile_ids) } - collect_and_log_inventory(ems, :storage_profile_entity) { @vi.pbmQueryAssociatedEntity(storage_profile_ids) } + collect_and_log_inventory(ems, :storage_profile_entity) { @vi.pbmQueryAssociatedEntity(storage_profile_ids) } + + if targets.include?(ems) + collect_and_log_inventory(ems, :storage_profile_datastore) { @vi.pbmQueryMatchingHub(storage_profile_ids) } + end end end end