From fd78129b9fa76c008756f60412b1d066d1c21caf Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Fri, 11 Jan 2013 14:32:41 -0500 Subject: Add service_create to conductor. This patch adds the service_create method to the conductor service. It also updates nova.service to use it. When a service has been marked as not using the db, it will invoke a remote conductor method to create the service record. Part of bp no-db-compute. Change-Id: Ie1f2db96d3134b0e30230565e5c000c416ea73d5 --- nova/tests/conductor/test_conductor.py | 3 +++ nova/tests/test_service.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'nova/tests') diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py index 909174fa9..885788187 100644 --- a/nova/tests/conductor/test_conductor.py +++ b/nova/tests/conductor/test_conductor.py @@ -650,6 +650,9 @@ class ConductorAPITestCase(_BaseTestCase, test.TestCase): def test_service_get_all_compute_by_host(self): self._test_stubbed('service_get_all_compute_by_host', 'host') + def test_service_create(self): + self._test_stubbed('service_create', {}) + def test_ping(self): timeouts = [] calls = dict(count=0) diff --git a/nova/tests/test_service.py b/nova/tests/test_service.py index 0bb57d542..8cc24cb1c 100644 --- a/nova/tests/test_service.py +++ b/nova/tests/test_service.py @@ -113,6 +113,8 @@ class ServiceTestCase(test.TestCase): self.binary = 'nova-fake' self.topic = 'fake' self.mox.StubOutWithMock(service, 'db') + self.mox.StubOutWithMock(db, 'service_create') + self.flags(use_local=True, group='conductor') def test_create(self): @@ -136,7 +138,7 @@ class ServiceTestCase(test.TestCase): service.db.service_get_by_args(mox.IgnoreArg(), self.host, self.binary).AndRaise(exception.NotFound()) - service.db.service_create(mox.IgnoreArg(), + db.service_create(mox.IgnoreArg(), service_create).AndReturn(service_ref) return service_ref -- cgit