Fix 'spacing' parameters for periodic tasks

conductor.manager module contains 'spacing' parameters for periodic
tasks, they do not work because manager module imported before
parsing config options.
There is not such problem in Nova which uses create() method in class
derived from common Service for lazy loading manager module.
Because this derived class not needed for Ironic simple load_manager
function added to common.service.

Partial-Bug: #1279774
Change-Id: Ib31024c8eaf75d38de09983459d86125847cdf30
This commit is contained in:
Yuriy Zveryanskyy 2014-03-19 15:18:27 +02:00
parent 021c6bd634
commit 93b042c0be
2 changed files with 10 additions and 2 deletions

View File

@ -26,7 +26,6 @@ from oslo.config import cfg
from ironic.openstack.common import service
from ironic.common import service as ironic_service
from ironic.conductor import manager
CONF = cfg.CONF
@ -35,6 +34,8 @@ def main():
# Pase config file and command line options, then start logging
ironic_service.prepare_service(sys.argv)
mgr = manager.ConductorManager(CONF.host, manager.MANAGER_TOPIC)
mgr = ironic_service.load_manager('ironic.conductor.manager',
'ConductorManager',
CONF.host)
launcher = service.launch(mgr)
launcher.wait()

View File

@ -21,6 +21,7 @@ import socket
from oslo.config import cfg
from ironic.openstack.common import context
from ironic.openstack.common import importutils
from ironic.openstack.common import log
from ironic.openstack.common import periodic_task
from ironic.openstack.common import rpc
@ -67,3 +68,9 @@ def prepare_service(argv=[]):
])
cfg.CONF(argv[1:], project='ironic')
log.setup('ironic')
def load_manager(manager_modulename, manager_classname, host):
manager_module = importutils.import_module(manager_modulename)
manager_class = getattr(manager_module, manager_classname)
return manager_class(host, manager_module.MANAGER_TOPIC)