Browse Source

Merge "Add support for RabbitMQ connection heartbeat" into stable/kilo

tags/kilo-eol^0
Jenkins 3 years ago
parent
commit
59d4821b04
2 changed files with 48 additions and 15 deletions
  1. 34
    15
      manifests/notify/rabbitmq.pp
  2. 14
    0
      spec/classes/glance_notify_rabbitmq_spec.rb

+ 34
- 15
manifests/notify/rabbitmq.pp View File

@@ -21,6 +21,21 @@
21 21
 #  [*rabbit_virtual_host*]
22 22
 #    virtual_host to use. Optional. Defaults to '/'
23 23
 #
24
+# [*rabbit_heartbeat_timeout_threshold*]
25
+#   (optional) Number of seconds after which the RabbitMQ broker is considered
26
+#   down if the heartbeat keepalive fails.  Any value >0 enables heartbeats.
27
+#   Heartbeating helps to ensure the TCP connection to RabbitMQ isn't silently
28
+#   closed, resulting in missed or lost messages from the queue.
29
+#   (Requires kombu >= 3.0.7 and amqp >= 1.4.0)
30
+#   Defaults to 0
31
+#
32
+# [*rabbit_heartbeat_rate*]
33
+#   (optional) How often during the rabbit_heartbeat_timeout_threshold period to
34
+#   check the heartbeat on RabbitMQ connection.  (i.e. rabbit_heartbeat_rate=2
35
+#   when rabbit_heartbeat_timeout_threshold=60, the heartbeat will be checked
36
+#   every 30 seconds.
37
+#   Defaults to 2
38
+#
24 39
 #  [*rabbit_use_ssl*]
25 40
 #    (optional) Connect over SSL for RabbitMQ
26 41
 #    Defaults to false
@@ -61,21 +76,23 @@
61 76
 
62 77
 class glance::notify::rabbitmq(
63 78
   $rabbit_password,
64
-  $rabbit_userid                = 'guest',
65
-  $rabbit_host                  = 'localhost',
66
-  $rabbit_port                  = '5672',
67
-  $rabbit_hosts                 = false,
68
-  $rabbit_virtual_host          = '/',
69
-  $rabbit_use_ssl               = false,
70
-  $kombu_ssl_ca_certs           = undef,
71
-  $kombu_ssl_certfile           = undef,
72
-  $kombu_ssl_keyfile            = undef,
73
-  $kombu_ssl_version            = 'TLSv1',
74
-  $rabbit_notification_exchange = 'glance',
75
-  $rabbit_notification_topic    = 'notifications',
76
-  $rabbit_durable_queues        = false,
77
-  $amqp_durable_queues          = false,
78
-  $notification_driver          = 'messaging',
79
+  $rabbit_userid                      = 'guest',
80
+  $rabbit_host                        = 'localhost',
81
+  $rabbit_port                        = '5672',
82
+  $rabbit_hosts                       = false,
83
+  $rabbit_virtual_host                = '/',
84
+  $rabbit_heartbeat_timeout_threshold = 0,
85
+  $rabbit_heartbeat_rate              = 2,
86
+  $rabbit_use_ssl                     = false,
87
+  $kombu_ssl_ca_certs                 = undef,
88
+  $kombu_ssl_certfile                 = undef,
89
+  $kombu_ssl_keyfile                  = undef,
90
+  $kombu_ssl_version                  = 'TLSv1',
91
+  $rabbit_notification_exchange       = 'glance',
92
+  $rabbit_notification_topic          = 'notifications',
93
+  $rabbit_durable_queues              = false,
94
+  $amqp_durable_queues                = false,
95
+  $notification_driver                = 'messaging',
79 96
 ) {
80 97
 
81 98
   if $rabbit_durable_queues {
@@ -106,6 +123,8 @@ class glance::notify::rabbitmq(
106 123
     'oslo_messaging_rabbit/rabbit_userid':                value => $rabbit_userid;
107 124
     'oslo_messaging_rabbit/rabbit_notification_exchange': value => $rabbit_notification_exchange;
108 125
     'oslo_messaging_rabbit/rabbit_notification_topic':    value => $rabbit_notification_topic;
126
+    'oslo_messaging_rabbit/heartbeat_timeout_threshold':  value => $rabbit_heartbeat_timeout_threshold;
127
+    'oslo_messaging_rabbit/heartbeat_rate':               value => $rabbit_heartbeat_rate;
109 128
     'oslo_messaging_rabbit/rabbit_use_ssl':               value => $rabbit_use_ssl;
110 129
     'DEFAULT/amqp_durable_queues':          value => $amqp_durable_queues_real;
111 130
   }

+ 14
- 0
spec/classes/glance_notify_rabbitmq_spec.rb View File

@@ -26,6 +26,8 @@ describe 'glance::notify::rabbitmq' do
26 26
     it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') }
27 27
     it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_exchange').with_value('glance') }
28 28
     it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_topic').with_value('notifications') }
29
+    it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0') }
30
+    it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2') }
29 31
   end
30 32
 
31 33
   describe 'when passing params and use ssl' do
@@ -122,6 +124,18 @@ describe 'glance::notify::rabbitmq' do
122 124
     it { is_expected.to_not contain_glance_api_config('oslo_messaging_rabbit/rabbit_host') }
123 125
   end
124 126
 
127
+  describe 'when passing params for rabbitmq heartbeat' do
128
+    let :params do
129
+      {
130
+        :rabbit_password                    => 'pass',
131
+        :rabbit_heartbeat_timeout_threshold => '60',
132
+        :rabbit_heartbeat_rate              => '10',
133
+      }
134
+    end
135
+    it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60') }
136
+    it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') }
137
+  end
138
+
125 139
   describe 'when using deprecated params' do
126 140
     let :params do
127 141
       {

Loading…
Cancel
Save