From 99fffea9dc484dd84185e2ae33a413bc6fbd6724 Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Mon, 7 Nov 2016 17:07:41 +0100 Subject: [PATCH] Transform aggregate.delete notification The aggregate.delete.start and aggregate.delete.end notifications has been transformed to the versioned notification framework. Implements: bp versioned-notification-transformation-ocata Change-Id: I911e7aef813380291e6cf166eac91b53215a3726 --- .../aggregate-delete-end.json | 19 +++++++++++++++++++ .../aggregate-delete-start.json | 19 +++++++++++++++++++ nova/notifications/objects/aggregate.py | 2 ++ .../test_aggregate.py | 16 ++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 doc/notification_samples/aggregate-delete-end.json create mode 100644 doc/notification_samples/aggregate-delete-start.json diff --git a/doc/notification_samples/aggregate-delete-end.json b/doc/notification_samples/aggregate-delete-end.json new file mode 100644 index 000000000..61dbaa1f7 --- /dev/null +++ b/doc/notification_samples/aggregate-delete-end.json @@ -0,0 +1,19 @@ +{ + "priority": "INFO", + "payload": { + "nova_object.version": "1.0", + "nova_object.namespace": "nova", + "nova_object.name": "AggregatePayload", + "nova_object.data": { + "name": "my-aggregate", + "metadata": { + "availability_zone": "nova" + }, + "hosts": [], + "id": 1, + "uuid": "788608ec-ebdc-45c5-bc7f-e5f24ab92c80" + } + }, + "event_type": "aggregate.delete.end", + "publisher_id": "nova-api:fake-mini" +} diff --git a/doc/notification_samples/aggregate-delete-start.json b/doc/notification_samples/aggregate-delete-start.json new file mode 100644 index 000000000..8bd25fe43 --- /dev/null +++ b/doc/notification_samples/aggregate-delete-start.json @@ -0,0 +1,19 @@ +{ + "priority": "INFO", + "payload": { + "nova_object.version": "1.0", + "nova_object.namespace": "nova", + "nova_object.name": "AggregatePayload", + "nova_object.data": { + "name": "my-aggregate", + "metadata": { + "availability_zone": "nova" + }, + "hosts": [], + "id": 1, + "uuid": "788608ec-ebdc-45c5-bc7f-e5f24ab92c80" + } + }, + "event_type": "aggregate.delete.start", + "publisher_id": "nova-api:fake-mini" +} diff --git a/nova/notifications/objects/aggregate.py b/nova/notifications/objects/aggregate.py index 5d1160acc..677689827 100644 --- a/nova/notifications/objects/aggregate.py +++ b/nova/notifications/objects/aggregate.py @@ -41,6 +41,8 @@ class AggregatePayload(base.NotificationPayloadBase): @base.notification_sample('aggregate-create-start.json') @base.notification_sample('aggregate-create-end.json') +@base.notification_sample('aggregate-delete-start.json') +@base.notification_sample('aggregate-delete-end.json') @nova_base.NovaObjectRegistry.register_notification class AggregateNotification(base.NotificationBase): # Version 1.0: Initial version diff --git a/nova/tests/functional/notification_sample_tests/test_aggregate.py b/nova/tests/functional/notification_sample_tests/test_aggregate.py index 6fc4fdbda..d5c0ccfae 100644 --- a/nova/tests/functional/notification_sample_tests/test_aggregate.py +++ b/nova/tests/functional/notification_sample_tests/test_aggregate.py @@ -38,3 +38,19 @@ class TestAggregateNotificationSample( 'uuid': self.ANY, 'id': aggregate['id']}, actual=fake_notifier.VERSIONED_NOTIFICATIONS[1]) + + self.admin_api.delete_aggregate(aggregate['id']) + + self.assertEqual(4, len(fake_notifier.VERSIONED_NOTIFICATIONS)) + self._verify_notification( + 'aggregate-delete-start', + replacements={ + 'uuid': self.ANY, + 'id': aggregate['id']}, + actual=fake_notifier.VERSIONED_NOTIFICATIONS[2]) + self._verify_notification( + 'aggregate-delete-end', + replacements={ + 'uuid': self.ANY, + 'id': aggregate['id']}, + actual=fake_notifier.VERSIONED_NOTIFICATIONS[3])