This commit is contained in:
Endre Karlson 2012-11-14 14:28:31 +01:00
parent 10c2c8de78
commit 637dd90812
10 changed files with 23 additions and 16 deletions

View File

@ -31,6 +31,7 @@ cfg.CONF.register_opts([
cfg.StrOpt('central-topic',
default='bufunfa.central',
help='Central Topic'),
cfg.StrOpt('worker-topic', default='bufunfa.recorder', help='Worker Topic'),
cfg.StrOpt('worker-topic', default='bufunfa.recorder',
help='Worker Topic'),
cfg.StrOpt('state-path', default='$pybasedir', help='State Path')
])

View File

@ -58,7 +58,8 @@ class RecordEngine(OpenstackEngine):
start_timestamp = self.get_poll_start(project_id)
project_records = self.get_project_records_between(project_id,
project_records = self.get_project_records_between(
project_id,
start_timestamp=start_timestamp)
central_api.process_records(self.admin_context, project_records)
@ -71,7 +72,9 @@ class RecordEngine(OpenstackEngine):
:param project_id: The project ID
"""
try:
account = central_api.get_system_account(self.admin_context, project_id)
account = central_api.get_system_account(
self.admin_context,
project_id)
except RemoteError:
return
# NOTE: The time sent over RPC is text.

View File

@ -37,6 +37,7 @@ class PeriodicService(rpc_service.Service):
def start(self):
super(PeriodicService, self).start()
admin_context = context.RequestContext('admin', 'admin', is_admin=True)
self.tg.add_timer(cfg.CONF.periodic_interval,
self.tg.add_timer(
cfg.CONF.periodic_interval,
self.manager.periodic_tasks,
context=admin_context)

View File

@ -90,9 +90,11 @@ class ServiceTest(CentralTestCase):
"""
account_id = str(self.add_system_account()['id'])
now = datetime.now()
self.service.set_polled_at(self.admin_context, account_id, timeutils.strtime(now))
self.service.set_polled_at(self.admin_context, account_id,
timeutils.strtime(now))
account = self.service.get_system_account(self.admin_context, account_id)
account = self.service.get_system_account(self.admin_context,
account_id)
self.assertEquals(account["polled_at"], now)
def test_set_polled_at_too_old(self):

View File

@ -122,13 +122,15 @@ class StorageDriverTestCase(StorageTestCase):
def test_add_system_account(self):
account = self.add_system_account_fixture()
self.assertEquals(account.name, self.system_account_fixtures[0]['name'])
self.assertEquals(account.name,
self.system_account_fixtures[0]['name'])
def test_delete_system_account(self):
account = self.add_system_account_fixture()
self.storage_conn.delete_system_account(self.admin_context, account.id)
with self.assertRaises(exceptions.NotFound):
self.storage_conn.get_system_account(self.admin_context, account.id)
self.storage_conn.get_system_account(self.admin_context,
account.id)
def test_update_system_account(self):
account = self.add_system_account_fixture()

View File

@ -25,4 +25,3 @@ class TestEngineName(TestCase):
def test_engine_dialacted(self):
name = get_engine_name("mysql+oursql")
self.assertEqual(name, "mysql")

View File

@ -17,4 +17,3 @@ from bufunfa.openstack.common import version as common_version
PRE_VERSION = '2013.1'
version_info = common_version.VersionInfo('bufunfa', pre_version=PRE_VERSION)