Browse Source

Add event notification feature to masakari

Typical openstack services have event notification feature[1].
This spec adds the such feature for masakari.

[1]: https://docs.openstack.org/developer/nova/notifications.html

Change-Id: I4fc551d82fa0a0531676cfd7fbc787c493e2839b
Implements: bp notifications-in-masakari
Rikimaru Honjo 1 year ago
parent
commit
6e2d5de90c
1 changed files with 282 additions and 0 deletions
  1. 282
    0
      specs/stein/approved/notifications-in-masakari.rst

+ 282
- 0
specs/stein/approved/notifications-in-masakari.rst View File

@@ -0,0 +1,282 @@
1
+..
2
+ This work is licensed under a Creative Commons Attribution 3.0 Unported
3
+ License.
4
+
5
+ http://creativecommons.org/licenses/by/3.0/legalcode
6
+
7
+=======================
8
+Send Event Notifications
9
+=======================
10
+
11
+https://blueprints.launchpad.net/masakari/+spec/notifications-in-masakari
12
+
13
+
14
+Problem description
15
+===================
16
+
17
+Currently, Masakari doesn't send any event notifications on hosts,
18
+failover segments and notifications RestFul API operation requests made by an
19
+user.
20
+
21
+It would be useful to receive create, update and delete event notifications on
22
+any of this information changing, and the payload should contain the same
23
+information for create and update as accessible from the API.
24
+
25
+Use Cases
26
+---------
27
+
28
+Operators will be able to know following things by event notifications:
29
+
30
+* Begin/End of API process
31
+
32
+* Errors in event of failure to process APIs request
33
+
34
+* Payload which will contain the contents of the API request
35
+
36
+Operators can use event notifications for analyzing, monitoring and metering
37
+purposes.
38
+
39
+Proposed change
40
+===============
41
+
42
+Versioned notifications will be emitted for the following events:
43
+
44
+#. Segments
45
+
46
+   Create segment
47
+     segment.create.start
48
+
49
+     segment.create.end
50
+
51
+     segment.create.error
52
+
53
+   Update segment
54
+     segment.update.start
55
+
56
+     segment.update.end
57
+
58
+     segment.update.error
59
+
60
+   Delete segment
61
+     segment.delete.start
62
+
63
+     segment.delete.end
64
+
65
+     segment.delete.error
66
+
67
+#. Hosts
68
+
69
+   Create host
70
+     host.create.start
71
+
72
+     host.create.end
73
+
74
+     host.create.error
75
+
76
+   Update host
77
+     host.update.start
78
+
79
+     host.update.end
80
+
81
+     host.update.error
82
+
83
+   Delete host
84
+     host.delete.start
85
+
86
+     host.delete.end
87
+
88
+     host.delete.error
89
+
90
+#. Notifications
91
+
92
+   Create notification
93
+     notification.create.start
94
+
95
+     notification.create.end
96
+
97
+     notification.create.error
98
+
99
+   Process notification
100
+     notification.process.start
101
+
102
+     notification.process.end
103
+
104
+     notification.process.error
105
+
106
+.. note::
107
+   Process notification event is emitted only when masakari-engine starts
108
+   processing received notifications by executing recovery workflow.
109
+
110
+Event notification generally contain following information:
111
+
112
+.. code::
113
+
114
+    {
115
+        "priority": <string, selected from a predefined list[2] by the sender>,
116
+        "event_type": <string, defined by the sender>,
117
+        "timestamp": <string, the isotime of when the notification emitted>,
118
+        "publisher_id": <string, defined by the sender>,
119
+        "message_id": <uuid, generated by oslo>,
120
+        "payload": <json serialized dict, defined by the sender>
121
+    }
122
+
123
+
124
+**Versioned notifications:**
125
+
126
+Similar to the other OpenStack services Masakari will emit event notification
127
+to the message bus with the ``Notifier`` class provided by
128
+`oslo.messaging-doc`_.
129
+
130
+In versioned notification, the payload isn't a free form dictionary but a
131
+serialized oslo versioned object. In other words, the payload should
132
+be the format which is serializable by `oslo-versionedobjects`_ library.
133
+
134
+This is a sample of segment.create.start versioned notification:
135
+
136
+.. code::
137
+
138
+    {
139
+        "event_type": "segment.create.start",
140
+        "timestamp": "2018-11-22 09:25:12.393979",
141
+        "payload": {
142
+            "masakari_object.name": "SegmentApiPayload",
143
+            "masakari_object.data": {
144
+                "service_type": "compute",
145
+                "fault": null,
146
+                "recovery_method": "auto",
147
+                "description": null,
148
+                "name": "test"
149
+            },
150
+            "masakari_object.version": "1.0",
151
+            "masakari_object.namespace": "masakari"
152
+        },
153
+
154
+        "publisher_id": "masakari-api:fake-mini",
155
+        "message_id": "e44cb15b-dcba-409e-b0e1-9ee103b9a168"
156
+    }
157
+
158
+
159
+Alternatives
160
+------------
161
+
162
+None
163
+
164
+Data model impact
165
+-----------------
166
+
167
+Add osloversioned.objects for hosts, failover segment and notification.
168
+No changes will be made to the database schema.
169
+
170
+REST API impact
171
+---------------
172
+
173
+None
174
+
175
+Security impact
176
+---------------
177
+
178
+None
179
+
180
+Notifications impact
181
+--------------------
182
+
183
+Masakari doesn't support event notification feature.
184
+This spec will add this new feature.
185
+
186
+Other end user impact
187
+---------------------
188
+
189
+None
190
+
191
+Performance Impact
192
+------------------
193
+
194
+There will be a slight performance impact due to the overhead of sending event
195
+notifications during processing of each RestFul API request.
196
+Operator can also disable event notifications completely using configuration
197
+options.
198
+
199
+Other deployer impact
200
+---------------------
201
+
202
+Following config section and option will be added in masakari.conf:
203
+
204
+.. code::
205
+
206
+  [oslo_messaging_notifications]
207
+  driver=messaging
208
+
209
+  driver
210
+  Type:	multi-valued
211
+  Default:''
212
+  The Drivers(s) to handle sending notifications. Possible values are messaging, messagingv2, routing, log, test, noop
213
+
214
+Deployers should prepare the messaging system (e.g.RabbitMQ) to receive event
215
+notifications if they want to use event notification feature.
216
+
217
+Developer impact
218
+----------------
219
+
220
+After this feature lands in the code, henceforth, developers will need to
221
+add new event notifications if they decide to add new RestFul APIs.
222
+
223
+Implementation
224
+==============
225
+
226
+Assignee(s)
227
+-----------
228
+
229
+Primary assignee:
230
+
231
+* Rikimaru Honjo <honjo.rikimaru@po.ntt-tx.co.jp>
232
+* Kengo Takahara <takahara-kn@njk.co.jp>
233
+* Shilpa Devharakar <shilpa.devharakar@nttdata.com>
234
+
235
+Work Items
236
+----------
237
+
238
+* Add base classes for event notification mechanism
239
+* Add osloversioned.objects to be used to send event notifications
240
+* Add methods to send notifications for each newly added osloversioned.object
241
+* Send event notification for create/update/delete operations
242
+* Add unit tests for code coverage
243
+* Add documentation on how to use this feature
244
+
245
+Dependencies
246
+============
247
+
248
+None
249
+
250
+Testing
251
+=======
252
+
253
+No need to write tempest tests as unit tests are sufficient to check
254
+whether the event notifications are sent or not for each create, update and
255
+delete operations.
256
+
257
+Documentation Impact
258
+====================
259
+
260
+Add documentation to explain how to use event notification feature so that
261
+operator can write code to receive these events for their own purpose.
262
+
263
+References
264
+==========
265
+
266
+..  _`oslo.messaging-doc`: https://docs.openstack.org/oslo.messaging/latest/reference/notifier.html
267
+.. _`oslo-versionedobjects`: https://docs.openstack.org/oslo.versionedobjects/latest/user/index.html
268
+
269
+History
270
+=======
271
+
272
+.. list-table:: Revisions
273
+   :header-rows: 1
274
+
275
+   * - Release Name
276
+     - Description
277
+   * - Queens
278
+     - Introduced
279
+   * - Rocky
280
+     - Approved
281
+   * - Stein
282
+     - Re-proposed

Loading…
Cancel
Save