The nova.compute.utils Module

Compute-related Utilities and helpers.

class EventReporter(context, conductor, event_name, *instance_uuids)

Bases: object

Context manager to report instance action events.

add_instance_fault_from_exc(context, conductor, instance, fault, exc_info=None)

Adds the specified fault to the database.

finish_instance_usage_audit(context, conductor, begin, end, host, errors, message)
get_device_name_for_instance(context, instance, bdms, device)

Validates (or generates) a device name for instance.

If device is not set, it will generate a unique device appropriate for the instance. It uses the block device mapping table to find valid device names. If the device name is valid but applicable to a different backend (for example /dev/vdc is specified but the backend uses /dev/xvdc), the device name will be converted to the appropriate format.

get_nw_info_for_instance(instance)
has_audit_been_run(context, conductor, host, timestamp=None)
notify_about_instance_usage(context, instance, event_suffix, network_info=None, system_metadata=None, extra_usage_info=None, host=None)

Send a notification about an instance.

Parameters:
  • event_suffix – Event type like “delete.start” or “exists”
  • network_info – Networking information, if provided.
  • system_metadata – system_metadata DB entries for the instance, if provided.
  • extra_usage_info – Dictionary containing extra values to add or override in the notification.
  • host – Compute host for the instance, if specified. Default is CONF.host
notify_usage_exists(context, instance_ref, current_period=False, ignore_missing_network_data=True, system_metadata=None, extra_usage_info=None)

Generates ‘exists’ notification for an instance for usage auditing purposes.

Parameters:
  • current_period – if True, this will generate a usage for the current usage period; if False, this will generate a usage for the previous audit period.
  • ignore_missing_network_data – if True, log any exceptions generated while getting network info; if False, raise the exception.
  • system_metadata – system_metadata DB entries for the instance, if not None. NOTE: Currently unused here in trunk, but needed for potential custom modifications.
  • extra_usage_info – Dictionary containing extra values to add or override in the notification if not None.
pack_action_event_finish(context, instance_uuid, event_name, exc_val=None, exc_tb=None)
pack_action_event_start(context, instance_uuid, event_name)
pack_action_finish(context, instance_uuid)
pack_action_start(context, instance_uuid, action_name)
start_instance_usage_audit(context, conductor, begin, end, host, num_instances)
usage_volume_info(vol_usage)

Previous topic

The nova.compute.task_states Module

Next topic

The nova.compute.vm_mode Module

This Page