**** CubicPower OpenStack Study ****
def scrub_class_path(cls_path):
"""Scrub from Quantum from old class_path references."""
if isinstance(cls_path, basestring):
if cls_path.startswith('quantum'):
new_path = cls_path.replace('quantum', 'neutron')
new_path = new_path.replace('Quantum', 'Neutron')
LOG.warn(
_("Old class module path in use. Please change '%(old)s' "
"to '%(new)s'."),
{'old': cls_path, 'new': new_path}
)
cls_path = new_path
return cls_path
**** CubicPower OpenStack Study ****
def override_config(config, config_keys=None):
"""Attempt to override config_key with Neutron compatible values."""
for key in config_keys:
group = None
if not isinstance(key, basestring):
try:
group, key, module_str = key
old_value = getattr(getattr(config, group), key, None)
except AttributeError:
try:
config.import_opt(key, module_str, group)
old_value = getattr(getattr(config, group), key, None)
except (cfg.NoSuchOptError,
cfg.NoSuchGroupError,
AttributeError):
LOG.warn(_('Key %(key)s in group %(group)s is unknown. '
'It may not be defined or needed by this '
'service.') % {'key': key, 'group': group})
continue
else:
old_value = getattr(config, key, None)
if not old_value:
continue
elif isinstance(old_value, list):
new_value = [scrub_class_path(v) for v in old_value]
else:
new_value = scrub_class_path(old_value)
if new_value != old_value:
config.set_override(key, new_value, group=group)
**** CubicPower OpenStack Study ****
def modernize_quantum_config(config):
"""Updates keys from old Quantum configurations for Neutron."""
config_keys = [
'allowed_rpc_exception_modules',
'core_plugin',
'device_driver',
'dhcp_driver',
'driver_fqn',
'interface_driver',
'network_scheduler_driver',
'notification_driver',
'router_scheduler_driver',
'rpc_backend',
'service_plugins',
('SECURITYGROUP',
'firewall_driver',
'neutron.agent.securitygroups_rpc'),
]
override_config(config, config_keys)