Skip to content

Commit

Permalink
Merge pull request #434 from agrare/default_to_streaming_refresh
Browse files Browse the repository at this point in the history
Default to use streaming_refresh for vSphere
  • Loading branch information
Fryguy authored Dec 3, 2019
2 parents a982200 + 2665804 commit ef00d2e
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion app/models/manageiq/providers/vmware/infra_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def supported_catalog_types
end

def streaming_refresh_enabled?
Settings.prototype.ems_vmware.update_driven_refresh
Settings.ems_refresh.vmwarews.streaming_refresh
end

def remote_console_vmrc_acquire_ticket
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class ManageIQ::Providers::Vmware::InfraManager::RefreshWorker::Runner < ManageIQ::Providers::BaseManager::RefreshWorker::Runner
# When using update_driven_refresh we don't need to use the VimBrokerWorker
self.require_vim_broker = !Settings.prototype.ems_vmware.update_driven_refresh
self.delay_startup_for_vim_broker = !Settings.prototype.ems_vmware.update_driven_refresh
# When using streaming_refresh we don't need to use the VimBrokerWorker
self.require_vim_broker = !Settings.ems_refresh.vmwarews.streaming_refresh
self.delay_startup_for_vim_broker = !Settings.ems_refresh.vmwarews.streaming_refresh

def after_initialize
super
Expand Down
3 changes: 2 additions & 1 deletion app/models/miq_ems_refresh_core_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class MiqEmsRefreshCoreWorker < MiqWorker
self.required_roles = ["ems_inventory"]

def self.has_required_role?
return false if Settings.prototype.ems_vmware.update_driven_refresh
return false if Settings.ems_refresh.vmwarews.streaming_refresh

super
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/miq_vim_broker_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class MiqVimBrokerWorker < MiqWorker
smartproxy
smartstate
).tap do |roles|
roles << 'ems_inventory' unless Settings.prototype.ems_vmware.update_driven_refresh
roles << 'ems_inventory' unless Settings.ems_refresh.vmwarews.streaming_refresh
end
}

Expand Down
2 changes: 1 addition & 1 deletion app/models/miq_vim_broker_worker/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def reset_broker_update_sleep_interval
end

def has_ems_inventory_role?
@active_roles.include?("ems_inventory") && !Settings.prototype.ems_vmware.update_driven_refresh
@active_roles.include?("ems_inventory") && !Settings.ems_refresh.vmwarews.streaming_refresh
end

def reset_broker_update_notification
Expand Down
5 changes: 2 additions & 3 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
:power:
:critical:
:ems_refresh:
:vmwarews:
:streaming_refresh: true
:vmware_cloud:
:inventory_object_refresh: false
:get_public_images: false
Expand All @@ -27,9 +29,6 @@
:user:
#:log:
# :level_vim: warn
:prototype:
:ems_vmware:
:update_driven_refresh: false
:workers:
:worker_base:
:event_catcher:
Expand Down
16 changes: 8 additions & 8 deletions spec/models/miq_ems_refresh_core_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
end

context ".has_required_role?" do
context "with update_driven_refresh" do
context "with streaming_refresh" do
before do
stub_settings_merge(
:prototype => {
:ems_vmware => {
:update_driven_refresh => true
:ems_refresh => {
:vmwarews => {
:streaming_refresh => true
}
}
)
Expand All @@ -29,12 +29,12 @@
expect(described_class.has_required_role?).to be_falsy
end
end
context "without update_driven_refresh" do
context "without streaming_refresh" do
before do
stub_settings_merge(
:prototype => {
:ems_vmware => {
:update_driven_refresh => false
:ems_refresh => {
:vmwarews => {
:streaming_refresh => false
}
}
)
Expand Down
5 changes: 3 additions & 2 deletions spec/models/miq_vim_broker_worker/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

describe MiqVimBrokerWorker::Runner do
before do
stub_settings_merge(:ems_refresh => {:vmwarews => {:streaming_refresh => false}})
_guid_2, _server_2, @zone_2 = EvmSpecHelper.create_guid_miq_server_zone
_guid, server, @zone = EvmSpecHelper.create_guid_miq_server_zone
@ems = FactoryBot.create(:ems_vmware_with_authentication, :zone => @zone)
Expand Down Expand Up @@ -129,8 +130,8 @@
expect(MiqVimBroker.cacheScope).to eq(:cache_scope_core)
end

it "with ems_inventory role using update_driven_refresh" do
stub_settings(:prototype => {:ems_vmware => {:update_driven_refresh => true}})
it "with ems_inventory role using streaming_refresh" do
stub_settings(:ems_refresh => {:vmwarews => {:streaming_refresh => true}})
@vim_broker_worker.instance_variable_set(:@active_roles, ['ems_inventory'])
expect(MiqVimBroker).to receive(:new).with(:server).once
@vim_broker_worker.create_miq_vim_broker_server
Expand Down
14 changes: 7 additions & 7 deletions spec/models/miq_vim_broker_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
expect(described_class.emses_to_monitor).to match_array @zone.ext_management_systems
end

context "update_driven_refresh" do
context "streaming_refresh" do
before do
stub_settings_merge(
:prototype => {
:ems_vmware => {
:update_driven_refresh => true
:ems_refresh => {
:vmwarews => {
:streaming_refresh => true
}
}
)
Expand All @@ -27,9 +27,9 @@
context "standard refresh" do
before do
stub_settings_merge(
:prototype => {
:ems_vmware => {
:update_driven_refresh => false
:ems_refresh => {
:vmwarews => {
:streaming_refresh => false
}
}
)
Expand Down

0 comments on commit ef00d2e

Please sign in to comment.