Merge "Fix cluster health check faild"

This commit is contained in:
Zuul 2018-02-07 07:27:42 +00:00 committed by Gerrit Code Review
commit a42e321f8a
2 changed files with 12 additions and 10 deletions

View File

@ -87,8 +87,8 @@ class NovaNotificationEndpoint(object):
node_id = meta.get('cluster_node_id') node_id = meta.get('cluster_node_id')
if node_id: if node_id:
LOG.info("Requesting node recovery: %s", node_id) LOG.info("Requesting node recovery: %s", node_id)
ctx = context.get_service_context(project=self.project_id, ctx = context.get_service_context(project_id=self.project_id,
user=payload['user_id']) user_id=payload['user_id'])
req = objects.NodeRecoverRequest(identity=node_id, req = objects.NodeRecoverRequest(identity=node_id,
params=params) params=params)
self.rpc.call(ctx, 'node_recover', req) self.rpc.call(ctx, 'node_recover', req)
@ -154,8 +154,8 @@ class HeatNotificationEndpoint(object):
'operation': self.recover_action['operation'], 'operation': self.recover_action['operation'],
} }
LOG.info("Requesting stack recovery: %s", node_id) LOG.info("Requesting stack recovery: %s", node_id)
ctx = context.get_service_context(project=self.project_id, ctx = context.get_service_context(project_id=self.project_id,
user=payload['user_identity']) user_id=payload['user_identity'])
req = objects.NodeRecoverRequest(identity=node_id, params=params) req = objects.NodeRecoverRequest(identity=node_id, params=params)
self.rpc.call(ctx, 'node_recover', req) self.rpc.call(ctx, 'node_recover', req)
@ -250,8 +250,8 @@ class HealthManager(service.Service):
LOG.warning("Cluster (%s) is not found.", cluster_id) LOG.warning("Cluster (%s) is not found.", cluster_id)
return _chase_up(start_time, timeout) return _chase_up(start_time, timeout)
ctx = context.get_service_context(user=cluster.user, ctx = context.get_service_context(user_id=cluster.user,
project=cluster.project) project_id=cluster.project)
params = {'delete_check_action': True} params = {'delete_check_action': True}
try: try:
req = objects.ClusterCheckRequest(identity=cluster_id, req = objects.ClusterCheckRequest(identity=cluster_id,

View File

@ -605,8 +605,8 @@ class TestHealthManager(base.SenlinTestCase):
self.assertEqual(mock_chase.return_value, res) self.assertEqual(mock_chase.return_value, res)
mock_get.assert_called_once_with(self.hm.ctx, 'CLUSTER_ID', mock_get.assert_called_once_with(self.hm.ctx, 'CLUSTER_ID',
project_safe=False) project_safe=False)
mock_ctx.assert_called_once_with(user=x_cluster.user, mock_ctx.assert_called_once_with(user_id=x_cluster.user,
project=x_cluster.project) project_id=x_cluster.project)
mock_rpc.assert_has_calls([ mock_rpc.assert_has_calls([
mock.call(ctx, 'cluster_check', mock.ANY), mock.call(ctx, 'cluster_check', mock.ANY),
mock.call(ctx, 'node_recover', mock.ANY) mock.call(ctx, 'node_recover', mock.ANY)
@ -647,7 +647,8 @@ class TestHealthManager(base.SenlinTestCase):
self.assertEqual(mock_chase.return_value, res) self.assertEqual(mock_chase.return_value, res)
mock_get.assert_called_once_with(self.hm.ctx, 'CLUSTER_ID', mock_get.assert_called_once_with(self.hm.ctx, 'CLUSTER_ID',
project_safe=False) project_safe=False)
mock_ctx.assert_called_once_with(user='USER_ID', project='PROJECT_ID') mock_ctx.assert_called_once_with(user_id='USER_ID',
project_id='PROJECT_ID')
mock_check.assert_called_once_with(ctx, 'cluster_check', mock.ANY) mock_check.assert_called_once_with(ctx, 'cluster_check', mock.ANY)
mock_chase.assert_called_once_with(mock.ANY, 123) mock_chase.assert_called_once_with(mock.ANY, 123)
@ -673,7 +674,8 @@ class TestHealthManager(base.SenlinTestCase):
self.assertEqual(mock_chase.return_value, res) self.assertEqual(mock_chase.return_value, res)
mock_get.assert_called_once_with(self.hm.ctx, 'CLUSTER_ID', mock_get.assert_called_once_with(self.hm.ctx, 'CLUSTER_ID',
project_safe=False) project_safe=False)
mock_ctx.assert_called_once_with(user='USER_ID', project='PROJECT_ID') mock_ctx.assert_called_once_with(user_id='USER_ID',
project_id='PROJECT_ID')
mock_rpc.assert_called_once_with(ctx, 'cluster_check', mock.ANY) mock_rpc.assert_called_once_with(ctx, 'cluster_check', mock.ANY)
mock_wait.assert_called_once_with(ctx, "CHECK_ID", 456) mock_wait.assert_called_once_with(ctx, "CHECK_ID", 456)
mock_chase.assert_called_once_with(mock.ANY, 456) mock_chase.assert_called_once_with(mock.ANY, 456)