192 lines
7.4 KiB
ReStructuredText
192 lines
7.4 KiB
ReStructuredText
![]() |
.. _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-conductor notifications
|
||
|
------------------------------
|
||
|
|
||
|
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.0",
|
||
|
"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,
|
||
|
"network_interface": "flat",
|
||
|
"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.0",
|
||
|
"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,
|
||
|
"network_interface": "flat",
|
||
|
"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"
|
||
|
}
|
||
|
|
||
|
.. [1] https://wiki.openstack.org/wiki/LoggingStandards#Log_level_definitions
|
||
|
.. [2] https://www.rabbitmq.com/documentation.html
|