summaryrefslogtreecommitdiff
path: root/doc/source/deploy/notifications.rst
blob: 0fd705f1725011b5fcc4b8fb9d7882dd3c554997 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
.. _deploy-notifications:

=============
Notifications
=============

Ironic, when configured to do so, will emit notifications over a message bus
that indicate different events that occur within the service. These can be
consumed by any external service. Examples may include a billing or usage
system, a monitoring data store, or other OpenStack services. This page
describes how to enable notifications and the different kinds of notifications
that ironic may emit. The external consumer will see notifications emitted by
ironic as JSON objects structured in the following manner::

    {
        "priority": <string, defined by the sender>,
        "event_type": <string, defined by the sender>,
        "timestamp": <string, the isotime of when the notification emitted>,
        "publisher_id": <string, defined by the sender>,
        "message_id": <uuid, generated by oslo>,
        "payload": <json serialized dict, defined by the sender>
    }

Configuration
=============

To enable notifications with ironic, there are two configuration options in
ironic.conf that must be adjusted.

The first option is the ``notification_level`` option in the ``[DEFAULT]``
section of the configuration file. This can be set to "debug", "info",
"warning", "error", or "critical", and determines the minimum priority level
for which notifications are emitted. For example, if the option is set to
"warning", all notifications with priority level "warning", "error", or
"critical" are emitted, but not notifications with priority level "debug" or
"info". For information about the semantics of each log level, see the
OpenStack logging standards [1]_. If this option is unset, no notifications
will be emitted. The priority level of each available notification is
documented below.

The second option is the ``transport_url`` option in the
``[oslo_messaging_notifications]`` section of the configuration. This
determines the message bus used when sending notifications. If this is unset,
the default transport used for RPC is used.

All notifications are emitted on the "ironic_versioned_notifications" topic in
the message bus. Generally, each type of message that traverses the message bus
is associated with a topic describing what the message is about. For more
information, see the documentation of your chosen message bus, such as the
RabbitMQ documentation [2]_.

Note that notifications may be lossy, and there's no guarantee that a
notification will make it across the message bus to a consumer.

Versioning
==========

Each notification has an associated version in the "ironic_object.version"
field of the payload. Consumers are guaranteed that microversion bumps will add
new fields, while macroversion bumps are backwards-incompatible and may have
fields removed.

Available notifications
=======================
.. TODO(mariojv) Add some form of tabular formatting below


The notifications that ironic emits are described here. They are listed
(alphabetically) by service first, then by event_type. All examples below
show payloads before serialization to JSON.

------------------------
ironic-api notifications
------------------------

Resources CRUD notifications
----------------------------

These notifications are emitted from API service when ironic resources are
modified as part of create, update, or delete (CRUD) [3]_ procedures. All
CRUD notifications are emitted at INFO level, except for "error" status that
is emitted at ERROR level.

List of CRUD notifications for chassis:

* ``baremetal.chassis.create.start``
* ``baremetal.chassis.create.end``
* ``baremetal.chassis.create.error``
* ``baremetal.chassis.update.start``
* ``baremetal.chassis.update.end``
* ``baremetal.chassis.update.error``
* ``baremetal.chassis.delete.start``
* ``baremetal.chassis.delete.end``
* ``baremetal.chassis.delete.error``

Example of chassis CRUD notification::

   {
    "priority": "info",
    "payload":{
        "ironic_object.namespace":"ironic",
        "ironic_object.name":"ChassisCRUDPayload",
        "ironic_object.version":"1.0",
        "ironic_object.data":{
            "created_at": "2016-04-10T10:13:03+00:00",
            "description": "bare 28",
            "extra": {},
            "updated_at": "2016-04-27T21:11:03+00:00",
            "uuid": "1910f669-ce8b-43c2-b1d8-cf3d65be815e"
        }
    },
    "event_type":"baremetal.chassis.update.end",
    "publisher_id":"ironic-api.hostname02"
   }

List of CRUD notifications for node:

* ``baremetal.node.create.start``
* ``baremetal.node.create.end``
* ``baremetal.node.create.error``
* ``baremetal.node.update.start``
* ``baremetal.node.update.end``
* ``baremetal.node.update.error``
* ``baremetal.node.delete.start``
* ``baremetal.node.delete.end``
* ``baremetal.node.delete.error``

Example of node CRUD notification::

   {
    "priority": "info",
    "payload":{
        "ironic_object.namespace":"ironic",
        "ironic_object.name":"NodeCRUDPayload",
        "ironic_object.version":"1.1",
        "ironic_object.data":{
            "chassis_uuid": "db0eef9d-45b2-4dc0-94a8-fc283c01171f",
            "clean_step": None,
            "console_enabled": False,
            "created_at": "2016-01-26T20:41:03+00:00",
            "driver": "fake",
            "driver_info": {
                "host": "192.168.0.111"},
            "extra": {},
            "inspection_finished_at": None,
            "inspection_started_at": None,
            "instance_info": {},
            "instance_uuid": None,
            "last_error": None,
            "maintenance": False,
            "maintenance_reason": None,
            "boot_interface": None,
            "console_interface": None,
            "deploy_interface": None,
            "inspect_interface": None,
            "management_interface": None,
            "network_interface": "flat",
            "power_interface": None,
            "raid_interface": None,
            "vendor_interface": None,
            "name": None,
            "power_state": "power off",
            "properties": {
                "memory_mb":  4096,
                "cpu_arch":  "x86_64",
                "local_gb":  10,
                "cpus":  8},
            "provision_state": "deploying",
            "provision_updated_at": "2016-01-27T20:41:03+00:00",
            "resource_class": None,
            "target_power_state": None,
            "target_provision_state": "active",
            "updated_at": "2016-01-27T20:41:03+00:00",
            "uuid": "1be26c0b-03f2-4d2e-ae87-c02d7f33c123"
        }
    },
    "event_type":"baremetal.node.update.end",
    "publisher_id":"ironic-api.hostname02"
   }

List of CRUD notifications for port:

* ``baremetal.port.create.start``
* ``baremetal.port.create.end``
* ``baremetal.port.create.error``
* ``baremetal.port.update.start``
* ``baremetal.port.update.end``
* ``baremetal.port.update.error``
* ``baremetal.port.delete.start``
* ``baremetal.port.delete.end``
* ``baremetal.port.delete.error``

Example of port CRUD notification::

   {
    "priority": "info",
    "payload":{
        "ironic_object.namespace":"ironic",
        "ironic_object.name":"PortCRUDPayload",
        "ironic_object.version":"1.0",
        "ironic_object.data":{
            "address": "77:66:23:34:11:b7",
            "created_at": "2016-02-11T15:23:03+00:00",
            "node_uuid": "5b236cab-ad4e-4220-b57c-e827e858745a",
            "extra": {},
            "local_link_connection": {},
            "pxe_enabled": True,
            "updated_at": "2016-03-27T20:41:03+00:00",
            "uuid": "1be26c0b-03f2-4d2e-ae87-c02d7f33c123"
        }
    },
    "event_type":"baremetal.port.update.end",
    "publisher_id":"ironic-api.hostname02"
   }

Node maintenance notifications
------------------------------

These notifications are emitted from API service when maintenance mode is
changed via API service. List of maintenance notifications for a node:

* ``baremetal.node.maintenance_set.start``
* ``baremetal.node.maintenance_set.end``
* ``baremetal.node.maintenance_set.error``

"start" and "end" notifications have INFO level, "error" has ERROR. Example of
node maintenance notification::

   {
    "priority": "info",
    "payload":{
        "ironic_object.namespace":"ironic",
        "ironic_object.name":"NodePayload",
        "ironic_object.version":"1.3",
        "ironic_object.data":{
            "clean_step": None,
            "console_enabled": False,
            "created_at": "2016-01-26T20:41:03+00:00",
            "driver": "fake",
            "extra": {},
            "inspection_finished_at": None,
            "inspection_started_at": None,
            "instance_info": {},
            "instance_uuid": None,
            "last_error": None,
            "maintenance": True,
            "maintenance_reason": "hw upgrade",
            "boot_interface": None,
            "console_interface": None,
            "deploy_interface": None,
            "inspect_interface": None,
            "management_interface": None,
            "network_interface": "flat",
            "power_interface": None,
            "raid_interface": None,
            "vendor_interface": None,
            "name": None,
            "power_state": "power off",
            "properties": {
                "memory_mb":  4096,
                "cpu_arch":  "x86_64",
                "local_gb":  10,
                "cpus":  8},
            "provision_state": "available",
            "provision_updated_at": "2016-01-27T20:41:03+00:00",
            "resource_class": None,
            "target_power_state": None,
            "target_provision_state": None,
            "updated_at": "2016-01-27T20:41:03+00:00",
            "uuid": "1be26c0b-03f2-4d2e-ae87-c02d7f33c123"
        }
    },
    "event_type":"baremetal.node.maintenance_set.start",
    "publisher_id":"ironic-api.hostname02"
   }

------------------------------
ironic-conductor notifications
------------------------------

Node console notifications
------------------------------

These notifications are emitted by the ironic-conductor service when conductor
service starts or stops console for the node. The notification event types for
a node console are:

* ``baremetal.node.console_set.start``
* ``baremetal.node.console_set.end``
* ``baremetal.node.console_set.error``

* ``baremetal.node.console_restore.start``
* ``baremetal.node.console_restore.end``
* ``baremetal.node.console_restore.error``

``console_set`` action is used when start or stop console is initiated via API
request. The ``console_restore`` action is used when the console was already
enabled, but a driver must restart the console because an ironic-conductor was
restarted. This may also be sent when an ironic-conductor takes over a node
that was being managed by another ironic-conductor. "start" and "end"
notifications have INFO level, "error" has ERROR. Example of node console
notification::

   {
    "priority": "info",
    "payload":{
        "ironic_object.namespace":"ironic",
        "ironic_object.name":"NodePayload",
        "ironic_object.version":"1.3",
        "ironic_object.data":{
            "clean_step": None,
            "console_enabled": True,
            "created_at": "2016-01-26T20:41:03+00:00",
            "driver": "fake",
            "extra": {},
            "inspection_finished_at": None,
            "inspection_started_at": None,
            "instance_info": {},
            "instance_uuid": None,
            "last_error": None,
            "maintenance": False,
            "maintenance_reason": None,
            "boot_interface": None,
            "console_interface": None,
            "deploy_interface": None,
            "inspect_interface": None,
            "management_interface": None,
            "network_interface": "flat",
            "power_interface": None,
            "raid_interface": None,
            "vendor_interface": None,
            "name": None,
            "power_state": "power off",
            "properties": {
                "memory_mb":  4096,
                "cpu_arch":  "x86_64",
                "local_gb":  10,
                "cpus":  8},
            "provision_state": "available",
            "provision_updated_at": "2016-01-27T20:41:03+00:00",
            "resource_class": None,
            "target_power_state": None,
            "target_provision_state": None,
            "updated_at": "2016-01-27T20:41:03+00:00",
            "uuid": "1be26c0b-03f2-4d2e-ae87-c02d7f33c123"
        }
    },
    "event_type":"baremetal.node.console_set.end",
    "publisher_id":"ironic-conductor.hostname01"
   }

baremetal.node.power_set
------------------------

* ``baremetal.node.power_set.start`` is emitted by the ironic-conductor service
  when it begins a power state change. It has notification level "info".

* ``baremetal.node.power_set.end`` is emitted when ironic-conductor
  successfully completes a power state change task. It has notification level
  "info".

* ``baremetal.node.power_set.error`` is emitted by ironic-conductor when it
  fails to set a node's power state. It has notification level "error". This
  can occur when ironic fails to retrieve the old power state prior to setting
  the new one on the node, or when it fails to set the power state if a change
  is requested.

Here is an example payload for a notification with this event type. The
"to_power" payload field indicates the power state to which the
ironic-conductor is attempting to change the node::

   {
    "priority": "info",
    "payload":{
        "ironic_object.namespace":"ironic",
        "ironic_object.name":"NodeSetPowerStatePayload",
        "ironic_object.version":"1.3",
        "ironic_object.data":{
            "clean_step": None,
            "console_enabled": False,
            "created_at": "2016-01-26T20:41:03+00:00",
            "driver": "fake",
            "extra": {},
            "inspection_finished_at": None,
            "inspection_started_at": None,
            "instance_uuid": "d6ea00c1-1f94-4e95-90b3-3462d7031678",
            "last_error": None,
            "maintenance": False,
            "maintenance_reason": None,
            "boot_interface": None,
            "console_interface": None,
            "deploy_interface": None,
            "inspect_interface": None,
            "management_interface": None,
            "network_interface": "flat",
            "power_interface": None,
            "raid_interface": None,
            "vendor_interface": None,
            "name": None,
            "power_state": "power off",
            "properties": {
                "memory_mb":  4096,
                "cpu_arch":  "x86_64",
                "local_gb":  10,
                "cpus":  8},
            "provision_state": "available",
            "provision_updated_at": "2016-01-27T20:41:03+00:00",
            "resource_class": None,
            "target_power_state": None,
            "target_provision_state": None,
            "updated_at": "2016-01-27T20:41:03+00:00",
            "uuid": "1be26c0b-03f2-4d2e-ae87-c02d7f33c123",
            "to_power": "power on"
        }
    },
    "event_type":"baremetal.node.power_set.start",
    "publisher_id":"ironic-conductor.hostname01"
   }



baremetal.node.power_state_corrected
------------------------------------

* ``baremetal.node.power_state_corrected.success`` is emitted by
  ironic-conductor when the power state on the baremetal hardware is different
  from the previous known power state of the node and the database is corrected
  to reflect this new power state. It has notification level "info".

Here is an example payload for a notification with this event_type. The
"from_power" payload field indicates the previous power state on the node,
prior to the correction::

   {
    "priority": "info",
    "payload":{
        "ironic_object.namespace":"ironic",
        "ironic_object.name":"NodeCorrectedPowerStatePayload",
        "ironic_object.version":"1.3",
        "ironic_object.data":{
            "clean_step": None,
            "console_enabled": False,
            "created_at": "2016-01-26T20:41:03+00:00",
            "driver": "fake",
            "extra": {},
            "inspection_finished_at": None,
            "inspection_started_at": None,
            "instance_uuid": "d6ea00c1-1f94-4e95-90b3-3462d7031678",
            "last_error": None,
            "maintenance": False,
            "maintenance_reason": None,
            "boot_interface": None,
            "console_interface": None,
            "deploy_interface": None,
            "inspect_interface": None,
            "management_interface": None,
            "network_interface": "flat",
            "power_interface": None,
            "raid_interface": None,
            "vendor_interface": None,
            "name": None,
            "power_state": "power off",
            "properties": {
                "memory_mb":  4096,
                "cpu_arch":  "x86_64",
                "local_gb":  10,
                "cpus":  8},
            "provision_state": "available",
            "provision_updated_at": "2016-01-27T20:41:03+00:00",
            "resource_class": None,
            "target_power_state": None,
            "target_provision_state": None,
            "updated_at": "2016-01-27T20:41:03+00:00",
            "uuid": "1be26c0b-03f2-4d2e-ae87-c02d7f33c123",
            "from_power": "power on"
        }
    },
    "event_type":"baremetal.node.power_state_corrected.success",
    "publisher_id":"ironic-conductor.cond-hostname02"
   }

baremetal.node.provision_set
----------------------------

* ``baremetal.node.provision_set.start`` is emitted by the ironic-conductor
  service when it begins a provision state transition. It has notification
  level INFO.

* ``baremetal.node.provision_set.end`` is emitted when ironic-conductor
  successfully completes a provision state transition. It has notification
  level INFO.

* ``baremetal.node.provision_set.success`` is emitted when ironic-conductor
  successfully changes provision state instantly, without any intermediate
  work required (example is AVAILABLE to MANAGEABLE). It has notification level
  INFO.

* ``baremetal.node.provision_set.error`` is emitted by ironic-conductor when it
  changes provision state as result of error event processing. It has
  notification level ERROR.

Here is an example payload for a notification with this event type. The
"previous_provision_state" and "previous_target_provision_state" payload fields
indicate a node's provision states before state change, "event" is the FSM
(finite state machine) event that triggered the state change::

   {
    "priority": "info",
    "payload":{
        "ironic_object.namespace":"ironic",
        "ironic_object.name":"NodeSetProvisionStatePayload",
        "ironic_object.version":"1.3",
        "ironic_object.data":{
            "clean_step": None,
            "console_enabled": False,
            "created_at": "2016-01-26T20:41:03+00:00",
            "driver": "fake",
            "extra": {},
            "inspection_finished_at": None,
            "inspection_started_at": None,
            "instance_info": {},
            "instance_uuid": None,
            "last_error": None,
            "maintenance": False,
            "maintenance_reason": None,
            "boot_interface": None,
            "console_interface": None,
            "deploy_interface": None,
            "inspect_interface": None,
            "management_interface": None,
            "network_interface": "flat",
            "power_interface": None,
            "raid_interface": None,
            "vendor_interface": None,
            "name": None,
            "power_state": "power off",
            "properties": {
                "memory_mb":  4096,
                "cpu_arch":  "x86_64",
                "local_gb":  10,
                "cpus":  8},
            "provision_state": "deploying",
            "provision_updated_at": "2016-01-27T20:41:03+00:00",
            "resource_class": None,
            "target_power_state": None,
            "target_provision_state": "active",
            "updated_at": "2016-01-27T20:41:03+00:00",
            "uuid": "1be26c0b-03f2-4d2e-ae87-c02d7f33c123",
            "previous_provision_state": "available",
            "previous_target_provision_state": None,
            "event": "deploy"
        }
    },
    "event_type":"baremetal.node.provision_set.start",
    "publisher_id":"ironic-conductor.hostname01"
   }

.. [1] https://wiki.openstack.org/wiki/LoggingStandards#Log_level_definitions
.. [2] https://www.rabbitmq.com/documentation.html
.. [3] https://en.wikipedia.org/wiki/Create,_read,_update_and_delete