Merge "Add uuid to service.update notification payload"
This commit is contained in:
commit
221427a043
@ -3,7 +3,7 @@
|
|||||||
"payload": {
|
"payload": {
|
||||||
"nova_object.namespace": "nova",
|
"nova_object.namespace": "nova",
|
||||||
"nova_object.name": "ServiceStatusPayload",
|
"nova_object.name": "ServiceStatusPayload",
|
||||||
"nova_object.version": "1.0",
|
"nova_object.version": "1.1",
|
||||||
"nova_object.data": {
|
"nova_object.data": {
|
||||||
"host": "host1",
|
"host": "host1",
|
||||||
"disabled": false,
|
"disabled": false,
|
||||||
@ -14,7 +14,8 @@
|
|||||||
"report_count": 1,
|
"report_count": 1,
|
||||||
"forced_down": false,
|
"forced_down": false,
|
||||||
"version": 17,
|
"version": 17,
|
||||||
"availability_zone": null
|
"availability_zone": null,
|
||||||
|
"uuid": "fa69c544-906b-4a6a-a9c6-c1f7a8078c73"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"event_type": "service.update",
|
"event_type": "service.update",
|
||||||
|
@ -41,10 +41,12 @@ class ServiceStatusPayload(base.NotificationPayloadBase):
|
|||||||
'availability_zone': ('service', 'availability_zone'),
|
'availability_zone': ('service', 'availability_zone'),
|
||||||
'last_seen_up': ('service', 'last_seen_up'),
|
'last_seen_up': ('service', 'last_seen_up'),
|
||||||
'forced_down': ('service', 'forced_down'),
|
'forced_down': ('service', 'forced_down'),
|
||||||
'version': ('service', 'version')
|
'version': ('service', 'version'),
|
||||||
|
'uuid': ('service', 'uuid')
|
||||||
}
|
}
|
||||||
# Version 1.0: Initial version
|
# Version 1.0: Initial version
|
||||||
VERSION = '1.0'
|
# Version 1.1: Added uuid field.
|
||||||
|
VERSION = '1.1'
|
||||||
fields = {
|
fields = {
|
||||||
'host': fields.StringField(nullable=True),
|
'host': fields.StringField(nullable=True),
|
||||||
'binary': fields.StringField(nullable=True),
|
'binary': fields.StringField(nullable=True),
|
||||||
@ -56,6 +58,7 @@ class ServiceStatusPayload(base.NotificationPayloadBase):
|
|||||||
'last_seen_up': fields.DateTimeField(nullable=True),
|
'last_seen_up': fields.DateTimeField(nullable=True),
|
||||||
'forced_down': fields.BooleanField(),
|
'forced_down': fields.BooleanField(),
|
||||||
'version': fields.IntegerField(),
|
'version': fields.IntegerField(),
|
||||||
|
'uuid': fields.UUIDField()
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, service):
|
def __init__(self, service):
|
||||||
|
@ -31,19 +31,23 @@ class TestServiceUpdateNotificationSample(
|
|||||||
test_services.fake_service_update)
|
test_services.fake_service_update)
|
||||||
self.useFixture(utils_fixture.TimeFixture(test_services.fake_utcnow()))
|
self.useFixture(utils_fixture.TimeFixture(test_services.fake_utcnow()))
|
||||||
self.useFixture(fixtures.SingleCellSimple())
|
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):
|
def test_service_enable(self):
|
||||||
body = {'host': 'host1',
|
body = {'host': 'host1',
|
||||||
'binary': 'nova-compute'}
|
'binary': 'nova-compute'}
|
||||||
self.admin_api.api_put('os-services/enable', body)
|
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):
|
def test_service_disabled(self):
|
||||||
body = {'host': 'host1',
|
body = {'host': 'host1',
|
||||||
'binary': 'nova-compute'}
|
'binary': 'nova-compute'}
|
||||||
self.admin_api.api_put('os-services/disable', body)
|
self.admin_api.api_put('os-services/disable', body)
|
||||||
self._verify_notification('service-update',
|
self._verify_notification('service-update',
|
||||||
replacements={'disabled': True})
|
replacements={'disabled': True,
|
||||||
|
'uuid': self.service_uuid})
|
||||||
|
|
||||||
def test_service_disabled_log_reason(self):
|
def test_service_disabled_log_reason(self):
|
||||||
body = {'host': 'host1',
|
body = {'host': 'host1',
|
||||||
@ -52,7 +56,8 @@ class TestServiceUpdateNotificationSample(
|
|||||||
self.admin_api.api_put('os-services/disable-log-reason', body)
|
self.admin_api.api_put('os-services/disable-log-reason', body)
|
||||||
self._verify_notification('service-update',
|
self._verify_notification('service-update',
|
||||||
replacements={'disabled': True,
|
replacements={'disabled': True,
|
||||||
'disabled_reason': 'test2'})
|
'disabled_reason': 'test2',
|
||||||
|
'uuid': self.service_uuid})
|
||||||
|
|
||||||
def test_service_force_down(self):
|
def test_service_force_down(self):
|
||||||
body = {'host': 'host1',
|
body = {'host': 'host1',
|
||||||
@ -62,4 +67,5 @@ class TestServiceUpdateNotificationSample(
|
|||||||
self._verify_notification('service-update',
|
self._verify_notification('service-update',
|
||||||
replacements={'forced_down': True,
|
replacements={'forced_down': True,
|
||||||
'disabled': True,
|
'disabled': True,
|
||||||
'disabled_reason': 'test2'})
|
'disabled_reason': 'test2',
|
||||||
|
'uuid': self.service_uuid})
|
||||||
|
@ -370,7 +370,7 @@ notification_object_data = {
|
|||||||
'IpPayload': '1.0-8ecf567a99e516d4af094439a7632d34',
|
'IpPayload': '1.0-8ecf567a99e516d4af094439a7632d34',
|
||||||
'NotificationPublisher': '1.0-bbbc1402fb0e443a3eb227cc52b61545',
|
'NotificationPublisher': '1.0-bbbc1402fb0e443a3eb227cc52b61545',
|
||||||
'ServiceStatusNotification': '1.0-a73147b93b520ff0061865849d3dfa56',
|
'ServiceStatusNotification': '1.0-a73147b93b520ff0061865849d3dfa56',
|
||||||
'ServiceStatusPayload': '1.0-c43a812046139e875ff2dc5590cd8d02',
|
'ServiceStatusPayload': '1.1-7b6856bd879db7f3ecbcd0ca9f35f92f',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user