From ba2a0565a6451ee3227b6e11bbdd8ea75cbf1fc3 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Fri, 4 Jan 2013 09:01:29 -0800 Subject: Move vol_usage methods to conductor This patch moves the compute/manager's use of the following methods to conductor: - vol_usage_update() - vol_get_usage_by_time() Related to blueprint no-db-compute-manager Change-Id: I51a30d66be51eb532cb19c8b06b87ad07387dd54 --- nova/tests/conductor/test_conductor.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'nova/tests') diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py index 454d5347a..d2c3df19a 100644 --- a/nova/tests/conductor/test_conductor.py +++ b/nova/tests/conductor/test_conductor.py @@ -308,6 +308,26 @@ class _BaseTestCase(object): result = self.conductor.instance_type_get(self.context, 'fake-id') self.assertEqual(result, 'fake-type') + def test_vol_get_usage_by_time(self): + self.mox.StubOutWithMock(db, 'vol_get_usage_by_time') + db.vol_get_usage_by_time(self.context, 'fake-time').AndReturn( + 'fake-usage') + self.mox.ReplayAll() + result = self.conductor.vol_get_usage_by_time(self.context, + 'fake-time') + self.assertEqual(result, 'fake-usage') + + def test_vol_usage_update(self): + self.mox.StubOutWithMock(db, 'vol_usage_update') + db.vol_usage_update(self.context, 'fake-vol', 'rd-req', 'rd-bytes', + 'wr-req', 'wr-bytes', 'fake-id', 'fake-refr', + 'fake-bool') + self.mox.ReplayAll() + self.conductor.vol_usage_update(self.context, 'fake-vol', 'rd-req', + 'rd-bytes', 'wr-req', 'wr-bytes', + {'uuid': 'fake-id'}, 'fake-refr', + 'fake-bool') + class ConductorTestCase(_BaseTestCase, test.TestCase): """Conductor Manager Tests""" -- cgit