summaryrefslogtreecommitdiff
path: root/neutron/notifiers
diff options
context:
space:
mode:
authorCedric Brandily <zzelle@gmail.com>2017-03-01 18:33:57 +0100
committerCedric Brandily <zzelle@gmail.com>2017-03-01 18:34:36 +0100
commita5e04fbd84b96e306db3d3ed6140fa82e7441495 (patch)
tree8ff59ea10e26bcbb1ff4d22f0b2378ef3a1af911 /neutron/notifiers
parente2e90dd83f0df2d72eccfd8a033018e1cf89be66 (diff)
downloadneutron-a5e04fbd84b96e306db3d3ed6140fa82e7441495.tar.gz
Use registry.receives decorator in neutron.notifiers.nova
Switch to registry.receives decorator in neutron.notifiers.nova. Partial-Bug: #1668262 Change-Id: I50f61f97ded73cd3b7f18ac97d8d4b918554e098
Diffstat (limited to 'neutron/notifiers')
-rw-r--r--neutron/notifiers/nova.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/neutron/notifiers/nova.py b/neutron/notifiers/nova.py
index 9a7dccb690..bd7b204d6f 100644
--- a/neutron/notifiers/nova.py
+++ b/neutron/notifiers/nova.py
@@ -43,6 +43,7 @@ NEUTRON_NOVA_EVENT_STATUS_MAP = {constants.PORT_STATUS_ACTIVE: 'completed',
NOVA_API_VERSION = "2"
+@registry.has_registry_receivers
class Notifier(object):
_instance = None
@@ -74,15 +75,6 @@ class Notifier(object):
self.batch_notifier = batch_notifier.BatchNotifier(
cfg.CONF.send_events_interval, self.send_events)
- # register callbacks for events pertaining resources affecting Nova
- callback_resources = (
- resources.FLOATING_IP,
- resources.PORT,
- )
- for resource in callback_resources:
- registry.subscribe(self._send_nova_notification,
- resource, events.BEFORE_RESPONSE)
-
def _is_compute_port(self, port):
try:
if (port['device_id'] and uuidutils.is_uuid_like(port['device_id'])
@@ -103,6 +95,8 @@ class Notifier(object):
'name': VIF_DELETED,
'tag': port['id']}
+ @registry.receives(resources.PORT, events.BEFORE_RESPONSE)
+ @registry.receives(resources.FLOATING_IP, events.BEFORE_RESPONSE)
def _send_nova_notification(self, resource, event, trigger,
action=None, original=None, data=None,
**kwargs):