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

Don't run EmsRefresh if using streaming refresh #284

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/models/manageiq/providers/vmware/infra_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class Vmware::InfraManager < InfraManager

supports :provisioning
supports :smartstate_analysis
supports :streaming_refresh do
unsupported_reason_add(:streaming_refresh, "Streaming refresh not enabled") unless streaming_refresh_enabled?
end

has_many :miq_scsi_targets, -> { distinct }, :through => :host_guest_devices
has_many :miq_scsi_luns, -> { distinct }, :through => :miq_scsi_targets
Expand All @@ -52,6 +55,10 @@ def supported_catalog_types
%w(vmware)
end

def streaming_refresh_enabled?
Settings.prototype.ems_vmware.update_driven_refresh
end

def remote_console_vmrc_acquire_ticket
vim = connect(:auth_type => :console)
ticket = vim.acquireCloneTicket
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,22 @@ def after_initialize
def do_before_work_loop
# Override Standard EmsRefreshWorker's method of queueing up a Refresh
# This will be done by the VimBrokerWorker, when he is ready.
return unless update_driven_refresh?
return unless ems.supports_streaming_refresh?

start_inventory_collector
end

def before_exit(_message, _exit_code)
stop_inventory_collector if inventory_collector_running?
stop_inventory_collector if ems.supports_streaming_refresh?
end

def message_delivery_suspended?
# If we are using streaming refresh don't dequeue EmsRefresh queue items
ems.supports_streaming_refresh? || super
end

def do_work
if update_driven_refresh?
if ems.supports_streaming_refresh?
ensure_inventory_collector
elsif inventory_collector_running?
stop_inventory_collector
Expand Down Expand Up @@ -69,8 +74,4 @@ def stop_inventory_collector
def inventory_collector_running?
collector_thread&.alive?
end

def update_driven_refresh?
Settings.prototype.ems_vmware.update_driven_refresh
end
end