Ejemplo n.º 1
0
def register_common_config_options():
    global _COMMON_OPTIONS_ALREADY_REGISTERED
    if _COMMON_OPTIONS_ALREADY_REGISTERED:
        return

    # Register the configuration options
    common_config.register_core_common_config_opts()

    # Ensure that the control exchange is set correctly
    oslo_messaging.set_transport_defaults(control_exchange='neutron')

    ks_loading.register_auth_conf_options(cfg.CONF,
                                          common_config.NOVA_CONF_SECTION)
    ks_loading.register_session_conf_options(cfg.CONF,
                                             common_config.NOVA_CONF_SECTION)

    # Register the nova configuration options
    common_config.register_nova_opts()

    ks_loading.register_auth_conf_options(cfg.CONF,
                                          common_config.PLACEMENT_CONF_SECTION)
    ks_loading.register_session_conf_options(
        cfg.CONF, common_config.PLACEMENT_CONF_SECTION)

    # Register the placement configuration options
    common_config.register_placement_opts()

    logging.register_options(cfg.CONF)

    # Register the ironic configuration options
    ks_loading.register_auth_conf_options(cfg.CONF,
                                          common_config.IRONIC_CONF_SECTION)
    ks_loading.register_session_conf_options(cfg.CONF,
                                             common_config.IRONIC_CONF_SECTION)
    ks_loading.register_adapter_conf_options(cfg.CONF,
                                             common_config.IRONIC_CONF_SECTION)
    common_config.register_ironic_opts()

    _COMMON_OPTIONS_ALREADY_REGISTERED = True
Ejemplo n.º 2
0
ks_loading.register_session_conf_options(cfg.CONF,
                                         common_config.PLACEMENT_CONF_SECTION)

# Register the placement configuration options
common_config.register_placement_opts()

logging.register_options(cfg.CONF)

# Register the ironic configuration options
ks_loading.register_auth_conf_options(cfg.CONF,
                                      common_config.IRONIC_CONF_SECTION)
ks_loading.register_session_conf_options(cfg.CONF,
                                         common_config.IRONIC_CONF_SECTION)
ks_loading.register_adapter_conf_options(cfg.CONF,
                                         common_config.IRONIC_CONF_SECTION)
common_config.register_ironic_opts()


def init(args, default_config_files=None, **kwargs):
    cfg.CONF(args=args, project='neutron',
             version='%%(prog)s %s' % version.version_info.release_string(),
             default_config_files=default_config_files,
             **kwargs)

    n_rpc.init(cfg.CONF)

    # Validate that the base_mac is of the correct format
    msg = validators.validate_regex(cfg.CONF.base_mac, validators.MAC_PATTERN)
    if msg:
        msg = _("Base MAC: %s") % msg
        raise Exception(msg)