Browse Source

FIX-1234 conductor removes the configured_services option

Change-Id: I2a7dc770825b2bbdb7ef3bb625c0d62cd6659d91
Kanagaraj Manickam 3 years ago
parent
commit
0e4d1db1cc

+ 1
- 1
etc/namos.conf View File

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

+ 8
- 11
namos/cmd/conductor.py View File

@@ -24,7 +24,6 @@ eventlet.monkey_patch()
24 24
 
25 25
 from oslo_config import cfg
26 26
 from oslo_log import log
27
-import oslo_messaging
28 27
 from oslo_service import service as os_service
29 28
 
30 29
 from namos.common import config
@@ -42,19 +41,17 @@ def main():
42 41
     config.init_conf(CMD_NAME)
43 42
 
44 43
     from namos import conductor  # noqa
45
-    mgr = service.RPCService(CONF.conductor.host,
46
-                             config.PROJECT_NAME,
47
-                             manager.ConductorManager())
48
-    enabled_services = CONF.conductor.enabled_services
49 44
 
50
-    launcher = os_service.ProcessLauncher(CONF)
51
-    for srv in enabled_services.split(','):
52
-        LOG.info('Starting conductor for %s', srv)
53
-        oslo_messaging.set_transport_defaults(srv)
54
-        launcher.launch_service(mgr, CONF.conductor.workers)
45
+    mgr = service.RPCService(
46
+        CONF.conductor.name,
47
+        config.PROJECT_NAME,
48
+        manager.ConductorManager())
49
+
50
+    launcher = os_service.launch(CONF, mgr, CONF.conductor.workers)
55 51
 
56
-    # namos.register_myself()
57 52
     # TODO(mrkanag) Namos is not registering the RPC backend, fix it !
53
+    # namos.register_myself()
54
+
58 55
     launcher.wait()
59 56
 
60 57
 

+ 2
- 6
namos/common/config.py View File

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

+ 17
- 8
namos/conductor/manager.py View File

@@ -50,8 +50,8 @@ class ConductorManager(object):
50 50
         # Move this try except to wrpper fn of the db layer
51 51
         try:
52 52
             db_api.region_create(context, region)
53
-        except Exception as e:
54
-            raise exception.NamosException(e)
53
+        except:  # noqa
54
+            raise exception.NamosException()
55 55
 
56 56
     @request_context
57 57
     def region_get_all(self, context):
@@ -59,8 +59,8 @@ class ConductorManager(object):
59 59
 
60 60
     @request_context
61 61
     def register_myself(self, context, registration_info):
62
-        LOG.info("REGISTERING %s.%s" % (registration_info['project_name'],
63
-                                        registration_info['prog_name']))
62
+        LOG.info("REGISTER [%s.%s] START" % (registration_info['project_name'],
63
+                                             registration_info['prog_name']))
64 64
 
65 65
         # Service processing
66 66
         sp = ServiceProcessor(registration_info)
@@ -70,6 +70,8 @@ class ConductorManager(object):
70 70
         dp = DriverProcessor(service_worker_id,
71 71
                              registration_info['config_dict'])
72 72
         dp.process_drivers(context)
73
+        LOG.info("REGISTER [%s.%s] DONE" % (registration_info['project_name'],
74
+                                            registration_info['prog_name']))
73 75
 
74 76
         return service_worker_id
75 77
 
@@ -274,10 +276,17 @@ class DriverProcessor(object):
274 276
 
275 277
     def process_drivers(self, context):
276 278
         for driver_key in self._identify_drivers():
277
-            drivers = self._get_value(driver_key)
278
-            drivers = DriverProcessor._to_list(drivers)
279
-            for driver_name in drivers:
280
-                self.process_driver(context, driver_key, driver_name)
279
+            try:
280
+                drivers = self._get_value(driver_key)
281
+                drivers = DriverProcessor._to_list(drivers)
282
+                for driver_name in drivers:
283
+                    self.process_driver(context, driver_key, driver_name)
284
+            except KeyError:  # noqa
285
+                # TODO(mrkanag) run namos-manager and restart nova-scheduler
286
+                # KeyError: 'libvirt.virt_type' is thrown, fix it
287
+                LOG.error('Failed to process driver %s in service worker %s' %
288
+                          (driver_key, self.service_worker_id))
289
+                continue
281 290
 
282 291
     def process_driver(self, context, driver_key, driver_name):
283 292
             driver_config = \

+ 7
- 5
namos/conductor/rpcapi.py View File

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

+ 14
- 9
namos/db/openstack_drivers.py View File

@@ -56,17 +56,16 @@ _DRIVERS_CONFIG = {
56 56
     'rpc_backend':{
57 57
         'rabbit': {
58 58
             'endpoint': {
59
-                'name': 'rabbit_hosts',
59
+                'name': 'oslo_messaging_rabbit.rabbit_hosts',
60 60
                 'connection': {
61
-                    'rabbit_hosts': 'rabbit_hosts',
62
-                    'rabbit_port': 'rabbit_port',
63
-                    'rabbit_userid': 'rabbit_userid',
64
-                    'rabbit_password': 'rabbit_password',
65
-                    'control_exchange': 'control_exchange'
61
+                    'oslo_messaging_rabbit.rabbit_hosts': 'oslo_messaging_rabbit.rabbit_hosts',
62
+                    'oslo_messaging_rabbit.rabbit_port': 'oslo_messaging_rabbit.rabbit_port',
63
+                    'oslo_messaging_rabbit.rabbit_userid': 'oslo_messaging_rabbit.rabbit_userid',
64
+                    'oslo_messaging_rabbit.rabbit_password': 'oslo_messaging_rabbit.rabbit_password',
66 65
                 }
67 66
             },
68 67
             'device': {
69
-                'name': ['RPC_%s', (_get_rpc_name, 'control_exchange')]
68
+                'name': ['RPC_%s', (_get_rpc_name, 'oslo_messaging_rabbit.rabbit_hosts')]
70 69
             }
71 70
         },
72 71
         'nova.openstack.common.rpc.impl_kombu': {
@@ -183,6 +182,9 @@ _DRIVERS_CONFIG = {
183 182
                 'name': ['%s@%s', 'volume_group', 'host']
184 183
             }
185 184
         },
185
+        'cinder.volume.drivers.lvm.LVMVolumeDriver': {
186
+            'alias': 'volume_driver:cinder.volume.drivers.lvm.LVMISCSIDriver'
187
+        },
186 188
         'cinder.volume.drivers.lvm.LVMISERDriver': {
187 189
             'alias': 'volume_driver:cinder.volume.drivers.lvm.LVMISCSIDriver'
188 190
         },
@@ -730,7 +732,10 @@ _DRIVERS_CONFIG = {
730 732
             'device': {
731 733
                 'name': ['OVS bridge %s', 'ovs_integration_bridge']
732 734
             }
733
-        }
735
+        },
736
+        'openvswitch': {
737
+            'alias': 'interface_driver:neutron.agent.linux.interface.OVSInterfaceDriver'
738
+        },
734 739
     },
735 740
     # 'extension_drivers': {
736 741
     #
@@ -1418,7 +1423,7 @@ _DRIVERS = {
1418 1423
     'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver': {
1419 1424
         'type': 'neutron'
1420 1425
     },
1421
-    'nova.virt.firewall.NoopFirewallDriver' : {
1426
+    'nova.virt.firewall.NoopFirewallDriver': {
1422 1427
         'type': 'neutron'
1423 1428
     },
1424 1429
     'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver': {

+ 1
- 1
namos/db/sample.py View File

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

+ 1
- 1
namos/db/sqlalchemy/alembic/versions/48ebec3cd6f6_initial_version.py View File

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

+ 1
- 1
namos/db/sqlalchemy/models.py View File

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

Loading…
Cancel
Save