Merge "Trivial: Keep consistent in referencing objects in health manager"

This commit is contained in:
Jenkins 2017-02-16 07:48:18 +00:00 committed by Gerrit Code Review
commit 8ade57ef25
2 changed files with 6 additions and 9 deletions

View File

@ -31,8 +31,6 @@ from senlin.common import context
from senlin.common.i18n import _LI, _LW from senlin.common.i18n import _LI, _LW
from senlin.common import messaging as rpc from senlin.common import messaging as rpc
from senlin import objects from senlin import objects
from senlin.objects.requests import actions as vora
from senlin.objects.requests import clusters as vorc
from senlin.rpc import client as rpc_client from senlin.rpc import client as rpc_client
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -214,7 +212,7 @@ class HealthManager(service.Service):
def _wait_for_action(self, ctx, action_id, timeout): def _wait_for_action(self, ctx, action_id, timeout):
done = False done = False
total_sleep = 0 total_sleep = 0
req = vora.ActionGetRequest(identity=action_id) req = objects.ActionGetRequest(identity=action_id)
while total_sleep < timeout: while total_sleep < timeout:
action = self.rpc_client.call(ctx, 'action_get', req) action = self.rpc_client.call(ctx, 'action_get', req)
if action['status'] in ['SUCCEEDED', 'FAILED', 'CANCELLED']: if action['status'] in ['SUCCEEDED', 'FAILED', 'CANCELLED']:
@ -247,7 +245,7 @@ class HealthManager(service.Service):
ctx = context.get_service_context(user=cluster.user, ctx = context.get_service_context(user=cluster.user,
project=cluster.project) project=cluster.project)
try: try:
req = vorc.ClusterCheckRequest(identity=cluster_id) req = objects.ClusterCheckRequest(identity=cluster_id)
action = self.rpc_client.call(ctx, 'cluster_check', req) action = self.rpc_client.call(ctx, 'cluster_check', req)
except Exception as ex: except Exception as ex:
LOG.warning(_LW("Failed in triggering 'cluster_check' RPC for " LOG.warning(_LW("Failed in triggering 'cluster_check' RPC for "

View File

@ -26,7 +26,6 @@ from senlin.objects import cluster as obj_cluster
from senlin.objects import health_registry as hr from senlin.objects import health_registry as hr
from senlin.objects import node as obj_node from senlin.objects import node as obj_node
from senlin.objects import profile as obj_profile from senlin.objects import profile as obj_profile
from senlin.objects.requests import nodes as vorn
from senlin.rpc import client as rpc_client from senlin.rpc import client as rpc_client
from senlin.tests.unit.common import base from senlin.tests.unit.common import base
@ -106,7 +105,7 @@ class TestNovaNotificationEndpoint(base.SenlinTestCase):
self.assertIsNone(res) self.assertIsNone(res)
x_rpc.call.assert_called_once_with(call_ctx, 'node_recover', mock.ANY) x_rpc.call.assert_called_once_with(call_ctx, 'node_recover', mock.ANY)
req = x_rpc.call.call_args[0][2] req = x_rpc.call.call_args[0][2]
self.assertIsInstance(req, vorn.NodeRecoverRequest) self.assertIsInstance(req, objects.NodeRecoverRequest)
self.assertEqual('FAKE_NODE', req.identity) self.assertEqual('FAKE_NODE', req.identity)
expected_params = { expected_params = {
'event': 'DELETE', 'event': 'DELETE',
@ -210,7 +209,7 @@ class TestNovaNotificationEndpoint(base.SenlinTestCase):
self.assertIsNone(res) self.assertIsNone(res)
x_rpc.call.assert_called_once_with(call_ctx, 'node_recover', mock.ANY) x_rpc.call.assert_called_once_with(call_ctx, 'node_recover', mock.ANY)
req = x_rpc.call.call_args[0][2] req = x_rpc.call.call_args[0][2]
self.assertIsInstance(req, vorn.NodeRecoverRequest) self.assertIsInstance(req, objects.NodeRecoverRequest)
self.assertEqual('NODE_ID', req.identity) self.assertEqual('NODE_ID', req.identity)
expected_params = { expected_params = {
'event': 'DELETE', 'event': 'DELETE',
@ -273,7 +272,7 @@ class TestHeatNotificationEndpoint(base.SenlinTestCase):
self.assertIsNone(res) self.assertIsNone(res)
x_rpc.call.assert_called_once_with(call_ctx, 'node_recover', mock.ANY) x_rpc.call.assert_called_once_with(call_ctx, 'node_recover', mock.ANY)
req = x_rpc.call.call_args[0][2] req = x_rpc.call.call_args[0][2]
self.assertIsInstance(req, vorn.NodeRecoverRequest) self.assertIsInstance(req, objects.NodeRecoverRequest)
self.assertEqual('FAKE_NODE', req.identity) self.assertEqual('FAKE_NODE', req.identity)
expected_params = { expected_params = {
'event': 'DELETE', 'event': 'DELETE',
@ -392,7 +391,7 @@ class TestHeatNotificationEndpoint(base.SenlinTestCase):
self.assertIsNone(res) self.assertIsNone(res)
x_rpc.call.assert_called_once_with(call_ctx, 'node_recover', mock.ANY) x_rpc.call.assert_called_once_with(call_ctx, 'node_recover', mock.ANY)
req = x_rpc.call.call_args[0][2] req = x_rpc.call.call_args[0][2]
self.assertIsInstance(req, vorn.NodeRecoverRequest) self.assertIsInstance(req, objects.NodeRecoverRequest)
self.assertEqual('NODE_ID', req.identity) self.assertEqual('NODE_ID', req.identity)
expected_params = { expected_params = {
'event': 'DELETE', 'event': 'DELETE',