def neutron_plugins(): from charmhelpers.contrib.openstack import context release = os_release('nova-common') plugins = { 'ovs': { 'config': '/etc/neutron/plugins/openvswitch/' 'ovs_neutron_plugin.ini', 'driver': 'neutron.plugins.openvswitch.ovs_neutron_plugin.' 'OVSNeutronPluginV2', 'contexts': [ context.SharedDBContext(user=config('neutron-database-user'), database=config('neutron-database'), relation_prefix='neutron', ssl_dir=NEUTRON_CONF_DIR)], 'services': ['neutron-plugin-openvswitch-agent'], 'packages': [[headers_package()] + determine_dkms_package(), ['neutron-plugin-openvswitch-agent']], 'server_packages': ['neutron-server', 'neutron-plugin-openvswitch'], 'server_services': ['neutron-server'] }, 'nvp': { 'config': '/etc/neutron/plugins/nicira/nvp.ini', 'driver': 'neutron.plugins.nicira.nicira_nvp_plugin.' 'NeutronPlugin.NvpPluginV2', 'contexts': [ context.SharedDBContext(user=config('neutron-database-user'), database=config('neutron-database'), relation_prefix='neutron', ssl_dir=NEUTRON_CONF_DIR)], 'services': [], 'packages': [], 'server_packages': ['neutron-server', 'neutron-plugin-nicira'], 'server_services': ['neutron-server'] }, 'nsx': { 'config': '/etc/neutron/plugins/vmware/nsx.ini', 'driver': 'vmware', 'contexts': [ context.SharedDBContext(user=config('neutron-database-user'), database=config('neutron-database'), relation_prefix='neutron', ssl_dir=NEUTRON_CONF_DIR)], 'services': [], 'packages': [], 'server_packages': ['neutron-server', 'neutron-plugin-vmware'], 'server_services': ['neutron-server'] } } if release >= 'icehouse': # NOTE: patch in ml2 plugin for icehouse onwards plugins['ovs']['config'] = '/etc/neutron/plugins/ml2/ml2_conf.ini' plugins['ovs']['driver'] = 'neutron.plugins.ml2.plugin.Ml2Plugin' plugins['ovs']['server_packages'] = ['neutron-server', 'neutron-plugin-ml2'] # NOTE: patch in vmware renames nvp->nsx for icehouse onwards plugins['nvp'] = plugins['nsx'] return plugins
def get_db_url(): ''' Retrieve the Database URL for the Neutron DB :returns: oslo.db formatted connection string for the DB :rtype: str ''' ctxt = context.SharedDBContext( user=config('database-user'), database=config('database'), ssl_dir=NEUTRON_CONF_DIR)() # NOTE: core database url database_url = ( "{database_type}://" "{database_user}:{database_password}@" "{database_host}/{database}".format(**ctxt) ) # NOTE: optional SSL configuration if ctxt.get('database_ssl_ca'): ssl_args = [ 'ssl_ca={}'.format(ctxt['database_ssl_ca']) ] if ctxt.get('database_ssl_cert'): ssl_args.append('ssl_cert={}'.format(ctxt['database_ssl_cert'])) ssl_args.append('ssl_key={}'.format(ctxt['database_ssl_key'])) database_url = "{}?{}".format( database_url, "&".join(ssl_args) ) return database_url
def register_configs(): ''' Register config files with their respective contexts. ''' release = os_release('openstack-dashboard') configs = templating.OSConfigRenderer(templates_dir=TEMPLATES, openstack_release=release) confs = [LOCAL_SETTINGS, HAPROXY_CONF, PORTS_CONF] if CompareOpenStackReleases(release) >= 'mitaka': configs.register(KEYSTONEV3_POLICY, CONFIG_FILES[KEYSTONEV3_POLICY]['hook_contexts']) CONFIG_FILES[LOCAL_SETTINGS]['hook_contexts'].append( context.SharedDBContext( user=config('database-user'), database=config('database'), ssl_dir=DASHBOARD_CONF_DIR)) for conf in confs: configs.register(conf, CONFIG_FILES[conf]['hook_contexts']) # From Trusty on use Apache 2.4 configs.register(APACHE_24_DEFAULT, CONFIG_FILES[APACHE_24_DEFAULT]['hook_contexts']) configs.register(APACHE_24_CONF, CONFIG_FILES[APACHE_24_CONF]['hook_contexts']) configs.register(APACHE_24_SSL, CONFIG_FILES[APACHE_24_SSL]['hook_contexts']) if os.path.exists(os.path.dirname(ROUTER_SETTING)): configs.register(ROUTER_SETTING, CONFIG_FILES[ROUTER_SETTING]['hook_contexts']) return configs
def quantum_plugins(): from charmhelpers.contrib.openstack import context return { 'ovs': { 'config': '/etc/quantum/plugins/openvswitch/' 'ovs_quantum_plugin.ini', 'driver': 'quantum.plugins.openvswitch.ovs_quantum_plugin.' 'OVSQuantumPluginV2', 'contexts': [ context.SharedDBContext(user=config('neutron-database-user'), database=config('neutron-database'), relation_prefix='neutron', ssl_dir=QUANTUM_CONF_DIR) ], 'services': ['quantum-plugin-openvswitch-agent'], 'packages': [[headers_package()] + determine_dkms_package(), ['quantum-plugin-openvswitch-agent']], 'server_packages': ['quantum-server', 'quantum-plugin-openvswitch'], 'server_services': ['quantum-server'] }, 'nvp': { 'config': '/etc/quantum/plugins/nicira/nvp.ini', 'driver': 'quantum.plugins.nicira.nicira_nvp_plugin.' 'QuantumPlugin.NvpPluginV2', 'contexts': [ context.SharedDBContext(user=config('neutron-database-user'), database=config('neutron-database'), relation_prefix='neutron', ssl_dir=QUANTUM_CONF_DIR) ], 'services': [], 'packages': [], 'server_packages': ['quantum-server', 'quantum-plugin-nicira'], 'server_services': ['quantum-server'] } }
def neutron_plugins(): from charmhelpers.contrib.openstack import context return { 'ovs': { 'config': '/etc/neutron/plugins/openvswitch/' 'ovs_neutron_plugin.ini', 'driver': 'neutron.plugins.openvswitch.ovs_neutron_plugin.' 'OVSNeutronPluginV2', 'contexts': [ context.SharedDBContext(user=config('neutron-database-user'), database=config('neutron-database'), relation_prefix='neutron') ], 'services': ['neutron-plugin-openvswitch-agent'], 'packages': [[headers_package(), 'openvswitch-datapath-dkms'], ['quantum-plugin-openvswitch-agent']], 'server_packages': ['neutron-server', 'neutron-plugin-openvswitch'], 'server_services': ['neutron-server'] }, 'nvp': { 'config': '/etc/neutron/plugins/nicira/nvp.ini', 'driver': 'neutron.plugins.nicira.nicira_nvp_plugin.' 'NeutronPlugin.NvpPluginV2', 'contexts': [ context.SharedDBContext(user=config('neutron-database-user'), database=config('neutron-database'), relation_prefix='neutron') ], 'services': [], 'packages': [], 'server_packages': ['neutron-server', 'neutron-plugin-nicira'], 'server_services': ['neutron-server'] } }
def resource_map(): rm = OrderedDict([ (ASTARA_CONFIG, { 'services': ['astara-orchestrator'], 'contexts': [ astara_context.AstaraOrchestratorContext(), context.AMQPContext(), context.SharedDBContext(), context.IdentityServiceContext( service='astara', service_user='******'), ], }) ]) return rm
def register_configs(): ''' Register config files with their respective contexts. ''' release = os_release('openstack-dashboard') configs = templating.OSConfigRenderer(templates_dir=TEMPLATES, openstack_release=release) confs = [LOCAL_SETTINGS, HAPROXY_CONF, PORTS_CONF] if release >= 'mitaka': configs.register(KEYSTONEV3_POLICY, CONFIG_FILES[KEYSTONEV3_POLICY]['hook_contexts']) CONFIG_FILES[LOCAL_SETTINGS]['hook_contexts'].append( context.SharedDBContext(user=config('database-user'), database=config('database'), ssl_dir=DASHBOARD_CONF_DIR)) for conf in confs: configs.register(conf, CONFIG_FILES[conf]['hook_contexts']) if os.path.isdir(APACHE_CONF_DIR) and cmp_pkgrevno('apache2', '2.4') >= 0: for conf in [APACHE_CONF, APACHE_SSL, APACHE_DEFAULT]: if os.path.isfile(conf): log('Removing old config %s' % (conf)) os.remove(conf) configs.register(APACHE_24_DEFAULT, CONFIG_FILES[APACHE_24_DEFAULT]['hook_contexts']) configs.register(APACHE_24_CONF, CONFIG_FILES[APACHE_24_CONF]['hook_contexts']) configs.register(APACHE_24_SSL, CONFIG_FILES[APACHE_24_SSL]['hook_contexts']) else: configs.register(APACHE_DEFAULT, CONFIG_FILES[APACHE_DEFAULT]['hook_contexts']) configs.register(APACHE_CONF, CONFIG_FILES[APACHE_CONF]['hook_contexts']) configs.register(APACHE_SSL, CONFIG_FILES[APACHE_SSL]['hook_contexts']) if os.path.exists(os.path.dirname(ROUTER_SETTING)): configs.register(ROUTER_SETTING, CONFIG_FILES[ROUTER_SETTING]['hook_contexts']) return configs
# The interface is said to be satisfied if anyone of the interfaces in the # list has a complete context. REQUIRED_INTERFACES = { 'database': ['shared-db'], 'identity': ['identity-service'], } def ceph_config_file(): return CHARM_CEPH_CONF.format(service_name()) CONFIG_FILES = OrderedDict([ (GLANCE_REGISTRY_CONF, { 'hook_contexts': [ context.SharedDBContext(ssl_dir=GLANCE_CONF_DIR), context.IdentityServiceContext(service='glance', service_user='******'), context.SyslogContext(), glance_contexts.LoggingConfigContext(), glance_contexts.GlanceIPv6Context(), context.WorkerConfigContext(), context.OSConfigFlagContext(charm_flag='registry-config-flags', template_flag='registry_config_flags'), context.MemcacheContext() ], 'services': ['glance-registry'] }), (GLANCE_API_CONF, { 'hook_contexts': [ context.SharedDBContext(ssl_dir=GLANCE_CONF_DIR),
def neutron_plugins(): from charmhelpers.contrib.openstack import context release = os_release('nova-common') plugins = { 'ovs': { 'config': '/etc/neutron/plugins/openvswitch/' 'ovs_neutron_plugin.ini', 'driver': 'neutron.plugins.openvswitch.ovs_neutron_plugin.' 'OVSNeutronPluginV2', 'contexts': [ context.SharedDBContext(user=config('neutron-database-user'), database=config('neutron-database'), relation_prefix='neutron', ssl_dir=NEUTRON_CONF_DIR) ], 'services': ['neutron-plugin-openvswitch-agent'], 'packages': [[headers_package()] + determine_dkms_package(), ['neutron-plugin-openvswitch-agent']], 'server_packages': ['neutron-server', 'neutron-plugin-openvswitch'], 'server_services': ['neutron-server'] }, 'nvp': { 'config': '/etc/neutron/plugins/nicira/nvp.ini', 'driver': 'neutron.plugins.nicira.nicira_nvp_plugin.' 'NeutronPlugin.NvpPluginV2', 'contexts': [ context.SharedDBContext(user=config('neutron-database-user'), database=config('neutron-database'), relation_prefix='neutron', ssl_dir=NEUTRON_CONF_DIR) ], 'services': [], 'packages': [], 'server_packages': ['neutron-server', 'neutron-plugin-nicira'], 'server_services': ['neutron-server'] }, 'nsx': { 'config': '/etc/neutron/plugins/vmware/nsx.ini', 'driver': 'vmware', 'contexts': [ context.SharedDBContext(user=config('neutron-database-user'), database=config('neutron-database'), relation_prefix='neutron', ssl_dir=NEUTRON_CONF_DIR) ], 'services': [], 'packages': [], 'server_packages': ['neutron-server', 'neutron-plugin-vmware'], 'server_services': ['neutron-server'] }, 'n1kv': { 'config': '/etc/neutron/plugins/cisco/cisco_plugins.ini', 'driver': 'neutron.plugins.cisco.network_plugin.PluginV2', 'contexts': [ context.SharedDBContext(user=config('neutron-database-user'), database=config('neutron-database'), relation_prefix='neutron', ssl_dir=NEUTRON_CONF_DIR) ], 'services': [], 'packages': [[headers_package()] + determine_dkms_package(), ['neutron-plugin-cisco']], 'server_packages': ['neutron-server', 'neutron-plugin-cisco'], 'server_services': ['neutron-server'] }, 'Calico': { 'config': '/etc/neutron/plugins/ml2/ml2_conf.ini', 'driver': 'neutron.plugins.ml2.plugin.Ml2Plugin', 'contexts': [ context.SharedDBContext(user=config('neutron-database-user'), database=config('neutron-database'), relation_prefix='neutron', ssl_dir=NEUTRON_CONF_DIR) ], 'services': [ 'calico-felix', 'bird', 'neutron-dhcp-agent', 'nova-api-metadata', 'etcd' ], 'packages': [[headers_package()] + determine_dkms_package(), [ 'calico-compute', 'bird', 'neutron-dhcp-agent', 'nova-api-metadata', 'etcd' ]], 'server_packages': ['neutron-server', 'calico-control', 'etcd'], 'server_services': ['neutron-server', 'etcd'] }, 'vsp': { 'config': '/etc/neutron/plugins/nuage/nuage_plugin.ini', 'driver': 'neutron.plugins.nuage.plugin.NuagePlugin', 'contexts': [ context.SharedDBContext(user=config('neutron-database-user'), database=config('neutron-database'), relation_prefix='neutron', ssl_dir=NEUTRON_CONF_DIR) ], 'services': [], 'packages': [], 'server_packages': ['neutron-server', 'neutron-plugin-nuage'], 'server_services': ['neutron-server'] }, 'plumgrid': { 'config': '/etc/neutron/plugins/plumgrid/plumgrid.ini', 'driver': 'neutron.plugins.plumgrid.plumgrid_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2', 'contexts': [ context.SharedDBContext(user=config('database-user'), database=config('database'), ssl_dir=NEUTRON_CONF_DIR) ], 'services': [], 'packages': [['plumgrid-lxc'], ['iovisor-dkms']], 'server_packages': ['neutron-server', 'neutron-plugin-plumgrid'], 'server_services': ['neutron-server'] }, 'midonet': { 'config': '/etc/neutron/plugins/midonet/midonet.ini', 'driver': 'midonet.neutron.plugin.MidonetPluginV2', 'contexts': [ context.SharedDBContext(user=config('neutron-database-user'), database=config('neutron-database'), relation_prefix='neutron', ssl_dir=NEUTRON_CONF_DIR) ], 'services': [], 'packages': [[headers_package()] + determine_dkms_package()], 'server_packages': ['neutron-server', 'python-neutron-plugin-midonet'], 'server_services': ['neutron-server'] } } if release >= 'icehouse': # NOTE: patch in ml2 plugin for icehouse onwards plugins['ovs']['config'] = '/etc/neutron/plugins/ml2/ml2_conf.ini' plugins['ovs']['driver'] = 'neutron.plugins.ml2.plugin.Ml2Plugin' plugins['ovs']['server_packages'] = [ 'neutron-server', 'neutron-plugin-ml2' ] # NOTE: patch in vmware renames nvp->nsx for icehouse onwards plugins['nvp'] = plugins['nsx'] return plugins
def required_interfaces(): """Provide the required charm interfaces based on configured roles.""" _interfaces = copy(REQUIRED_INTERFACES) if not service_enabled('api'): # drop requirement for identity interface _interfaces.pop('identity') return _interfaces # Map config files to hook contexts and services that will be associated # with file in restart_on_changes()'s service map. BASE_RESOURCE_MAP = OrderedDict([ (CINDER_CONF, { 'contexts': [ context.SharedDBContext(ssl_dir=CINDER_CONF_DIR), context.AMQPContext(ssl_dir=CINDER_CONF_DIR), context.ImageServiceContext(), context.OSConfigFlagContext(), context.SyslogContext(), cinder_contexts.CephContext(), cinder_contexts.HAProxyContext(), cinder_contexts.ImageServiceContext(), cinder_contexts.CinderSubordinateConfigContext( interface=['storage-backend', 'backup-backend'], service='cinder', config_file=CINDER_CONF), cinder_contexts.StorageBackendContext(), cinder_contexts.LoggingConfigContext(), context.IdentityServiceContext(service='cinder', service_user='******'),
for release in SERVICE_BLACKLIST: if os_rel >= release or config('disable-aws-compat'): [ _services.remove(service) for service in SERVICE_BLACKLIST[release] ] return _services BASE_RESOURCE_MAP = OrderedDict([ (NOVA_CONF, { 'services': resolve_services(), 'contexts': [ context.AMQPContext(ssl_dir=NOVA_CONF_DIR), context.SharedDBContext(relation_prefix='nova', ssl_dir=NOVA_CONF_DIR), context.OSConfigFlagContext(charm_flag='nova-alchemy-flags', template_flag='nova_alchemy_flags'), context.ImageServiceContext(), context.OSConfigFlagContext(), context.SubordinateConfigContext(interface='nova-vmware', service='nova', config_file=NOVA_CONF), nova_cc_context.NovaCellContext(), context.SyslogContext(), context.LogLevelContext(), nova_cc_context.HAProxyContext(), nova_cc_context.IdentityServiceContext(service='nova', service_user='******'), nova_cc_context.VolumeServiceContext(), context.ZeroMQContext(),
NEUTRON_LBAAS_CONF = '%s/neutron_lbaas.conf' % NEUTRON_CONF_DIR NEUTRON_VPNAAS_CONF = '%s/neutron_vpnaas.conf' % NEUTRON_CONF_DIR HAPROXY_CONF = '/etc/haproxy/haproxy.cfg' APACHE_CONF = '/etc/apache2/sites-available/openstack_https_frontend' APACHE_24_CONF = '/etc/apache2/sites-available/openstack_https_frontend.conf' NEUTRON_DEFAULT = '/etc/default/neutron-server' CA_CERT_PATH = '/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt' MEMCACHED_CONF = '/etc/memcached.conf' API_PASTE_INI = '%s/api-paste.ini' % NEUTRON_CONF_DIR BASE_RESOURCE_MAP = OrderedDict([ (NEUTRON_CONF, { 'services': ['neutron-server'], 'contexts': [context.AMQPContext(ssl_dir=NEUTRON_CONF_DIR), context.SharedDBContext( user=config('database-user'), database=config('database'), ssl_dir=NEUTRON_CONF_DIR), context.PostgresqlDBContext(database=config('database')), neutron_api_context.IdentityServiceContext( service='neutron', service_user='******'), context.OSConfigFlagContext(), neutron_api_context.NeutronCCContext(), context.SyslogContext(), context.ZeroMQContext(), context.NotificationDriverContext(), context.BindHostContext(), context.WorkerConfigContext(), context.InternalEndpointContext(), context.MemcacheContext()], }),
QUANTUM_CONF = '%s/quantum.conf' % QUANTUM_CONF_DIR QUANTUM_API_PASTE = '%s/api-paste.ini' % QUANTUM_CONF_DIR NEUTRON_CONF = '%s/neutron.conf' % NEUTRON_CONF_DIR HAPROXY_CONF = '/etc/haproxy/haproxy.cfg' APACHE_CONF = '/etc/apache2/sites-available/openstack_https_frontend' APACHE_24_CONF = '/etc/apache2/sites-available/openstack_https_frontend.conf' NEUTRON_DEFAULT = '/etc/default/neutron-server' QUANTUM_DEFAULT = '/etc/default/quantum-server' BASE_RESOURCE_MAP = OrderedDict([ (NOVA_CONF, { 'services': BASE_SERVICES, 'contexts': [ context.AMQPContext(ssl_dir=NOVA_CONF_DIR), context.SharedDBContext(relation_prefix='nova', ssl_dir=NOVA_CONF_DIR), context.OSConfigFlagContext(charm_flag='nova-alchemy-flags', template_flag='nova_alchemy_flags'), nova_cc_context.NovaPostgresqlDBContext(), context.ImageServiceContext(), context.OSConfigFlagContext(), context.SubordinateConfigContext(interface='nova-vmware', service='nova', config_file=NOVA_CONF), nova_cc_context.NovaCellContext(), context.SyslogContext(), context.LogLevelContext(), nova_cc_context.HAProxyContext(), nova_cc_context.IdentityServiceContext(service='nova', service_user='******'), nova_cc_context.VolumeServiceContext(),
] SVC = 'cloudkitty' CLOUDKITTY_DIR = '/etc/cloudkitty' CLOUDKITTY_CONF = '/etc/cloudkitty/cloudkitty.conf' HAPROXY_CONF = '/etc/haproxy/haproxy.cfg' HTTPS_APACHE_CONF = ('/etc/apache2/sites-available/' 'openstack_https_frontend.conf') CONFIG_FILES = OrderedDict([ (CLOUDKITTY_CONF, { 'services': BASE_SERVICES, 'contexts': [ context.AMQPContext(), context.SharedDBContext(relation_prefix='cloudkitty', ssl_dir=CLOUDKITTY_DIR), context.OSConfigFlagContext(), context.IdentityServiceContext(service=SVC, service_user=SVC), CloudkittyHAProxyContext(), context.SyslogContext() ] }), (HAPROXY_CONF, { 'contexts': [ context.HAProxyContext(singlenode_mode=True), CloudkittyHAProxyContext() ], 'services': ['haproxy'], }), (HTTPS_APACHE_CONF, { 'contexts': [CloudkittyApacheSSLContext()],
CLUSTER_RES = 'grp_heat_vips' SVC = 'heat' HEAT_DIR = '/etc/heat' HEAT_CONF = '/etc/heat/heat.conf' HEAT_API_PASTE = '/etc/heat/api-paste.ini' HAPROXY_CONF = '/etc/haproxy/haproxy.cfg' HTTPS_APACHE_CONF = '/etc/apache2/sites-available/openstack_https_frontend' HTTPS_APACHE_24_CONF = os.path.join('/etc/apache2/sites-available', 'openstack_https_frontend.conf') ADMIN_OPENRC = '/root/admin-openrc-v3' CONFIG_FILES = OrderedDict([ (HEAT_CONF, { 'services': BASE_SERVICES, 'contexts': [context.AMQPContext(ssl_dir=HEAT_DIR), context.SharedDBContext(relation_prefix='heat', ssl_dir=HEAT_DIR), context.OSConfigFlagContext(), HeatIdentityServiceContext(service=SVC, service_user=SVC), HeatHAProxyContext(), HeatSecurityContext(), InstanceUserContext(), context.SyslogContext(), context.LogLevelContext(), context.WorkerConfigContext(), context.BindHostContext(), ContrailAPIContext()] }), (HEAT_API_PASTE, { 'services': [s for s in BASE_SERVICES if 'api' in s], 'contexts': [HeatIdentityServiceContext()], }),
TEMPLATES = 'templates/' # The interface is said to be satisfied if anyone of the interfaces in the # list has a complete context. REQUIRED_INTERFACES = { 'database': ['shared-db', 'pgsql-db'], 'identity': ['identity-service'], } def ceph_config_file(): return CHARM_CEPH_CONF.format(service_name()) CONFIG_FILES = OrderedDict([ (GLANCE_REGISTRY_CONF, { 'hook_contexts': [context.SharedDBContext(ssl_dir=GLANCE_CONF_DIR), context.PostgresqlDBContext(), context.IdentityServiceContext( service='glance', service_user='******'), context.SyslogContext(), glance_contexts.LoggingConfigContext(), glance_contexts.GlanceIPv6Context(), context.WorkerConfigContext(), context.OSConfigFlagContext( charm_flag='registry-config-flags', template_flag='registry_config_flags')], 'services': ['glance-registry'] }), (GLANCE_API_CONF, { 'hook_contexts': [context.SharedDBContext(ssl_dir=GLANCE_CONF_DIR),