remove nova legacy notifications
http://lists.openstack.org/pipermail/openstack-dev/2018-August/133071.html Closes-Bug: #1793048 Change-Id: Id591c8979fd4a6bda674588060eaf51386d937cb
This commit is contained in:
@@ -164,13 +164,6 @@ class NovaClusterDataModelCollector(base.BaseClusterDataModelCollector):
|
||||
nova.InstanceCreated(self),
|
||||
nova.InstanceUpdated(self),
|
||||
nova.InstanceDeletedEnd(self),
|
||||
|
||||
nova.LegacyInstanceCreatedEnd(self),
|
||||
nova.LegacyInstanceUpdated(self),
|
||||
nova.LegacyInstanceDeletedEnd(self),
|
||||
nova.LegacyLiveMigratedEnd(self),
|
||||
nova.LegacyInstanceResizeConfirmEnd(self),
|
||||
nova.LegacyInstanceRebuildEnd(self),
|
||||
]
|
||||
|
||||
def get_audit_scope_handler(self, audit_scope):
|
||||
|
||||
@@ -88,32 +88,6 @@ class NovaNotification(base.NotificationEndpoint):
|
||||
|
||||
self.update_instance_mapping(instance, node)
|
||||
|
||||
def legacy_update_instance(self, instance, data):
|
||||
memory_mb = data['memory_mb']
|
||||
num_cores = data['vcpus']
|
||||
disk_gb = data['root_gb']
|
||||
instance_metadata = data['metadata']
|
||||
|
||||
instance.update({
|
||||
'state': data['state'],
|
||||
'hostname': data['hostname'],
|
||||
'human_id': data['display_name'],
|
||||
'memory': memory_mb,
|
||||
'vcpus': num_cores,
|
||||
'disk': disk_gb,
|
||||
'disk_capacity': disk_gb,
|
||||
'metadata': instance_metadata,
|
||||
})
|
||||
|
||||
try:
|
||||
node = self.get_or_create_node(data['host'])
|
||||
except exception.ComputeNodeNotFound as exc:
|
||||
LOG.exception(exc)
|
||||
# If we can't create the node, we consider the instance as unmapped
|
||||
node = None
|
||||
|
||||
self.update_instance_mapping(instance, node)
|
||||
|
||||
def update_compute_node(self, node, data):
|
||||
"""Update the compute node using the notification data."""
|
||||
node_data = data['nova_object.data']
|
||||
@@ -212,10 +186,6 @@ class VersionedNotificationEndpoint(NovaNotification):
|
||||
publisher_id_regex = r'^nova-compute.*'
|
||||
|
||||
|
||||
class UnversionedNotificationEndpoint(NovaNotification):
|
||||
publisher_id_regex = r'^compute.*'
|
||||
|
||||
|
||||
class ServiceUpdated(VersionedNotificationEndpoint):
|
||||
|
||||
@property
|
||||
@@ -357,171 +327,3 @@ class InstanceDeletedEnd(VersionedNotificationEndpoint):
|
||||
node = None
|
||||
|
||||
self.delete_instance(instance, node)
|
||||
|
||||
|
||||
class LegacyInstanceUpdated(UnversionedNotificationEndpoint):
|
||||
|
||||
@property
|
||||
def filter_rule(self):
|
||||
"""Nova compute.instance.update notification filter"""
|
||||
return filtering.NotificationFilter(
|
||||
publisher_id=self.publisher_id_regex,
|
||||
event_type='compute.instance.update',
|
||||
)
|
||||
|
||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||
ctxt.request_id = metadata['message_id']
|
||||
ctxt.project_domain = event_type
|
||||
LOG.info("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s",
|
||||
dict(event=event_type,
|
||||
publisher=publisher_id,
|
||||
metadata=metadata))
|
||||
LOG.debug(payload)
|
||||
|
||||
instance_uuid = payload['instance_id']
|
||||
node_uuid = payload.get('node')
|
||||
instance = self.get_or_create_instance(instance_uuid, node_uuid)
|
||||
|
||||
self.legacy_update_instance(instance, payload)
|
||||
|
||||
|
||||
class LegacyInstanceCreatedEnd(UnversionedNotificationEndpoint):
|
||||
|
||||
@property
|
||||
def filter_rule(self):
|
||||
"""Nova compute.instance.create.end notification filter"""
|
||||
return filtering.NotificationFilter(
|
||||
publisher_id=self.publisher_id_regex,
|
||||
event_type='compute.instance.create.end',
|
||||
)
|
||||
|
||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||
ctxt.request_id = metadata['message_id']
|
||||
ctxt.project_domain = event_type
|
||||
LOG.info("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s",
|
||||
dict(event=event_type,
|
||||
publisher=publisher_id,
|
||||
metadata=metadata))
|
||||
LOG.debug(payload)
|
||||
|
||||
instance_uuid = payload['instance_id']
|
||||
node_uuid = payload.get('node')
|
||||
instance = self.get_or_create_instance(instance_uuid, node_uuid)
|
||||
|
||||
self.legacy_update_instance(instance, payload)
|
||||
|
||||
|
||||
class LegacyInstanceDeletedEnd(UnversionedNotificationEndpoint):
|
||||
|
||||
@property
|
||||
def filter_rule(self):
|
||||
"""Nova compute.instance.delete.end notification filter"""
|
||||
return filtering.NotificationFilter(
|
||||
publisher_id=self.publisher_id_regex,
|
||||
event_type='compute.instance.delete.end',
|
||||
)
|
||||
|
||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||
ctxt.request_id = metadata['message_id']
|
||||
ctxt.project_domain = event_type
|
||||
LOG.info("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s",
|
||||
dict(event=event_type,
|
||||
publisher=publisher_id,
|
||||
metadata=metadata))
|
||||
LOG.debug(payload)
|
||||
instance_uuid = payload['instance_id']
|
||||
node_uuid = payload.get('node')
|
||||
instance = self.get_or_create_instance(instance_uuid, node_uuid)
|
||||
|
||||
try:
|
||||
node = self.get_or_create_node(payload['host'])
|
||||
except exception.ComputeNodeNotFound as exc:
|
||||
LOG.exception(exc)
|
||||
# If we can't create the node, we consider the instance as unmapped
|
||||
node = None
|
||||
|
||||
self.delete_instance(instance, node)
|
||||
|
||||
|
||||
class LegacyLiveMigratedEnd(UnversionedNotificationEndpoint):
|
||||
|
||||
@property
|
||||
def filter_rule(self):
|
||||
"""Nova *.live_migration.post.dest.end notification filter"""
|
||||
return filtering.NotificationFilter(
|
||||
publisher_id=self.publisher_id_regex,
|
||||
event_type='compute.instance.live_migration.post.dest.end',
|
||||
)
|
||||
|
||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||
ctxt.request_id = metadata['message_id']
|
||||
ctxt.project_domain = event_type
|
||||
LOG.info("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s",
|
||||
dict(event=event_type,
|
||||
publisher=publisher_id,
|
||||
metadata=metadata))
|
||||
LOG.debug(payload)
|
||||
|
||||
instance_uuid = payload['instance_id']
|
||||
node_uuid = payload.get('node')
|
||||
instance = self.get_or_create_instance(instance_uuid, node_uuid)
|
||||
|
||||
self.legacy_update_instance(instance, payload)
|
||||
|
||||
|
||||
class LegacyInstanceResizeConfirmEnd(UnversionedNotificationEndpoint):
|
||||
|
||||
@property
|
||||
def filter_rule(self):
|
||||
"""Nova compute.instance.resize.confirm.end filter"""
|
||||
return filtering.NotificationFilter(
|
||||
publisher_id=self.publisher_id_regex,
|
||||
event_type='compute.instance.resize.confirm.end',
|
||||
)
|
||||
|
||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||
ctxt.request_id = metadata['message_id']
|
||||
ctxt.project_domain = event_type
|
||||
LOG.info("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s",
|
||||
dict(event=event_type,
|
||||
publisher=publisher_id,
|
||||
metadata=metadata))
|
||||
LOG.debug(payload)
|
||||
|
||||
instance_uuid = payload['instance_id']
|
||||
node_uuid = payload.get('node')
|
||||
instance = self.get_or_create_instance(instance_uuid, node_uuid)
|
||||
|
||||
self.legacy_update_instance(instance, payload)
|
||||
|
||||
|
||||
class LegacyInstanceRebuildEnd(UnversionedNotificationEndpoint):
|
||||
|
||||
@property
|
||||
def filter_rule(self):
|
||||
"""Nova compute.instance.rebuild.end filter"""
|
||||
return filtering.NotificationFilter(
|
||||
publisher_id=self.publisher_id_regex,
|
||||
event_type='compute.instance.rebuild.end',
|
||||
)
|
||||
|
||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||
ctxt.request_id = metadata['message_id']
|
||||
ctxt.project_domain = event_type
|
||||
LOG.info("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s",
|
||||
dict(event=event_type,
|
||||
publisher=publisher_id,
|
||||
metadata=metadata))
|
||||
LOG.debug(payload)
|
||||
|
||||
instance_uuid = payload['instance_id']
|
||||
node_uuid = payload.get('node')
|
||||
instance = self.get_or_create_instance(instance_uuid, node_uuid)
|
||||
|
||||
self.legacy_update_instance(instance, payload)
|
||||
|
||||
Reference in New Issue
Block a user