diff --git a/app/models/manageiq/providers/vmware/infra_manager/refresher.rb b/app/models/manageiq/providers/vmware/infra_manager/refresher.rb index e4d7ebce1..507c9f8ab 100644 --- a/app/models/manageiq/providers/vmware/infra_manager/refresher.rb +++ b/app/models/manageiq/providers/vmware/infra_manager/refresher.rb @@ -22,8 +22,8 @@ def provider.use_vim_broker?; @__use_vim_broker; end def collect_inventory_for_targets(ems, targets) Benchmark.realtime_block(:get_ems_data) { get_ems_data(ems) } 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 @@ -139,7 +139,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 @@ -148,8 +148,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