Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove use_vim_broker and reset_vim_cache
Browse files Browse the repository at this point in the history
agrare committed Jan 3, 2020
1 parent 8b44a71 commit ae7a9a9
Showing 3 changed files with 0 additions and 49 deletions.
27 changes: 0 additions & 27 deletions app/models/manageiq/providers/vmware/infra_manager.rb
Original file line number Diff line number Diff line change
@@ -168,12 +168,6 @@ def validate_remote_console_webmks_support
raise(MiqException::RemoteConsoleNotSupportedError, "vCenter version #{api_version} does not support WebMKS remote console.") unless api_version >= "6.0"
end

def self.use_vim_broker?
false
end

delegate :use_vim_broker?, :to => :class

def self.event_monitor_class
self::EventCatcher
end
@@ -209,27 +203,6 @@ def verify_credentials(auth_type = nil, _options = {})
self.class.raw_connect(:use_broker => false, :ems => self)
end

def reset_vim_cache
return unless self.use_vim_broker?
with_provider_connection do |vim|
_log.info("Resetting broker cache for EMS id: [#{id}]")
vim.resetCache
end
end

def reset_vim_cache_queue
return unless self.use_vim_broker?
MiqQueue.put(
:class_name => self.class.name,
:method_name => "reset_vim_cache",
:instance_id => id,
:priority => MiqQueue::HIGH_PRIORITY,
:queue_name => MiqEmsRefreshWorker.queue_name_for_ems(self),
:zone => my_zone,
:role => "ems_inventory"
)
end

def get_alarms
with_provider_connection do |vim|
miqAm = vim.getVimAlarmManager
Original file line number Diff line number Diff line change
@@ -62,28 +62,8 @@ def customize_destination
signal :autostart_destination
end

def autostart_destination
if get_option(:vm_auto_start)
message = "Starting"
_log.info("#{message} #{for_destination}")
update_and_notify_parent(:message => message)
start_with_cache_reset
end

signal :post_create_destination
end

private

# NOTE: Due to frequent problems with cache not containing the new VM we need to clear the cache and try again.
def start_with_cache_reset
destination.start
rescue MiqException::MiqVimResourceNotFound
_log.info("Unable to start #{for_destination}. Retrying after VIM cache reset.")
destination.ext_management_system.reset_vim_cache
destination.start
end

def powered_off_in_provider?
destination.with_provider_object(&:poweredOff?)
end
Original file line number Diff line number Diff line change
@@ -171,15 +171,13 @@
@vm_prov.options[:vm_auto_start] = true
allow(@vm_prov.destination).to receive(:start).and_raise
expect(@vm_prov.destination).to receive(:start).once
expect(@ems).to receive(:reset_vim_cache).never
@vm_prov.signal :autostart_destination
end

it "autostart_destination with MiqVimResourceNotFound" do
@vm_prov.options[:vm_auto_start] = true
allow(@vm_prov.destination).to receive(:start).and_raise(MiqException::MiqVimResourceNotFound)
expect(@vm_prov.destination).to receive(:start).twice
expect(@ems).to receive(:reset_vim_cache).once
@vm_prov.signal :autostart_destination
end
end

0 comments on commit ae7a9a9

Please sign in to comment.