def get_nova_config_files():
    global __NOVA_CONFIG_FILES
    if __NOVA_CONFIG_FILES is not None:
        return __NOVA_CONFIG_FILES

    NOVA_CONFIG_FILES = {
        NOVA_CONF: {
            'hook_contexts': [
                NetworkServiceContext(),
                NeutronGatewayContext(),
                SyslogContext(),
                context.WorkerConfigContext(),
                context.ZeroMQContext(),
                context.NotificationDriverContext(),
                NovaMetadataContext()
            ],
            'services': ['nova-api-metadata']
        },
        NOVA_API_METADATA_AA_PROFILE_PATH: {
            'services': ['nova-api-metadata'],
            'hook_contexts':
            [context.AppArmorContext(NOVA_API_METADATA_AA_PROFILE)],
        },
        VENDORDATA_FILE: {
            'services': [],
            'hook_contexts': [NovaMetadataJSONContext('neutron-common')],
        },
    }

    return NOVA_CONFIG_FILES
Esempio n. 2
0
def register_configs():
    release = get_os_codename_package('swift', fatal=False) or 'essex'
    configs = templating.OSConfigRenderer(templates_dir=TEMPLATES,
                                          openstack_release=release)
    configs.register('/etc/swift/swift.conf',
                     [SwiftStorageContext()])
    configs.register('/etc/rsync-juju.d/050-swift-storage.conf',
                     [RsyncContext(), SwiftStorageServerContext()])
    # NOTE: add VaultKVContext so interface status can be assessed
    for server in ['account', 'object', 'container']:
        contexts = [SwiftStorageServerContext(),
                    context.BindHostContext(),
                    context.WorkerConfigContext()]

        # if vault deps are not installed it is not yet possible to check the
        # vault context status since it requires the hvac dependency.
        if vaultlocker_installed():
            contexts.append(vaultlocker.VaultKVContext(
                            vaultlocker.VAULTLOCKER_BACKEND))

        configs.register('/etc/swift/%s-server.conf' % server, contexts)

        if enable_replication():
            configs.register(
                '/etc/swift/{svc}-server/{svc}-server-replicator.conf'.format(
                    svc=server),
                contexts)

    return configs
Esempio n. 3
0
    def workers(self):
        """Return the a number of workers that depends on the
        config('worker_muliplier') and the number of cpus.   This function uses
        the charmhelpers.contrib.openstack.context.WorkerConfigContext() to do
        the heavy lifting so that any changes in charmhelpers propagate to this
        function

        :returns: <int> the number of workers to apply to a configuration file.
        """
        return ch_context.WorkerConfigContext()()["workers"]
Esempio n. 4
0
def register_configs():
    release = get_os_codename_package('python-swift', fatal=False) or 'essex'
    configs = templating.OSConfigRenderer(templates_dir=TEMPLATES,
                                          openstack_release=release)
    configs.register('/etc/swift/swift.conf',
                     [SwiftStorageContext()])
    configs.register('/etc/rsync-juju.d/050-swift-storage.conf',
                     [RsyncContext(), SwiftStorageServerContext()])
    for server in ['account', 'object', 'container']:
        configs.register('/etc/swift/%s-server.conf' % server,
                         [SwiftStorageServerContext(),
                          context.BindHostContext(),
                          context.WorkerConfigContext()]),
    return configs
Esempio n. 5
0

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),
            context.AMQPContext(ssl_dir=GLANCE_CONF_DIR),
            context.IdentityServiceContext(service='glance',
                                           service_user='******'),
            glance_contexts.GlanceContext(),
            glance_contexts.CephGlanceContext(),
            glance_contexts.ObjectStoreContext(),
def get_config_files():
    global __CONFIG_FILES
    if __CONFIG_FILES is not None:
        return __CONFIG_FILES

    NOVA_CONFIG_FILES = get_nova_config_files()

    NEUTRON_SHARED_CONFIG_FILES = {
        NEUTRON_DHCP_AGENT_CONF: {
            'hook_contexts': [DHCPAgentContext()],
            'services': ['neutron-dhcp-agent']
        },
        NEUTRON_DNSMASQ_CONF: {
            'hook_contexts': [DHCPAgentContext()],
            'services': ['neutron-dhcp-agent']
        },
        NEUTRON_METADATA_AGENT_CONF: {
            'hook_contexts': [
                NetworkServiceContext(),
                DHCPAgentContext(),
                context.WorkerConfigContext(),
                NeutronGatewayContext(),
                NovaMetadataContext()
            ],
            'services': ['neutron-metadata-agent']
        },
        NEUTRON_DHCP_AA_PROFILE_PATH: {
            'services': ['neutron-dhcp-agent'],
            'hook_contexts':
            [context.AppArmorContext(NEUTRON_DHCP_AA_PROFILE)],
        },
        NEUTRON_LBAAS_AA_PROFILE_PATH: {
            'services': ['neutron-lbaas-agent'],
            'hook_contexts':
            [context.AppArmorContext(NEUTRON_LBAAS_AA_PROFILE)],
        },
        NEUTRON_LBAASV2_AA_PROFILE_PATH: {
            'services': ['neutron-lbaasv2-agent'],
            'hook_contexts':
            [context.AppArmorContext(NEUTRON_LBAASV2_AA_PROFILE)],
        },
        NEUTRON_METADATA_AA_PROFILE_PATH: {
            'services': ['neutron-metadata-agent'],
            'hook_contexts':
            [context.AppArmorContext(NEUTRON_METADATA_AA_PROFILE)],
        },
        NEUTRON_METERING_AA_PROFILE_PATH: {
            'services': ['neutron-metering-agent'],
            'hook_contexts':
            [context.AppArmorContext(NEUTRON_METERING_AA_PROFILE)],
        },
    }
    NEUTRON_SHARED_CONFIG_FILES.update(NOVA_CONFIG_FILES)

    NEUTRON_OVS_CONFIG_FILES = {
        NEUTRON_CONF: {
            'hook_contexts': [
                context.AMQPContext(ssl_dir=NEUTRON_CONF_DIR),
                NeutronGatewayContext(),
                SyslogContext(),
                context.ZeroMQContext(),
                context.WorkerConfigContext(),
                context.NotificationDriverContext()
            ],
            'services': [
                'neutron-l3-agent', 'neutron-dhcp-agent',
                'neutron-metadata-agent', 'neutron-plugin-openvswitch-agent',
                'neutron-plugin-metering-agent', 'neutron-metering-agent',
                'neutron-lbaas-agent', 'neutron-vpn-agent'
            ]
        },
        NEUTRON_L3_AGENT_CONF: {
            'hook_contexts': [
                NetworkServiceContext(),
                L3AgentContext(),
                NeutronGatewayContext()
            ],
            'services': ['neutron-l3-agent', 'neutron-vpn-agent']
        },
        NEUTRON_METERING_AGENT_CONF: {
            'hook_contexts': [NeutronGatewayContext()],
            'services':
            ['neutron-plugin-metering-agent', 'neutron-metering-agent']
        },
        NEUTRON_LBAAS_AGENT_CONF: {
            'hook_contexts': [NeutronGatewayContext()],
            'services': ['neutron-lbaas-agent']
        },
        NEUTRON_VPNAAS_AGENT_CONF: {
            'hook_contexts': [NeutronGatewayContext()],
            'services': ['neutron-vpn-agent']
        },
        NEUTRON_FWAAS_CONF: {
            'hook_contexts': [NeutronGatewayContext()],
            'services': ['neutron-l3-agent', 'neutron-vpn-agent']
        },
        NEUTRON_ML2_PLUGIN_CONF: {
            'hook_contexts': [NeutronGatewayContext()],
            'services': ['neutron-plugin-openvswitch-agent']
        },
        NEUTRON_OVS_AGENT_CONF: {
            'hook_contexts': [NeutronGatewayContext()],
            'services': ['neutron-plugin-openvswitch-agent']
        },
        NEUTRON_OVS_AA_PROFILE_PATH: {
            'services': ['neutron-plugin-openvswitch-agent'],
            'hook_contexts': [context.AppArmorContext(NEUTRON_OVS_AA_PROFILE)],
        },
        NEUTRON_L3_AA_PROFILE_PATH: {
            'services': ['neutron-l3-agent', 'neutron-vpn-agent'],
            'hook_contexts': [context.AppArmorContext(NEUTRON_L3_AA_PROFILE)],
        },
        EXT_PORT_CONF: {
            'hook_contexts': [ExternalPortContext()],
            'services': ['ext-port']
        },
        PHY_NIC_MTU_CONF: {
            'hook_contexts': [PhyNICMTUContext()],
            'services': ['os-charm-phy-nic-mtu']
        }
    }
    NEUTRON_OVS_CONFIG_FILES.update(NEUTRON_SHARED_CONFIG_FILES)

    NEUTRON_OVS_ODL_CONFIG_FILES = {
        NEUTRON_CONF: {
            'hook_contexts': [
                context.AMQPContext(ssl_dir=NEUTRON_CONF_DIR),
                NeutronGatewayContext(),
                SyslogContext(),
                context.ZeroMQContext(),
                context.WorkerConfigContext(),
                context.NotificationDriverContext()
            ],
            'services': [
                'neutron-l3-agent', 'neutron-dhcp-agent',
                'neutron-metadata-agent', 'neutron-plugin-metering-agent',
                'neutron-metering-agent', 'neutron-lbaas-agent',
                'neutron-vpn-agent'
            ]
        },
        NEUTRON_L3_AGENT_CONF: {
            'hook_contexts': [
                NetworkServiceContext(),
                L3AgentContext(),
                NeutronGatewayContext()
            ],
            'services': ['neutron-l3-agent', 'neutron-vpn-agent']
        },
        NEUTRON_METERING_AGENT_CONF: {
            'hook_contexts': [NeutronGatewayContext()],
            'services':
            ['neutron-plugin-metering-agent', 'neutron-metering-agent']
        },
        NEUTRON_LBAAS_AGENT_CONF: {
            'hook_contexts': [NeutronGatewayContext()],
            'services': ['neutron-lbaas-agent']
        },
        NEUTRON_VPNAAS_AGENT_CONF: {
            'hook_contexts': [NeutronGatewayContext()],
            'services': ['neutron-vpn-agent']
        },
        NEUTRON_FWAAS_CONF: {
            'hook_contexts': [NeutronGatewayContext()],
            'services': ['neutron-l3-agent', 'neutron-vpn-agent']
        },
        EXT_PORT_CONF: {
            'hook_contexts': [ExternalPortContext()],
            'services': ['ext-port']
        },
        PHY_NIC_MTU_CONF: {
            'hook_contexts': [PhyNICMTUContext()],
            'services': ['os-charm-phy-nic-mtu']
        }
    }
    NEUTRON_OVS_ODL_CONFIG_FILES.update(NEUTRON_SHARED_CONFIG_FILES)

    NEUTRON_NSX_CONFIG_FILES = {
        NEUTRON_CONF: {
            'hook_contexts': [
                context.AMQPContext(ssl_dir=NEUTRON_CONF_DIR),
                NeutronGatewayContext(),
                context.WorkerConfigContext(),
                SyslogContext()
            ],
            'services': ['neutron-dhcp-agent', 'neutron-metadata-agent']
        },
    }
    NEUTRON_NSX_CONFIG_FILES.update(NEUTRON_SHARED_CONFIG_FILES)

    NEUTRON_N1KV_CONFIG_FILES = {
        NEUTRON_CONF: {
            'hook_contexts': [
                context.AMQPContext(ssl_dir=NEUTRON_CONF_DIR),
                NeutronGatewayContext(),
                context.WorkerConfigContext(),
                SyslogContext()
            ],
            'services': [
                'neutron-l3-agent', 'neutron-dhcp-agent',
                'neutron-metadata-agent'
            ]
        },
        NEUTRON_L3_AGENT_CONF: {
            'hook_contexts': [
                NetworkServiceContext(),
                L3AgentContext(),
                NeutronGatewayContext()
            ],
            'services': ['neutron-l3-agent']
        },
    }
    NEUTRON_N1KV_CONFIG_FILES.update(NEUTRON_SHARED_CONFIG_FILES)

    __CONFIG_FILES = {
        NSX: NEUTRON_NSX_CONFIG_FILES,
        OVS: NEUTRON_OVS_CONFIG_FILES,
        N1KV: NEUTRON_N1KV_CONFIG_FILES,
        OVS_ODL: NEUTRON_OVS_ODL_CONFIG_FILES
    }

    return __CONFIG_FILES