Skip to content

Commit

Permalink
Collect storage profiles only on full refresh
Browse files Browse the repository at this point in the history
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
  • Loading branch information
agrare committed Jul 26, 2017
1 parent e56bb15 commit 6f6e0ee
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/models/manageiq/providers/vmware/infra_manager/refresher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 6f6e0ee

Please sign in to comment.