From 370c0bf8fa124062b8d006ce75336b7d11804872 Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Wed, 8 Feb 2017 10:54:48 +0800 Subject: [PATCH] Add rpc_response_timeout option Add rpc_response_timeout to configure seconds time for waiting for a response from a call. Change-Id: Ib107713d8b2cc137e11c3d478f14f8a4f4d034a3 --- manifests/api.pp | 5 ++-- manifests/conductor.pp | 5 ++-- manifests/guestagent.pp | 10 +++++-- manifests/init.pp | 5 ++++ manifests/taskmanager.pp | 5 ++-- ...g_default_parameters-9135a887ef423451.yaml | 4 +++ spec/classes/trove_api_spec.rb | 12 ++++++-- spec/classes/trove_conductor_spec.rb | 16 ++++++---- spec/classes/trove_guestagent_spec.rb | 30 ++++++++++++------- spec/classes/trove_taskmanager_spec.rb | 16 ++++++---- 10 files changed, 77 insertions(+), 31 deletions(-) create mode 100644 releasenotes/notes/add_messaging_default_parameters-9135a887ef423451.yaml diff --git a/manifests/api.pp b/manifests/api.pp index 0b1a0151..3da0bbc4 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -160,8 +160,9 @@ class trove::api( } oslo::messaging::default { 'trove_config': - transport_url => $::trove::default_transport_url, - control_exchange => $::trove::control_exchange + transport_url => $::trove::default_transport_url, + control_exchange => $::trove::control_exchange, + rpc_response_timeout => $::trove::rpc_response_timeout, } if $auth_strategy == 'keystone' { diff --git a/manifests/conductor.pp b/manifests/conductor.pp index ccb72964..d378f1c2 100644 --- a/manifests/conductor.pp +++ b/manifests/conductor.pp @@ -109,8 +109,9 @@ class trove::conductor( } oslo::messaging::default { 'trove_conductor_config': - transport_url => $::trove::default_transport_url, - control_exchange => $::trove::control_exchange, + transport_url => $::trove::default_transport_url, + control_exchange => $::trove::control_exchange, + rpc_response_timeout => $::trove::rpc_response_timeout, } oslo::messaging::notifications { 'trove_conductor_config': diff --git a/manifests/guestagent.pp b/manifests/guestagent.pp index 3f6d9433..ed7876a0 100644 --- a/manifests/guestagent.pp +++ b/manifests/guestagent.pp @@ -143,6 +143,11 @@ and trove::guestagent::rabbit_port are deprecated. Please use \ trove::guestagent::default_transport_url instead.") } + if $control_exchange { + warning("control_exchange parameter is deprecated. Please use \ +trove::control_exchange instead.") + } + # basic service config trove_guestagent_config { 'DEFAULT/trove_auth_url': value => $auth_url; @@ -155,8 +160,9 @@ trove::guestagent::default_transport_url instead.") } oslo::messaging::default { 'trove_guestagent_config': - transport_url => $default_transport_url, - control_exchange => $::trove::control_exchange + transport_url => $default_transport_url, + control_exchange => $::trove::control_exchange, + rpc_response_timeout => $::trove::rpc_response_timeout, } # region name diff --git a/manifests/init.pp b/manifests/init.pp index 4cbd5fb4..cab53b00 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -196,6 +196,10 @@ # (optional) Admin tenant name used to connect to nova. # Defaults to 'admin' # +# [*rpc_response_timeout*] +# (Optional) Seconds to wait for a response from a call. +# Defaults to $::os_service_default +# # [*control_exchange*] # (optional) Control exchange. # Defaults to 'trove'. @@ -321,6 +325,7 @@ class trove( $nova_compute_url = false, $nova_proxy_admin_user = 'admin', $nova_proxy_admin_tenant_name = 'admin', + $rpc_response_timeout = $::os_service_default, $control_exchange = 'trove', $cinder_url = false, $swift_url = false, diff --git a/manifests/taskmanager.pp b/manifests/taskmanager.pp index 9b651022..8c3cb721 100644 --- a/manifests/taskmanager.pp +++ b/manifests/taskmanager.pp @@ -161,8 +161,9 @@ class trove::taskmanager( } oslo::messaging::default { 'trove_taskmanager_config': - transport_url => $::trove::default_transport_url, - control_exchange => $::trove::control_exchange + transport_url => $::trove::default_transport_url, + control_exchange => $::trove::control_exchange, + rpc_response_timeout => $::trove::rpc_response_timeout, } oslo::messaging::notifications { 'trove_taskmanager_config': diff --git a/releasenotes/notes/add_messaging_default_parameters-9135a887ef423451.yaml b/releasenotes/notes/add_messaging_default_parameters-9135a887ef423451.yaml new file mode 100644 index 00000000..4809dbe3 --- /dev/null +++ b/releasenotes/notes/add_messaging_default_parameters-9135a887ef423451.yaml @@ -0,0 +1,4 @@ +--- +features: + - Add new parameter "rpc_response_timeout", seconds to wait for a + response from a call diff --git a/spec/classes/trove_api_spec.rb b/spec/classes/trove_api_spec.rb index 5117dd1d..fc85e078 100644 --- a/spec/classes/trove_api_spec.rb +++ b/spec/classes/trove_api_spec.rb @@ -79,6 +79,8 @@ describe 'trove::api' do is_expected.to contain_trove_config('DEFAULT/http_delete_rate').with_value('200') is_expected.to contain_trove_config('DEFAULT/http_mgmt_post_rate').with_value('200') is_expected.to contain_trove_config('DEFAULT/transport_url').with_value('') + is_expected.to contain_trove_config('DEFAULT/rpc_response_timeout').with_value('') + is_expected.to contain_trove_config('DEFAULT/control_exchange').with_value('trove') is_expected.to contain_trove_config('oslo_messaging_notifications/transport_url').with_value('') is_expected.to contain_trove_config('oslo_messaging_notifications/driver').with_value('') is_expected.to contain_trove_config('oslo_messaging_notifications/topics').with_value('') @@ -226,7 +228,7 @@ describe 'trove::api' do let :pre_condition do "class { 'trove': nova_proxy_admin_pass => 'verysecrete', - rabbit_use_ssl => false} + rabbit_use_ssl => false} class { '::trove::keystone::authtoken': password => 'a_big_secret', }" @@ -244,8 +246,10 @@ describe 'trove::api' do context 'with transport_url entries' do let :pre_condition do "class { 'trove': - nova_proxy_admin_pass => 'verysecrete', - default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', + nova_proxy_admin_pass => 'verysecrete', + default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', + rpc_response_timeout => '120', + control_exchange => 'openstack', notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673' } class { '::trove::keystone::authtoken': password => 'a_big_secret', @@ -254,6 +258,8 @@ describe 'trove::api' do it do is_expected.to contain_trove_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') + is_expected.to contain_trove_config('DEFAULT/rpc_response_timeout').with_value('120') + is_expected.to contain_trove_config('DEFAULT/control_exchange').with_value('openstack') is_expected.to contain_trove_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') end end diff --git a/spec/classes/trove_conductor_spec.rb b/spec/classes/trove_conductor_spec.rb index cf5c1fe3..d433b083 100644 --- a/spec/classes/trove_conductor_spec.rb +++ b/spec/classes/trove_conductor_spec.rb @@ -35,6 +35,8 @@ describe 'trove::conductor' do is_expected.to contain_trove_conductor_config('DEFAULT/nova_proxy_admin_pass').with_value('verysecrete') is_expected.to contain_trove_conductor_config('DEFAULT/nova_proxy_admin_tenant_name').with_value('admin') is_expected.to contain_trove_conductor_config('DEFAULT/transport_url').with_value('') + is_expected.to contain_trove_conductor_config('DEFAULT/rpc_response_timeout').with_value('') + is_expected.to contain_trove_conductor_config('DEFAULT/control_exchange').with_value('trove') is_expected.to contain_trove_conductor_config('oslo_messaging_notifications/transport_url').with_value('') is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_userid').with_value('') is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_password').with_value('') @@ -122,7 +124,7 @@ describe 'trove::conductor' do let :pre_condition do "class { 'trove': nova_proxy_admin_pass => 'verysecrete', - rabbit_use_ssl => true}" + rabbit_use_ssl => true}" end it do @@ -138,7 +140,7 @@ describe 'trove::conductor' do let :pre_condition do "class { 'trove': nova_proxy_admin_pass => 'verysecrete', - rabbit_use_ssl => false}" + rabbit_use_ssl => false}" end it do @@ -153,13 +155,17 @@ describe 'trove::conductor' do context 'with transport_url entries' do let :pre_condition do "class { 'trove': - nova_proxy_admin_pass => 'verysecrete', - default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', + nova_proxy_admin_pass => 'verysecrete', + default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', + rpc_response_timeout => '120', + control_exchange => 'openstack', notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673' }" end it do is_expected.to contain_trove_conductor_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') + is_expected.to contain_trove_conductor_config('DEFAULT/rpc_response_timeout').with_value('120') + is_expected.to contain_trove_conductor_config('DEFAULT/control_exchange').with_value('openstack') is_expected.to contain_trove_conductor_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') end end @@ -168,7 +174,7 @@ describe 'trove::conductor' do let :pre_condition do "class { 'trove' : nova_proxy_admin_pass => 'verysecrete', - rpc_backend => 'amqp' }" + rpc_backend => 'amqp' }" end it do diff --git a/spec/classes/trove_guestagent_spec.rb b/spec/classes/trove_guestagent_spec.rb index 32c66e85..4f8c19a3 100644 --- a/spec/classes/trove_guestagent_spec.rb +++ b/spec/classes/trove_guestagent_spec.rb @@ -35,6 +35,8 @@ describe 'trove::guestagent' do is_expected.to contain_trove_guestagent_config('DEFAULT/os_region_name').with_value('RegionOne') is_expected.to contain_trove_guestagent_config('DEFAULT/control_exchange').with_value('trove') is_expected.to contain_trove_guestagent_config('DEFAULT/transport_url').with_value('') + is_expected.to contain_trove_guestagent_config('DEFAULT/rpc_response_timeout').with_value('') + is_expected.to contain_trove_guestagent_config('DEFAULT/control_exchange').with_value('trove') is_expected.to contain_trove_guestagent_config('oslo_messaging_notifications/transport_url').with_value('') is_expected.to contain_trove_guestagent_config('oslo_messaging_notifications/driver').with_value('') is_expected.to contain_trove_guestagent_config('oslo_messaging_notifications/topics').with_value('') @@ -99,10 +101,14 @@ describe 'trove::guestagent' do let :pre_condition do "class { 'trove': nova_proxy_admin_pass => 'verysecrete', - default_transport_url => 'rabbit://user:pass@host:1234/virt',}" + default_transport_url => 'rabbit://user:pass@host:1234/virt', + rpc_response_timeout => '120', + control_exchange => 'openstack',}" end it 'configures trove-guestagent with DEFAULT/transport_url' do is_expected.to contain_trove_guestagent_config('DEFAULT/transport_url').with_value('rabbit://user:pass@host:1234/virt') + is_expected.to contain_trove_guestagent_config('DEFAULT/rpc_response_timeout').with_value('120') + is_expected.to contain_trove_guestagent_config('DEFAULT/control_exchange').with_value('openstack') end end @@ -115,12 +121,12 @@ describe 'trove::guestagent' do end let :params do - { :auth_url => "http://10.0.0.1:5000/v2.0", - :swift_url => "http://10.0.0.1:8080/v1/AUTH_", + { :auth_url => "http://10.0.0.1:5000/v2.0", + :swift_url => "http://10.0.0.1:8080/v1/AUTH_", :swift_service_type => 'object-store', - :rabbit_host => '10.1.0.1', - :rabbit_port => '5673', - :rabbit_use_ssl => 'true' + :rabbit_host => '10.1.0.1', + :rabbit_port => '5673', + :rabbit_use_ssl => 'true' } end it 'configures trove-guestagent with custom parameters' do @@ -157,7 +163,7 @@ describe 'trove::guestagent' do let :pre_condition do "class { 'trove': nova_proxy_admin_pass => 'verysecrete', - rabbit_use_ssl => true}" + rabbit_use_ssl => true}" end it do @@ -173,7 +179,7 @@ describe 'trove::guestagent' do let :pre_condition do "class { 'trove': nova_proxy_admin_pass => 'verysecrete', - rabbit_use_ssl => false}" + rabbit_use_ssl => false}" end it do @@ -188,13 +194,17 @@ describe 'trove::guestagent' do context 'with transport_url entries' do let :pre_condition do "class { 'trove': - nova_proxy_admin_pass => 'verysecrete', - default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', + nova_proxy_admin_pass => 'verysecrete', + default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', + rpc_response_timeout => '60', + control_exchange => 'exchange', notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673' }" end it do is_expected.to contain_trove_guestagent_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') + is_expected.to contain_trove_guestagent_config('DEFAULT/rpc_response_timeout').with_value('60') + is_expected.to contain_trove_guestagent_config('DEFAULT/control_exchange').with_value('exchange') is_expected.to contain_trove_guestagent_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') end end diff --git a/spec/classes/trove_taskmanager_spec.rb b/spec/classes/trove_taskmanager_spec.rb index 7069e174..4eb22d4b 100644 --- a/spec/classes/trove_taskmanager_spec.rb +++ b/spec/classes/trove_taskmanager_spec.rb @@ -71,6 +71,8 @@ describe 'trove::taskmanager' do is_expected.to contain_trove_taskmanager_config('DEFAULT/taskmanager_manager').with_value('trove.taskmanager.manager.Manager') is_expected.to contain_file('/etc/trove/trove-guestagent.conf') is_expected.to contain_trove_taskmanager_config('DEFAULT/transport_url').with_value('') + is_expected.to contain_trove_taskmanager_config('DEFAULT/rpc_response_timeout').with_value('') + is_expected.to contain_trove_taskmanager_config('DEFAULT/control_exchange').with_value('trove') is_expected.to contain_trove_taskmanager_config('oslo_messaging_notifications/transport_url').with_value('') is_expected.to contain_trove_taskmanager_config('oslo_messaging_notifications/driver').with_value('') is_expected.to contain_trove_taskmanager_config('oslo_messaging_notifications/topics').with_value('') @@ -232,7 +234,7 @@ describe 'trove::taskmanager' do let :pre_condition do "class { 'trove': nova_proxy_admin_pass => 'verysecrete', - rabbit_use_ssl => true}" + rabbit_use_ssl => true}" end it do @@ -248,7 +250,7 @@ describe 'trove::taskmanager' do let :pre_condition do "class { 'trove': nova_proxy_admin_pass => 'verysecrete', - rabbit_use_ssl => false}" + rabbit_use_ssl => false}" end it do @@ -263,13 +265,17 @@ describe 'trove::taskmanager' do context 'with transport_url entries' do let :pre_condition do "class { 'trove': - nova_proxy_admin_pass => 'verysecrete', - default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', + nova_proxy_admin_pass => 'verysecrete', + default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', + rpc_response_timeout => '120', + control_exchange => 'openstack', notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673' }" end it do is_expected.to contain_trove_taskmanager_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') + is_expected.to contain_trove_taskmanager_config('DEFAULT/rpc_response_timeout').with_value('120') + is_expected.to contain_trove_taskmanager_config('DEFAULT/control_exchange').with_value('openstack') is_expected.to contain_trove_taskmanager_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') end end @@ -278,7 +284,7 @@ describe 'trove::taskmanager' do let :pre_condition do "class { 'trove' : nova_proxy_admin_pass => 'verysecrete', - rpc_backend => 'amqp' }" + rpc_backend => 'amqp' }" end it do