From 962e5843bb467e3cdfc2b8f0e70979dd596d823b Mon Sep 17 00:00:00 2001 From: gordon chung Date: Wed, 2 Sep 2015 17:47:15 -0400 Subject: [PATCH] remove old nova_notifier processing code the nova_notifier plugin was removed in Kilo. this removes the corresponding processing code. Change-Id: Ibd39b392293247ec088ceea4b592383b4b92f3f0 Closes-Bug: #1491603 --- ceilometer/compute/notifications/instance.py | 21 ----- .../compute/notifications/test_instance.py | 77 ------------------- 2 files changed, 98 deletions(-) diff --git a/ceilometer/compute/notifications/instance.py b/ceilometer/compute/notifications/instance.py index de75571d..356fbea5 100644 --- a/ceilometer/compute/notifications/instance.py +++ b/ceilometer/compute/notifications/instance.py @@ -87,24 +87,3 @@ class Instance(ComputeInstanceNotificationBase, project_id=message['payload']['tenant_id'], resource_id=message['payload']['instance_id'], message=message) - - -class InstanceDelete(ComputeInstanceNotificationBase): - """Handle the messages sent by the nova notifier plugin. - - Messages are sent when an instance is being deleted. - """ - - event_types = ['compute.instance.delete.samples'] - - def get_sample(self, message): - for s in message['payload'].get('samples', []): - yield sample.Sample.from_notification( - name=s['name'], - type=s['type'], - unit=s['unit'], - volume=s['volume'], - user_id=message['payload']['user_id'], - project_id=message['payload']['tenant_id'], - resource_id=message['payload']['instance_id'], - message=message) diff --git a/ceilometer/tests/unit/compute/notifications/test_instance.py b/ceilometer/tests/unit/compute/notifications/test_instance.py index 3f61a38a..fdd8e512 100644 --- a/ceilometer/tests/unit/compute/notifications/test_instance.py +++ b/ceilometer/tests/unit/compute/notifications/test_instance.py @@ -335,74 +335,6 @@ INSTANCE_RESIZE_REVERT_END = { u'priority': u'INFO' } -INSTANCE_DELETE_SAMPLES = { - u'_context_roles': [u'admin'], - u'_context_request_id': u'req-9da1d714-dabe-42fd-8baa-583e57cd4f1a', - u'_context_quota_class': None, - u'event_type': u'compute.instance.delete.samples', - u'_context_user_name': u'admin', - u'_context_project_name': u'admin', - u'timestamp': u'2013-01-04 15:20:32.009532', - u'_context_is_admin': True, - u'message_id': u'c48deeba-d0c3-4154-b3db-47480b52267a', - u'_context_auth_token': None, - u'_context_instance_lock_checked': False, - u'_context_project_id': u'cea4b25edb484e5392727181b7721d29', - u'_context_timestamp': u'2013-01-04T15:19:51.018218', - u'_context_read_deleted': u'no', - u'_context_user_id': u'01b83a5e23f24a6fb6cd073c0aee6eed', - u'_context_remote_address': u'10.147.132.184', - u'publisher_id': u'compute.ip-10-147-132-184.ec2.internal', - u'payload': {u'state_description': u'resize_reverting', - u'availability_zone': None, - u'ephemeral_gb': 0, - u'instance_type_id': 2, - u'deleted_at': u'', - u'reservation_id': u'r-u3fvim06', - u'memory_mb': 512, - u'user_id': u'01b83a5e23f24a6fb6cd073c0aee6eed', - u'hostname': u's1', - u'state': u'resized', - u'launched_at': u'2013-01-04T15:10:14.000000', - u'metadata': {u'metering.server_group': u'Group_A', - u'AutoScalingGroupName': u'tyky-Group_A-wste7', - u'metering.foo.bar': u'true'}, - u'ramdisk_id': u'5f23128e-5525-46d8-bc66-9c30cd87141a', - u'access_ip_v6': None, - u'disk_gb': 0, - u'access_ip_v4': None, - u'kernel_id': u'571478e0-d5e7-4c2e-95a5-2bc79443c28a', - u'host': u'ip-10-147-132-184.ec2.internal', - u'display_name': u's1', - u'image_ref_url': u'http://10.147.132.184:9292/images/' - 'a130b9d9-e00e-436e-9782-836ccef06e8a', - u'root_gb': 0, - u'tenant_id': u'cea4b25edb484e5392727181b7721d29', - u'created_at': u'2013-01-04T11:21:48.000000', - u'instance_id': u'648e8963-6886-4c3c-98f9-4511c292f86b', - u'instance_type': u'm1.tiny', - u'vcpus': 1, - u'image_meta': {u'kernel_id': - u'571478e0-d5e7-4c2e-95a5-2bc79443c28a', - u'ramdisk_id': - u'5f23128e-5525-46d8-bc66-9c30cd87141a', - u'base_image_ref': - u'a130b9d9-e00e-436e-9782-836ccef06e8a'}, - u'architecture': None, - u'os_type': None, - u'samples': [{u'name': u'sample-name1', - u'type': u'sample-type1', - u'unit': u'sample-units1', - u'volume': 1}, - {u'name': u'sample-name2', - u'type': u'sample-type2', - u'unit': u'sample-units2', - u'volume': 2}, - ], - }, - u'priority': u'INFO' -} - INSTANCE_SCHEDULED = { u'_context_request_id': u'req-f28a836a-32bf-4cc3-940a-3515878c181f', u'_context_quota_class': None, @@ -662,15 +594,6 @@ class TestNotifications(base.BaseTestCase): self.assertEqual(1, c.volume) self._verify_user_metadata(c.resource_metadata) - def test_instance_delete_samples(self): - ic = instance.InstanceDelete(None) - counters = list(ic.process_notification(INSTANCE_DELETE_SAMPLES)) - self.assertEqual(2, len(counters)) - names = [c.name for c in counters] - self.assertEqual(['sample-name1', 'sample-name2'], names) - c = counters[0] - self._verify_user_metadata(c.resource_metadata) - def test_instance_scheduled(self): ic = instance.InstanceScheduled(None)