def notify_about_instance_action(context, instance, host, action, phase=None, source=fields.NotificationSource.COMPUTE, exception=None, bdms=None, tb=None): """Send versioned notification about the action made on the instance :param instance: the instance which the action performed on :param host: the host emitting the notification :param action: the name of the action :param phase: the phase of the action :param source: the source of the notification :param exception: the thrown exception (used in error notifications) :param bdms: BlockDeviceMappingList object for the instance. If it is not provided then we will load it from the db if so configured :param tb: the traceback (used in error notifications) """ fault, priority = _get_fault_and_priority_from_exc_and_tb(exception, tb) payload = instance_notification.InstanceActionPayload( context=context, instance=instance, fault=fault, bdms=bdms) notification = instance_notification.InstanceActionNotification( context=context, priority=priority, publisher=notification_base.NotificationPublisher( host=host, source=source), event_type=notification_base.EventType( object='instance', action=action, phase=phase), payload=payload) notification.emit(context)
def notify_about_instance_action(context, instance, host, action, phase=None, binary='nova-compute', exception=None): """Send versioned notification about the action made on the instance :param instance: the instance which the action performed on :param host: the host emitting the notification :param action: the name of the action :param phase: the phase of the action :param binary: the binary emitting the notification :param exception: the thrown exception (used in error notifications) """ ips = _get_instance_ips(instance) flavor = instance_notification.FlavorPayload(instance=instance) fault, priority = _get_fault_and_priority_from_exc(exception) payload = instance_notification.InstanceActionPayload(instance=instance, fault=fault, ip_addresses=ips, flavor=flavor) notification = instance_notification.InstanceActionNotification( context=context, priority=priority, publisher=notification_base.NotificationPublisher(context=context, host=host, binary=binary), event_type=notification_base.EventType(object='instance', action=action, phase=phase), payload=payload) notification.emit(context)
def notify_about_instance_action(context, instance, host, action, phase=None, source=fields.NotificationSource.COMPUTE, exception=None): """Send versioned notification about the action made on the instance :param instance: the instance which the action performed on :param host: the host emitting the notification :param action: the name of the action :param phase: the phase of the action :param source: the source of the notification :param exception: the thrown exception (used in error notifications) """ fault, priority = _get_fault_and_priority_from_exc(exception) payload = instance_notification.InstanceActionPayload(instance=instance, fault=fault) notification = instance_notification.InstanceActionNotification( context=context, priority=priority, publisher=notification_base.NotificationPublisher(host=host, source=source), event_type=notification_base.EventType(object='instance', action=action, phase=phase), payload=payload) notification.emit(context)
def notify_about_instance_action(context, instance, host, action, phase=None, binary='nova-compute'): """Send versioned notification about the action made on the instance :param instance: the instance which the action performed on :param host: the host emitting the notification :param action: the name of the action :param phase: the phase of the action :param binary: the binary emitting the notification """ ips = _get_instance_ips(instance) flavor = instance_notification.FlavorPayload(instance=instance) # TODO(gibi): handle fault during the transformation of the first error # notifications payload = instance_notification.InstanceActionPayload(instance=instance, fault=None, ip_addresses=ips, flavor=flavor) notification = instance_notification.InstanceActionNotification( context=context, priority=fields.NotificationPriority.INFO, publisher=notification_base.NotificationPublisher(context=context, host=host, binary=binary), event_type=notification_base.EventType(object='instance', action=action, phase=phase), payload=payload) notification.emit(context)
def notify_about_instance_action(context, instance, host, action, phase=None, binary='nova-compute'): """Send versioned notification about the action made on the instance :param instance: the instance which the action performed on :param host: the host emitting the notification :param action: the name of the action :param phase: the phase of the action :param binary: the binary emitting the notification """ network_info = get_nw_info_for_instance(instance) ips = [] if network_info is not None: for vif in network_info: for ip in vif.fixed_ips(): ips.append( instance_notification.IpPayload( label=vif["network"]["label"], mac=vif["address"], meta=vif["meta"], port_uuid=vif["id"], version=ip["version"], address=ip["address"], device_name=vif["devname"])) flavor = instance_notification.FlavorPayload(instance=instance) # TODO(gibi): handle fault during the transformation of the first error # notifications payload = instance_notification.InstanceActionPayload(instance=instance, fault=None, ip_addresses=ips, flavor=flavor) notification = instance_notification.InstanceActionNotification( context=context, priority=fields.NotificationPriority.INFO, publisher=notification_base.NotificationPublisher(context=context, host=host, binary=binary), event_type=notification_base.EventType(object='instance', action=action, phase=phase), payload=payload) notification.emit(context)