FIX-1234 conductor removes the configured_services option

Change-Id: I2a7dc770825b2bbdb7ef3bb625c0d62cd6659d91
This commit is contained in:
Kanagaraj Manickam 2016-03-20 18:40:25 +05:30
parent cc009a8e40
commit 0e4d1db1cc
9 changed files with 52 additions and 43 deletions

View File

@ -10,4 +10,4 @@ rabbit_hosts = 172.241.0.101
connection = mysql+pymysql://root:password@172.241.0.101/namos?charset=utf8
[conductor]
enabled_services=namos
workers=10

View File

@ -24,7 +24,6 @@ eventlet.monkey_patch()
from oslo_config import cfg
from oslo_log import log
import oslo_messaging
from oslo_service import service as os_service
from namos.common import config
@ -42,19 +41,17 @@ def main():
config.init_conf(CMD_NAME)
from namos import conductor # noqa
mgr = service.RPCService(CONF.conductor.host,
config.PROJECT_NAME,
manager.ConductorManager())
enabled_services = CONF.conductor.enabled_services
launcher = os_service.ProcessLauncher(CONF)
for srv in enabled_services.split(','):
LOG.info('Starting conductor for %s', srv)
oslo_messaging.set_transport_defaults(srv)
launcher.launch_service(mgr, CONF.conductor.workers)
mgr = service.RPCService(
CONF.conductor.name,
config.PROJECT_NAME,
manager.ConductorManager())
launcher = os_service.launch(CONF, mgr, CONF.conductor.workers)
# namos.register_myself()
# TODO(mrkanag) Namos is not registering the RPC backend, fix it !
# namos.register_myself()
launcher.wait()

View File

@ -28,13 +28,9 @@ conductor_opts = [
default=1,
help='Number of workers for conductor service. A single '
'conductor is enabled by default.'),
cfg.StrOpt('enabled_services',
default='namos,cinder,nova,keystone,horizon,heat,'
'neutron,glance,swift,trove',
help='List of service exchanges to listen for'),
cfg.StrOpt('host',
cfg.StrOpt('name',
default='namos-dev',
help='conductor host name'),
help='conductor name'),
]

View File

@ -50,8 +50,8 @@ class ConductorManager(object):
# Move this try except to wrpper fn of the db layer
try:
db_api.region_create(context, region)
except Exception as e:
raise exception.NamosException(e)
except: # noqa
raise exception.NamosException()
@request_context
def region_get_all(self, context):
@ -59,8 +59,8 @@ class ConductorManager(object):
@request_context
def register_myself(self, context, registration_info):
LOG.info("REGISTERING %s.%s" % (registration_info['project_name'],
registration_info['prog_name']))
LOG.info("REGISTER [%s.%s] START" % (registration_info['project_name'],
registration_info['prog_name']))
# Service processing
sp = ServiceProcessor(registration_info)
@ -70,6 +70,8 @@ class ConductorManager(object):
dp = DriverProcessor(service_worker_id,
registration_info['config_dict'])
dp.process_drivers(context)
LOG.info("REGISTER [%s.%s] DONE" % (registration_info['project_name'],
registration_info['prog_name']))
return service_worker_id
@ -274,10 +276,17 @@ class DriverProcessor(object):
def process_drivers(self, context):
for driver_key in self._identify_drivers():
drivers = self._get_value(driver_key)
drivers = DriverProcessor._to_list(drivers)
for driver_name in drivers:
self.process_driver(context, driver_key, driver_name)
try:
drivers = self._get_value(driver_key)
drivers = DriverProcessor._to_list(drivers)
for driver_name in drivers:
self.process_driver(context, driver_key, driver_name)
except KeyError: # noqa
# TODO(mrkanag) run namos-manager and restart nova-scheduler
# KeyError: 'libvirt.virt_type' is thrown, fix it
LOG.error('Failed to process driver %s in service worker %s' %
(driver_key, self.service_worker_id))
continue
def process_driver(self, context, driver_key, driver_name):
driver_config = \

View File

@ -105,8 +105,10 @@ if __name__ == '__main__':
from oslo_context import context
c = ConductorAPI()
c.add_region(context.RequestContext(),
{'name': 'RegionOne11',
'keystone_region_id': 'region_one',
'extra': {'location': 'bangalore'},
'id': 'd7dcd175-27ef-46b5-997f-e6e572f320af'})
# c.add_region(context.RequestContext(),
# {'name': 'RegionOne11',
# 'keystone_region_id': 'region_one',
# 'extra': {'location': 'bangalore'},
# 'id': 'd7dcd175-27ef-46b5-997f-e6e572f320af'})
print (json.dumps(c.infra_perspective_get(context.RequestContext())))

View File

@ -56,17 +56,16 @@ _DRIVERS_CONFIG = {
'rpc_backend':{
'rabbit': {
'endpoint': {
'name': 'rabbit_hosts',
'name': 'oslo_messaging_rabbit.rabbit_hosts',
'connection': {
'rabbit_hosts': 'rabbit_hosts',
'rabbit_port': 'rabbit_port',
'rabbit_userid': 'rabbit_userid',
'rabbit_password': 'rabbit_password',
'control_exchange': 'control_exchange'
'oslo_messaging_rabbit.rabbit_hosts': 'oslo_messaging_rabbit.rabbit_hosts',
'oslo_messaging_rabbit.rabbit_port': 'oslo_messaging_rabbit.rabbit_port',
'oslo_messaging_rabbit.rabbit_userid': 'oslo_messaging_rabbit.rabbit_userid',
'oslo_messaging_rabbit.rabbit_password': 'oslo_messaging_rabbit.rabbit_password',
}
},
'device': {
'name': ['RPC_%s', (_get_rpc_name, 'control_exchange')]
'name': ['RPC_%s', (_get_rpc_name, 'oslo_messaging_rabbit.rabbit_hosts')]
}
},
'nova.openstack.common.rpc.impl_kombu': {
@ -183,6 +182,9 @@ _DRIVERS_CONFIG = {
'name': ['%s@%s', 'volume_group', 'host']
}
},
'cinder.volume.drivers.lvm.LVMVolumeDriver': {
'alias': 'volume_driver:cinder.volume.drivers.lvm.LVMISCSIDriver'
},
'cinder.volume.drivers.lvm.LVMISERDriver': {
'alias': 'volume_driver:cinder.volume.drivers.lvm.LVMISCSIDriver'
},
@ -730,7 +732,10 @@ _DRIVERS_CONFIG = {
'device': {
'name': ['OVS bridge %s', 'ovs_integration_bridge']
}
}
},
'openvswitch': {
'alias': 'interface_driver:neutron.agent.linux.interface.OVSInterfaceDriver'
},
},
# 'extension_drivers': {
#
@ -1418,7 +1423,7 @@ _DRIVERS = {
'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver': {
'type': 'neutron'
},
'nova.virt.firewall.NoopFirewallDriver' : {
'nova.virt.firewall.NoopFirewallDriver': {
'type': 'neutron'
},
'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver': {

View File

@ -441,4 +441,4 @@ def _region_purge_demo_data():
def purge_demo_data():
_service_purge_demo_data()
_device_purge_demo_data()
_region_purge_demo_data()
# _region_purge_demo_data()

View File

@ -50,7 +50,7 @@ def upgrade():
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('deleted_at', sa.DateTime(), nullable=True),
sa.Column('extra', sa.Json(), nullable=True),
sa.Column('python_class', sa.String(length=64), nullable=False),
sa.Column('python_class', sa.String(length=256), nullable=False),
sa.Column('version', sa.String(length=64), nullable=True),
sa.Column('type', sa.String(length=64), nullable=False),
sa.PrimaryKeyConstraint('id'),

View File

@ -178,7 +178,7 @@ class DeviceDriverClass(BASE,
# TODO(kanagaraj-manickam) Correct the max python class path here
python_class = sqlalchemy.Column(
sqlalchemy.String(64),
sqlalchemy.String(256),
nullable=False
)
# service type like compute, network, volume, etc