The nova.openstack.common.notifier.api Module

exception BadPriorityException

Bases: exceptions.Exception

add_driver(notification_driver)

Add a notification driver at runtime.

notify(context, publisher_id, event_type, priority, payload)

Sends a notification using the specified driver

Parameters:
  • publisher_id – the source worker_type.host of the message
  • event_type – the literal type of event (ex. Instance Creation)
  • priority – patterned after the enumeration of Python logging levels in the set (DEBUG, WARN, INFO, ERROR, CRITICAL)
  • payload – A python dictionary of attributes

Outgoing message format includes the above parameters, and appends the following:

message_id
a UUID representing the id for this notification
timestamp
the GMT timestamp the notification was sent at

The composite message will be constructed as a dictionary of the above attributes, which will then be sent via the transport mechanism defined by the driver.

Message example:

{'message_id': str(uuid.uuid4()),
 'publisher_id': 'compute.host1',
 'timestamp': timeutils.utcnow(),
 'priority': 'WARN',
 'event_type': 'compute.create_instance',
 'payload': {'instance_id': 12, ... }}
notify_decorator(name, fn)

decorator for notify which is used from utils.monkey_patch()

Parameters:
  • name – name of the function
  • function
    • object of the function
Returns:

function – decorated function

publisher_id(service, host=None)

Previous topic

The nova.openstack.common.network_utils Module

Next topic

The nova.openstack.common.notifier.log_notifier Module

This Page