def get_packages(): """Return a list of packages for install based on the configured plugin""" plugin = remap_plugin(config("plugin")) packages = deepcopy(GATEWAY_PKGS[networking_name()][plugin]) source = get_os_codename_install_source(config("openstack-origin")) if plugin == "ovs": if source >= "icehouse" and lsb_release()["DISTRIB_CODENAME"] < "utopic": # NOTE(jamespage) neutron-vpn-agent supercedes l3-agent for # icehouse but openswan was removed in utopic. packages.remove("neutron-l3-agent") packages.append("neutron-vpn-agent") packages.append("openswan") if source >= "kilo": packages.append("python-neutron-fwaas") if source >= "liberty": # Switch out mysql driver packages.remove("python-mysqldb") packages.append("python-pymysql") # Switch out to actual metering agent package packages.remove("neutron-plugin-metering-agent") packages.append("neutron-metering-agent") packages.extend(determine_l3ha_packages()) if git_install_requested(): packages = list(set(packages)) packages.extend(BASE_GIT_PACKAGES) # don't include packages that will be installed from git for p in GIT_PACKAGE_BLACKLIST: if p in packages: packages.remove(p) return packages
def register_configs(): ''' Register config files with their respective contexts. ''' release = get_os_codename_install_source(config('openstack-origin')) configs = templating.OSConfigRenderer(templates_dir=TEMPLATES, openstack_release=release) plugin = remap_plugin(config('plugin')) name = networking_name() if plugin == 'ovs': # NOTE: deal with switch to ML2 plugin for >= icehouse drop_config = NEUTRON_ML2_PLUGIN_CONF if release >= 'icehouse': drop_config = NEUTRON_OVS_PLUGIN_CONF if drop_config in CONFIG_FILES[name][plugin]: CONFIG_FILES[name][plugin].pop(drop_config) if is_relation_made('amqp-nova'): amqp_nova_ctxt = context.AMQPContext( ssl_dir=NOVA_CONF_DIR, rel_name='amqp-nova', relation_prefix='nova') else: amqp_nova_ctxt = context.AMQPContext( ssl_dir=NOVA_CONF_DIR, rel_name='amqp') CONFIG_FILES[name][plugin][NOVA_CONF][ 'hook_contexts'].append(amqp_nova_ctxt) for conf in CONFIG_FILES[name][plugin]: configs.register(conf, CONFIG_FILES[name][plugin][conf]['hook_contexts']) return configs
def get_packages(): '''Return a list of packages for install based on the configured plugin''' plugin = remap_plugin(config('plugin')) packages = deepcopy(GATEWAY_PKGS[networking_name()][plugin]) source = get_os_codename_install_source(config('openstack-origin')) if plugin == 'ovs': if (source >= 'icehouse' and lsb_release()['DISTRIB_CODENAME'] < 'utopic'): # NOTE(jamespage) neutron-vpn-agent supercedes l3-agent for # icehouse but openswan was removed in utopic. packages.remove('neutron-l3-agent') packages.append('neutron-vpn-agent') packages.append('openswan') if source >= 'kilo': packages.append('python-neutron-fwaas') if source >= 'liberty': # Switch out mysql driver packages.remove('python-mysqldb') packages.append('python-pymysql') # Switch out to actual metering agent package packages.remove('neutron-plugin-metering-agent') packages.append('neutron-metering-agent') packages.extend(determine_l3ha_packages()) if git_install_requested(): packages = list(set(packages)) packages.extend(BASE_GIT_PACKAGES) # don't include packages that will be installed from git for p in GIT_PACKAGE_BLACKLIST: if p in packages: packages.remove(p) return packages
def stop_services(): name = networking_name() svcs = set() for ctxt in CONFIG_FILES[name][config("plugin")].itervalues(): for svc in ctxt["services"]: svcs.add(svc) for svc in svcs: service_stop(svc)
def stop_services(): name = networking_name() svcs = set() for ctxt in CONFIG_FILES[name][config('plugin')].itervalues(): for svc in ctxt['services']: svcs.add(svc) for svc in svcs: service_stop(svc)
def restart_map(): """ Determine the correct resource map to be passed to charmhelpers.core.restart_on_change() based on the services configured. :returns: dict: A dictionary mapping config file to lists of services that should be restarted when file changes. """ _map = {} plugin = config("plugin") name = networking_name() for f, ctxt in CONFIG_FILES[name][plugin].iteritems(): svcs = [] for svc in ctxt["services"]: svcs.append(svc) if svcs: _map[f] = svcs return _map
def restart_map(): ''' Determine the correct resource map to be passed to charmhelpers.core.restart_on_change() based on the services configured. :returns: dict: A dictionary mapping config file to lists of services that should be restarted when file changes. ''' _map = {} plugin = config('plugin') name = networking_name() for f, ctxt in CONFIG_FILES[name][plugin].iteritems(): svcs = [] for svc in ctxt['services']: svcs.append(svc) if svcs: _map[f] = svcs return _map
def register_configs(): """ Register config files with their respective contexts. """ release = get_os_codename_install_source(config("openstack-origin")) configs = templating.OSConfigRenderer(templates_dir=TEMPLATES, openstack_release=release) plugin = remap_plugin(config("plugin")) name = networking_name() if plugin == "ovs": # NOTE: deal with switch to ML2 plugin for >= icehouse drop_config = NEUTRON_ML2_PLUGIN_CONF if release >= "icehouse": drop_config = NEUTRON_OVS_PLUGIN_CONF if drop_config in CONFIG_FILES[name][plugin]: CONFIG_FILES[name][plugin].pop(drop_config) if is_relation_made("amqp-nova"): amqp_nova_ctxt = context.AMQPContext(ssl_dir=NOVA_CONF_DIR, rel_name="amqp-nova", relation_prefix="nova") else: amqp_nova_ctxt = context.AMQPContext(ssl_dir=NOVA_CONF_DIR, rel_name="amqp") CONFIG_FILES[name][plugin][NOVA_CONF]["hook_contexts"].append(amqp_nova_ctxt) for conf in CONFIG_FILES[name][plugin]: configs.register(conf, CONFIG_FILES[name][plugin][conf]["hook_contexts"]) return configs
def valid_plugin(): return config("plugin") in CORE_PLUGIN[networking_name()]
def test_ge_havana(self): self.get_os_codename_install_source.return_value = 'havana' self.assertEquals(neutron_contexts.networking_name(), 'neutron')
def test_lt_havana(self): self.get_os_codename_install_source.return_value = 'folsom' self.assertEquals(neutron_contexts.networking_name(), 'quantum')
def valid_plugin(): return config('plugin') in CORE_PLUGIN[networking_name()]