diff options
-rw-r--r-- | nova/conductor/api.py | 11 | ||||
-rw-r--r-- | nova/conductor/manager.py | 2 | ||||
-rw-r--r-- | nova/conductor/rpcapi.py | 5 | ||||
-rw-r--r-- | nova/tests/conductor/test_conductor.py | 12 |
4 files changed, 10 insertions, 20 deletions
diff --git a/nova/conductor/api.py b/nova/conductor/api.py index eacc215ee..bf2a66860 100644 --- a/nova/conductor/api.py +++ b/nova/conductor/api.py @@ -16,6 +16,7 @@ from oslo.config import cfg +from nova import baserpc from nova.conductor import manager from nova.conductor import rpcapi from nova import exception as exc @@ -56,9 +57,6 @@ class LocalAPI(object): # nothing to wait for in the local case. pass - def ping(self, context, arg, timeout=None): - return self._manager.ping(context, arg) - def instance_update(self, context, instance_uuid, **updates): """Perform an instance update in the database.""" return self._manager.instance_update(context, instance_uuid, @@ -355,6 +353,7 @@ class API(object): def __init__(self): self.conductor_rpcapi = rpcapi.ConductorAPI() + self.base_rpcapi = baserpc.BaseAPI(topic=CONF.conductor.topic) def wait_until_ready(self, context, early_timeout=10, early_attempts=10): '''Wait until a conductor service is up and running. @@ -378,16 +377,14 @@ class API(object): # This may fail the first time around if nova-conductor wasn't # running when this service started. try: - self.ping(context, '1.21 GigaWatts', timeout=timeout) + self.base_rpcapi.ping(context, '1.21 GigaWatts', + timeout=timeout) break except rpc_common.Timeout as e: LOG.warning(_('Timed out waiting for nova-conductor. ' 'Is it running? Or did this service start ' 'before nova-conductor?')) - def ping(self, context, arg, timeout=None): - return self.conductor_rpcapi.ping(context, arg, timeout) - def instance_update(self, context, instance_uuid, **updates): """Perform an instance update in the database.""" return self.conductor_rpcapi.instance_update(context, instance_uuid, diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py index 3713b1de9..2d027a8f2 100644 --- a/nova/conductor/manager.py +++ b/nova/conductor/manager.py @@ -76,6 +76,8 @@ class ConductorManager(manager.Manager): return self._compute_api def ping(self, context, arg): + # NOTE(russellb) This method can be removed in 2.0 of this API. It is + # now a part of the base rpc API. return jsonutils.to_primitive({'service': 'conductor', 'arg': arg}) @rpc_common.client_exceptions(KeyError, ValueError, diff --git a/nova/conductor/rpcapi.py b/nova/conductor/rpcapi.py index 437bbfb81..6bd4be59b 100644 --- a/nova/conductor/rpcapi.py +++ b/nova/conductor/rpcapi.py @@ -97,11 +97,6 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy): topic=CONF.conductor.topic, default_version=self.BASE_RPC_API_VERSION) - def ping(self, context, arg, timeout=None): - arg_p = jsonutils.to_primitive(arg) - msg = self.make_msg('ping', arg=arg_p) - return self.call(context, msg, version='1.22', timeout=timeout) - def instance_update(self, context, instance_uuid, updates, service=None): updates_p = jsonutils.to_primitive(updates) diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py index fee919a33..73bdf5d71 100644 --- a/nova/tests/conductor/test_conductor.py +++ b/nova/tests/conductor/test_conductor.py @@ -410,10 +410,6 @@ class _BaseTestCase(object): 'user_id': 'fake-user_id'}, 'fake-refr', 'fake-bool') - def test_ping(self): - result = self.conductor.ping(self.context, 'foo') - self.assertEqual(result, {'service': 'conductor', 'arg': 'foo'}) - def test_compute_node_create(self): self.mox.StubOutWithMock(db, 'compute_node_create') db.compute_node_create(self.context, 'fake-values').AndReturn( @@ -1073,17 +1069,17 @@ class ConductorAPITestCase(_BaseTestCase, test.TestCase): 'host') self.assertEqual(result, 'fake-result') - def test_ping(self): + def test_wait_until_ready(self): timeouts = [] calls = dict(count=0) - def fake_ping(_self, context, message, timeout): + def fake_ping(context, message, timeout): timeouts.append(timeout) calls['count'] += 1 if calls['count'] < 15: raise rpc_common.Timeout("fake") - self.stubs.Set(conductor_api.API, 'ping', fake_ping) + self.stubs.Set(self.conductor.base_rpcapi, 'ping', fake_ping) self.conductor.wait_until_ready(self.context) @@ -1117,7 +1113,7 @@ class ConductorLocalAPITestCase(ConductorAPITestCase): self.assertRaises(KeyError, self._do_update, instance['uuid'], foo='bar') - def test_ping(self): + def test_wait_until_ready(self): # Override test in ConductorAPITestCase pass |