Fixed a DBerror on reducing node_count on bay

The method "create_k8s_api" expects a bay_uuid argument, but a bay
was passed, which causes the error.

Change-Id: I9cbf6c11bf62ea938624adf6f8c050097dab91ca
Closes-Bug: #1539356
This commit is contained in:
Hongbin Lu 2016-01-29 15:25:12 -05:00
parent 104d225466
commit 39270aefaf
2 changed files with 4 additions and 1 deletions

View File

@ -47,7 +47,7 @@ class ScaleManager(object):
'stack_id': stack.id})
hosts_no_container = list(hosts)
k8s_api = k8s.create_k8s_api(self.context, bay)
k8s_api = k8s.create_k8s_api(self.context, bay.uuid)
for pod in k8s_api.list_namespaced_pod(namespace='default').items:
host = pod.spec.node_name
if host in hosts_no_container:

View File

@ -59,6 +59,9 @@ class TestScaleManager(base.TestCase):
else:
removal_hosts = scale_mgr.get_removal_nodes(mock_heat_output)
self.assertEqual(expected_removal_hosts, removal_hosts)
if num_of_removal > 0:
mock_create_k8s_api.assert_called_once_with(mock_context,
mock_bay.uuid)
@mock.patch('magnum.objects.Bay.get_by_uuid')
@mock.patch('magnum.conductor.scale_manager.ScaleManager._is_scale_down')