Merge "Fix bad CDMC update on reception of service.update"

This commit is contained in:
Jenkins 2017-01-23 13:30:33 +00:00 committed by Gerrit Code Review
commit 22cad5651e
4 changed files with 37 additions and 2 deletions

View File

@ -121,7 +121,7 @@ class NovaNotification(base.NotificationEndpoint):
if node_data['forced_down'] else element.ServiceState.ONLINE.value)
node.status = (
element.ServiceState.DISABLED.value
if node_data['host'] else element.ServiceState.ENABLED.value)
if node_data['disabled'] else element.ServiceState.ENABLED.value)
def create_compute_node(self, node_hostname):
"""Update the compute node by querying the Nova API."""

View File

@ -0,0 +1,21 @@
{
"priority": "INFO",
"payload": {
"nova_object.namespace": "nova",
"nova_object.name": "ServiceStatusPayload",
"nova_object.version": "1.0",
"nova_object.data": {
"host": "Node_0",
"disabled": false,
"last_seen_up": "2012-10-29T13:42:05Z",
"binary": "nova-compute",
"topic": "compute",
"disabled_reason": null,
"report_count": 1,
"forced_down": false,
"version": 15
}
},
"event_type": "service.update",
"publisher_id": "nova-compute:Node_0"
}

View File

@ -127,7 +127,7 @@ class TestNovaNotifications(NotificationTestCase):
node0_uuid = 'Node_0'
node0 = compute_model.get_node_by_uuid(node0_uuid)
message = self.load_message('scenario3_service-update.json')
message = self.load_message('scenario3_service-update-disabled.json')
self.assertEqual('hostname_0', node0.hostname)
self.assertEqual(element.ServiceState.ONLINE.value, node0.state)
@ -145,6 +145,20 @@ class TestNovaNotifications(NotificationTestCase):
self.assertEqual(element.ServiceState.OFFLINE.value, node0.state)
self.assertEqual(element.ServiceState.DISABLED.value, node0.status)
message = self.load_message('scenario3_service-update-enabled.json')
handler.info(
ctxt=self.context,
publisher_id=message['publisher_id'],
event_type=message['event_type'],
payload=message['payload'],
metadata=self.FAKE_METADATA,
)
self.assertEqual('Node_0', node0.hostname)
self.assertEqual(element.ServiceState.ONLINE.value, node0.state)
self.assertEqual(element.ServiceState.ENABLED.value, node0.status)
def test_nova_instance_update(self):
compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes()
self.fake_cdmc.cluster_data_model = compute_model