Use registry.receives decorator in neutron.notifiers.nova
Switch to registry.receives decorator in neutron.notifiers.nova. Partial-Bug: #1668262 Change-Id: I50f61f97ded73cd3b7f18ac97d8d4b918554e098
This commit is contained in:
parent
e2e90dd83f
commit
a5e04fbd84
|
@ -43,6 +43,7 @@ NEUTRON_NOVA_EVENT_STATUS_MAP = {constants.PORT_STATUS_ACTIVE: 'completed',
|
||||||
NOVA_API_VERSION = "2"
|
NOVA_API_VERSION = "2"
|
||||||
|
|
||||||
|
|
||||||
|
@registry.has_registry_receivers
|
||||||
class Notifier(object):
|
class Notifier(object):
|
||||||
|
|
||||||
_instance = None
|
_instance = None
|
||||||
|
@ -74,15 +75,6 @@ class Notifier(object):
|
||||||
self.batch_notifier = batch_notifier.BatchNotifier(
|
self.batch_notifier = batch_notifier.BatchNotifier(
|
||||||
cfg.CONF.send_events_interval, self.send_events)
|
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):
|
def _is_compute_port(self, port):
|
||||||
try:
|
try:
|
||||||
if (port['device_id'] and uuidutils.is_uuid_like(port['device_id'])
|
if (port['device_id'] and uuidutils.is_uuid_like(port['device_id'])
|
||||||
|
@ -103,6 +95,8 @@ class Notifier(object):
|
||||||
'name': VIF_DELETED,
|
'name': VIF_DELETED,
|
||||||
'tag': port['id']}
|
'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,
|
def _send_nova_notification(self, resource, event, trigger,
|
||||||
action=None, original=None, data=None,
|
action=None, original=None, data=None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
|
|
Loading…
Reference in New Issue