diff options
author | Dan Smith <danms@us.ibm.com> | 2013-01-15 13:25:58 -0500 |
---|---|---|
committer | Dan Smith <danms@us.ibm.com> | 2013-01-16 14:50:51 -0500 |
commit | 99cb17da8142985cbca7c7445ec0b77ccfdbe7ad (patch) | |
tree | 7230b19b36f3727d27552befe9ee2beed15f2f24 /nova/tests/conductor | |
parent | 01f204efdf4cee1823475fd346ce6dbaca915715 (diff) | |
download | nova-99cb17da8142985cbca7c7445ec0b77ccfdbe7ad.tar.gz nova-99cb17da8142985cbca7c7445ec0b77ccfdbe7ad.tar.xz nova-99cb17da8142985cbca7c7445ec0b77ccfdbe7ad.zip |
Move compute node operations to conductor
This adds the following operations to conductor:
compute_node_create()
compute_node_update()
It also makes resource_tracker use them instead of making direct
calls to the database.
Further, it introduces a convert_datetimes() helper to the db api,
which can be used internally to convert ISO time strings back to
datetimes, so that we're getting them over the RPC wire. This
should be used in other places in the future to fix similar
situations and avoid one-off conversions in random places.
This removes the last direct database call from resource tracker,
and thus the db import.
Related to blueprint no-db-compute
Change-Id: I49c0bb30e7dd46d6f68550ebb644381961a0867f
Diffstat (limited to 'nova/tests/conductor')
-rw-r--r-- | nova/tests/conductor/test_conductor.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py index 9f6940607..b29db92e7 100644 --- a/nova/tests/conductor/test_conductor.py +++ b/nova/tests/conductor/test_conductor.py @@ -398,6 +398,25 @@ class _BaseTestCase(object): 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( + 'fake-result') + self.mox.ReplayAll() + result = self.conductor.compute_node_create(self.context, + 'fake-values') + self.assertEqual(result, 'fake-result') + + def test_compute_node_update(self): + node = {'id': 'fake-id'} + self.mox.StubOutWithMock(db, 'compute_node_update') + db.compute_node_update(self.context, node['id'], 'fake-values', + False).AndReturn('fake-result') + self.mox.ReplayAll() + result = self.conductor.compute_node_update(self.context, node, + 'fake-values', False) + self.assertEqual(result, 'fake-result') + class ConductorTestCase(_BaseTestCase, test.TestCase): """Conductor Manager Tests.""" |