Add uuid to service.update notification payload
Now that the services table has a uuid field and we'll be exposing that out of the REST API, we should include the uuid in the service.update notification payload. Part of blueprint service-hyper-uuid-in-api Change-Id: I8c400086a8dce9317a39f7e65c8d098d93af335d
This commit is contained in:
parent
fbfc7ac3c4
commit
14732e5571
@ -3,7 +3,7 @@
|
||||
"payload": {
|
||||
"nova_object.namespace": "nova",
|
||||
"nova_object.name": "ServiceStatusPayload",
|
||||
"nova_object.version": "1.0",
|
||||
"nova_object.version": "1.1",
|
||||
"nova_object.data": {
|
||||
"host": "host1",
|
||||
"disabled": false,
|
||||
@ -14,7 +14,8 @@
|
||||
"report_count": 1,
|
||||
"forced_down": false,
|
||||
"version": 17,
|
||||
"availability_zone": null
|
||||
"availability_zone": null,
|
||||
"uuid": "fa69c544-906b-4a6a-a9c6-c1f7a8078c73"
|
||||
}
|
||||
},
|
||||
"event_type": "service.update",
|
||||
|
@ -41,10 +41,12 @@ class ServiceStatusPayload(base.NotificationPayloadBase):
|
||||
'availability_zone': ('service', 'availability_zone'),
|
||||
'last_seen_up': ('service', 'last_seen_up'),
|
||||
'forced_down': ('service', 'forced_down'),
|
||||
'version': ('service', 'version')
|
||||
'version': ('service', 'version'),
|
||||
'uuid': ('service', 'uuid')
|
||||
}
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
# Version 1.1: Added uuid field.
|
||||
VERSION = '1.1'
|
||||
fields = {
|
||||
'host': fields.StringField(nullable=True),
|
||||
'binary': fields.StringField(nullable=True),
|
||||
@ -56,6 +58,7 @@ class ServiceStatusPayload(base.NotificationPayloadBase):
|
||||
'last_seen_up': fields.DateTimeField(nullable=True),
|
||||
'forced_down': fields.BooleanField(),
|
||||
'version': fields.IntegerField(),
|
||||
'uuid': fields.UUIDField()
|
||||
}
|
||||
|
||||
def __init__(self, service):
|
||||
|
@ -31,19 +31,23 @@ class TestServiceUpdateNotificationSample(
|
||||
test_services.fake_service_update)
|
||||
self.useFixture(utils_fixture.TimeFixture(test_services.fake_utcnow()))
|
||||
self.useFixture(fixtures.SingleCellSimple())
|
||||
self.service_uuid = test_services.fake_service_get_by_host_binary(
|
||||
None, 'host1', 'nova-compute')['uuid']
|
||||
|
||||
def test_service_enable(self):
|
||||
body = {'host': 'host1',
|
||||
'binary': 'nova-compute'}
|
||||
self.admin_api.api_put('os-services/enable', body)
|
||||
self._verify_notification('service-update')
|
||||
self._verify_notification('service-update',
|
||||
replacements={'uuid': self.service_uuid})
|
||||
|
||||
def test_service_disabled(self):
|
||||
body = {'host': 'host1',
|
||||
'binary': 'nova-compute'}
|
||||
self.admin_api.api_put('os-services/disable', body)
|
||||
self._verify_notification('service-update',
|
||||
replacements={'disabled': True})
|
||||
replacements={'disabled': True,
|
||||
'uuid': self.service_uuid})
|
||||
|
||||
def test_service_disabled_log_reason(self):
|
||||
body = {'host': 'host1',
|
||||
@ -52,7 +56,8 @@ class TestServiceUpdateNotificationSample(
|
||||
self.admin_api.api_put('os-services/disable-log-reason', body)
|
||||
self._verify_notification('service-update',
|
||||
replacements={'disabled': True,
|
||||
'disabled_reason': 'test2'})
|
||||
'disabled_reason': 'test2',
|
||||
'uuid': self.service_uuid})
|
||||
|
||||
def test_service_force_down(self):
|
||||
body = {'host': 'host1',
|
||||
@ -62,4 +67,5 @@ class TestServiceUpdateNotificationSample(
|
||||
self._verify_notification('service-update',
|
||||
replacements={'forced_down': True,
|
||||
'disabled': True,
|
||||
'disabled_reason': 'test2'})
|
||||
'disabled_reason': 'test2',
|
||||
'uuid': self.service_uuid})
|
||||
|
@ -370,7 +370,7 @@ notification_object_data = {
|
||||
'IpPayload': '1.0-8ecf567a99e516d4af094439a7632d34',
|
||||
'NotificationPublisher': '1.0-bbbc1402fb0e443a3eb227cc52b61545',
|
||||
'ServiceStatusNotification': '1.0-a73147b93b520ff0061865849d3dfa56',
|
||||
'ServiceStatusPayload': '1.0-c43a812046139e875ff2dc5590cd8d02',
|
||||
'ServiceStatusPayload': '1.1-7b6856bd879db7f3ecbcd0ca9f35f92f',
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user