From 49a4be72777616f0b721c3779cf29f146311240d Mon Sep 17 00:00:00 2001 From: Christian Schwede Date: Mon, 31 Oct 2016 23:01:23 +0100 Subject: [PATCH] Add nonblocking_notify to Swift proxy ceilometer config This allows to send Ceilometer notifications in a background thread, no longer blocking Swift proxy if the RabbitMQ is not available. This patch does not change the default behavior. Change-Id: Iad1f69f273fe80176c6010f8f3cc24313d7c5ab4 --- manifests/proxy/ceilometer.pp | 6 ++++++ ...blocking-ceilometermiddleware-3ed113824614016c.yaml | 10 ++++++++++ spec/classes/swift_proxy_ceilometer_spec.rb | 4 ++++ 3 files changed, 20 insertions(+) create mode 100644 releasenotes/notes/non-blocking-ceilometermiddleware-3ed113824614016c.yaml diff --git a/manifests/proxy/ceilometer.pp b/manifests/proxy/ceilometer.pp index 4e254fe5..2b8f0472 100644 --- a/manifests/proxy/ceilometer.pp +++ b/manifests/proxy/ceilometer.pp @@ -54,6 +54,10 @@ # ceilometer/wsgi: set $::apache::group # Defaults to 'ceilometer' # +# [*nonblocking_notify*] +# Whether to send events to messaging driver in a background thread +# Defaults to false +# # == Examples # # == Authors @@ -76,6 +80,7 @@ class swift::proxy::ceilometer( $control_exchange = undef, $ensure = 'present', $group = 'ceilometer', + $nonblocking_notify = false, ) inherits swift { include ::swift::deps @@ -113,6 +118,7 @@ class swift::proxy::ceilometer( 'filter:ceilometer/url': value => $url; 'filter:ceilometer/control_exchange': value => $control_exchange; 'filter:ceilometer/paste.filter_factory': value => 'ceilometermiddleware.swift:filter_factory'; + 'filter:ceilometer/nonblocking_notify': value => $nonblocking_notify; } package { 'python-ceilometermiddleware': diff --git a/releasenotes/notes/non-blocking-ceilometermiddleware-3ed113824614016c.yaml b/releasenotes/notes/non-blocking-ceilometermiddleware-3ed113824614016c.yaml new file mode 100644 index 00000000..0cc46675 --- /dev/null +++ b/releasenotes/notes/non-blocking-ceilometermiddleware-3ed113824614016c.yaml @@ -0,0 +1,10 @@ +--- +features: + - A new ceilometermiddleware option "nonblocking_notify" has been + added and can be used to send notifications in a separate background + thread. This avoids blocking of Swift if RabbitMQ is not able to + process new notifications. In this case notifications will be + dropped after the local queue (defaults to 1000 entries) is + exhausted. It requires the Newton release of ceilometermiddleware. + This option is disabled by default and not changing the current + behavior. diff --git a/spec/classes/swift_proxy_ceilometer_spec.rb b/spec/classes/swift_proxy_ceilometer_spec.rb index 5e1edfe8..76c182ab 100644 --- a/spec/classes/swift_proxy_ceilometer_spec.rb +++ b/spec/classes/swift_proxy_ceilometer_spec.rb @@ -16,6 +16,7 @@ describe 'swift::proxy::ceilometer' do describe "when using default parameters" do it { is_expected.to contain_swift_proxy_config('filter:ceilometer/paste.filter_factory').with_value('ceilometermiddleware.swift:filter_factory') } it { is_expected.to contain_swift_proxy_config('filter:ceilometer/url').with_value('rabbit://guest:guest@127.0.0.1:5672//') } + it { is_expected.to contain_swift_proxy_config('filter:ceilometer/nonblocking_notify').with_value('false') } it { is_expected.to contain_user('swift').with_groups('ceilometer') } it { is_expected.to contain_file('/var/log/ceilometer/swift-proxy-server.log').with(:owner => 'swift', :group => 'swift', :mode => '0664') } end @@ -31,6 +32,7 @@ describe 'swift::proxy::ceilometer' do :driver => 'messagingv2', :topic => 'notifications', :control_exchange => 'swift', + :nonblocking_notify => true, } end @@ -41,6 +43,7 @@ describe 'swift::proxy::ceilometer' do it { is_expected.to contain_swift_proxy_config('filter:ceilometer/driver').with_value('messagingv2') } it { is_expected.to contain_swift_proxy_config('filter:ceilometer/topic').with_value('notifications') } it { is_expected.to contain_swift_proxy_config('filter:ceilometer/control_exchange').with_value('swift') } + it { is_expected.to contain_swift_proxy_config('filter:ceilometer/nonblocking_notify').with_value('true') } end context 'with multiple rabbit hosts' do @@ -54,6 +57,7 @@ describe 'swift::proxy::ceilometer' do it { is_expected.to contain_swift_proxy_config('filter:ceilometer/driver').with_value('messagingv2') } it { is_expected.to contain_swift_proxy_config('filter:ceilometer/topic').with_value('notifications') } it { is_expected.to contain_swift_proxy_config('filter:ceilometer/control_exchange').with_value('swift') } + it { is_expected.to contain_swift_proxy_config('filter:ceilometer/nonblocking_notify').with_value('true') } end end