Merge "Transform aggregate.remove_host notification"
This commit is contained in:
commit
19e322e574
19
doc/notification_samples/aggregate-remove_host-end.json
Normal file
19
doc/notification_samples/aggregate-remove_host-end.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"priority": "INFO",
|
||||||
|
"payload": {
|
||||||
|
"nova_object.version": "1.1",
|
||||||
|
"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.remove_host.end",
|
||||||
|
"publisher_id": "nova-api:fake-mini"
|
||||||
|
}
|
19
doc/notification_samples/aggregate-remove_host-start.json
Normal file
19
doc/notification_samples/aggregate-remove_host-start.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"priority": "INFO",
|
||||||
|
"payload": {
|
||||||
|
"nova_object.version": "1.1",
|
||||||
|
"nova_object.namespace": "nova",
|
||||||
|
"nova_object.name": "AggregatePayload",
|
||||||
|
"nova_object.data": {
|
||||||
|
"name": "my-aggregate",
|
||||||
|
"metadata": {
|
||||||
|
"availability_zone": "nova"
|
||||||
|
},
|
||||||
|
"hosts": ["compute"],
|
||||||
|
"id": 1,
|
||||||
|
"uuid": "788608ec-ebdc-45c5-bc7f-e5f24ab92c80"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"event_type": "aggregate.remove_host.start",
|
||||||
|
"publisher_id": "nova-api:fake-mini"
|
||||||
|
}
|
@ -48,6 +48,8 @@ class AggregatePayload(base.NotificationPayloadBase):
|
|||||||
@base.notification_sample('aggregate-delete-end.json')
|
@base.notification_sample('aggregate-delete-end.json')
|
||||||
@base.notification_sample('aggregate-add_host-start.json')
|
@base.notification_sample('aggregate-add_host-start.json')
|
||||||
@base.notification_sample('aggregate-add_host-end.json')
|
@base.notification_sample('aggregate-add_host-end.json')
|
||||||
|
@base.notification_sample('aggregate-remove_host-start.json')
|
||||||
|
@base.notification_sample('aggregate-remove_host-end.json')
|
||||||
@nova_base.NovaObjectRegistry.register_notification
|
@nova_base.NovaObjectRegistry.register_notification
|
||||||
class AggregateNotification(base.NotificationBase):
|
class AggregateNotification(base.NotificationBase):
|
||||||
# Version 1.0: Initial version
|
# Version 1.0: Initial version
|
||||||
|
@ -53,7 +53,7 @@ class TestAggregateNotificationSample(
|
|||||||
'id': aggregate['id']},
|
'id': aggregate['id']},
|
||||||
actual=fake_notifier.VERSIONED_NOTIFICATIONS[3])
|
actual=fake_notifier.VERSIONED_NOTIFICATIONS[3])
|
||||||
|
|
||||||
def test_aggregate_add_host(self):
|
def test_aggregate_add_remove_host(self):
|
||||||
aggregate_req = {
|
aggregate_req = {
|
||||||
"aggregate": {
|
"aggregate": {
|
||||||
"name": "my-aggregate",
|
"name": "my-aggregate",
|
||||||
@ -82,3 +82,26 @@ class TestAggregateNotificationSample(
|
|||||||
'uuid': aggregate['uuid'],
|
'uuid': aggregate['uuid'],
|
||||||
'id': aggregate['id']},
|
'id': aggregate['id']},
|
||||||
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
|
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
|
||||||
|
|
||||||
|
remove_host_req = {
|
||||||
|
"remove_host": {
|
||||||
|
"host": "compute"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.admin_api.post_aggregate_action(aggregate['id'], remove_host_req)
|
||||||
|
|
||||||
|
self.assertEqual(4, len(fake_notifier.VERSIONED_NOTIFICATIONS))
|
||||||
|
self._verify_notification(
|
||||||
|
'aggregate-remove_host-start',
|
||||||
|
replacements={
|
||||||
|
'uuid': aggregate['uuid'],
|
||||||
|
'id': aggregate['id']},
|
||||||
|
actual=fake_notifier.VERSIONED_NOTIFICATIONS[2])
|
||||||
|
self._verify_notification(
|
||||||
|
'aggregate-remove_host-end',
|
||||||
|
replacements={
|
||||||
|
'uuid': aggregate['uuid'],
|
||||||
|
'id': aggregate['id']},
|
||||||
|
actual=fake_notifier.VERSIONED_NOTIFICATIONS[3])
|
||||||
|
|
||||||
|
self.admin_api.delete_aggregate(aggregate['id'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user