From 32c56137b462b6c490165d8c8230c28cc8f7ac7f Mon Sep 17 00:00:00 2001 From: Hans Lindgren Date: Sun, 19 Jul 2015 00:44:45 +0200 Subject: [PATCH] Remove and deprecate conductor compute_node_create() Now that the one and only call to create a compute node record in resource tracker has been converted to objects[1], the old method in conductor can be cleaned out. [1] commit 2ef014eb313396cffb73fc52f5cea6b5a2151da7 Related to blueprint liberty-bump-object-and-rpcapi-versions Change-Id: I6f8043efcc5928d7e42bc32b638bbd4e782a1e2a --- nova/conductor/api.py | 3 --- nova/conductor/manager.py | 1 + nova/conductor/rpcapi.py | 5 +---- nova/tests/unit/conductor/test_conductor.py | 18 +++++++++--------- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/nova/conductor/api.py b/nova/conductor/api.py index c5fa730e4c46..58918f8f6e45 100644 --- a/nova/conductor/api.py +++ b/nova/conductor/api.py @@ -64,9 +64,6 @@ class LocalAPI(object): def provider_fw_rule_get_all(self, context): return self._manager.provider_fw_rule_get_all(context) - def compute_node_create(self, context, values): - return self._manager.compute_node_create(context, values) - def object_backport(self, context, objinst, target_version): return self._manager.object_backport(context, objinst, target_version) diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py index 040829864864..059294c67123 100644 --- a/nova/conductor/manager.py +++ b/nova/conductor/manager.py @@ -327,6 +327,7 @@ class ConductorManager(manager.Manager): def service_destroy(self, context, service_id): self.db.service_destroy(context, service_id) + # NOTE(hanlind): This method can be removed in version 3.0 of the RPC API def compute_node_create(self, context, values): result = self.db.compute_node_create(context, values) return jsonutils.to_primitive(result) diff --git a/nova/conductor/rpcapi.py b/nova/conductor/rpcapi.py index 24703c22bd70..dbf4f18d5c6d 100644 --- a/nova/conductor/rpcapi.py +++ b/nova/conductor/rpcapi.py @@ -187,6 +187,7 @@ class ConductorAPI(object): * 2.2 - Add object_backport_versions() * 2.3 - Add object_class_action_versions() + * Remove compute_node_create() """ VERSION_ALIASES = { @@ -211,10 +212,6 @@ class ConductorAPI(object): cctxt = self.client.prepare() return cctxt.call(context, 'provider_fw_rule_get_all') - def compute_node_create(self, context, values): - cctxt = self.client.prepare() - return cctxt.call(context, 'compute_node_create', values=values) - def object_class_action(self, context, objname, objmethod, objver, args, kwargs): if self.client.can_send_version('2.3'): diff --git a/nova/tests/unit/conductor/test_conductor.py b/nova/tests/unit/conductor/test_conductor.py index e28a30fdb5fb..fc74573efda2 100644 --- a/nova/tests/unit/conductor/test_conductor.py +++ b/nova/tests/unit/conductor/test_conductor.py @@ -102,15 +102,6 @@ class _BaseTestCase(object): result = self.conductor.provider_fw_rule_get_all(self.context) self.assertEqual(result, fake_rules) - def test_compute_node_create(self): - self.mox.StubOutWithMock(db, 'compute_node_create') - db.compute_node_create(self.context, 'fake-values').AndReturn( - 'fake-result') - self.mox.ReplayAll() - result = self.conductor.compute_node_create(self.context, - 'fake-values') - self.assertEqual(result, 'fake-result') - class ConductorTestCase(_BaseTestCase, test.TestCase): """Conductor Manager Tests.""" @@ -802,6 +793,15 @@ class ConductorTestCase(_BaseTestCase, test.TestCase): self.assertEqual('INFO', msg.priority) self.assertEqual('fake-info', msg.payload) + def test_compute_node_create(self): + self.mox.StubOutWithMock(db, 'compute_node_create') + db.compute_node_create(self.context, 'fake-values').AndReturn( + 'fake-result') + self.mox.ReplayAll() + result = self.conductor.compute_node_create(self.context, + 'fake-values') + self.assertEqual(result, 'fake-result') + class ConductorRPCAPITestCase(_BaseTestCase, test.TestCase): """Conductor RPC API Tests."""