¡@

Home 

OpenStack Study: config.py

OpenStack Index

**** CubicPower OpenStack Study ****

def get_log_args(conf, log_file_name):

    cmd_args = []

    if conf.debug:

        cmd_args.append('--debug')

    if conf.verbose:

        cmd_args.append('--verbose')

    if (conf.log_dir or conf.log_file):

        cmd_args.append('--log-file=%s' % log_file_name)

        log_dir = None

        if conf.log_dir and conf.log_file:

            log_dir = os.path.dirname(

                os.path.join(conf.log_dir, conf.log_file))

        elif conf.log_dir:

            log_dir = conf.log_dir

        elif conf.log_file:

            log_dir = os.path.dirname(conf.log_file)

        if log_dir:

            cmd_args.append('--log-dir=%s' % log_dir)

    else:

        if conf.use_syslog:

            cmd_args.append('--use-syslog')

            if conf.syslog_log_facility:

                cmd_args.append(

                    '--syslog-log-facility=%s' % conf.syslog_log_facility)

    return cmd_args

**** CubicPower OpenStack Study ****

def register_root_helper(conf):

    # The first call is to ensure backward compatibility

    conf.register_opts(ROOT_HELPER_OPTS)

    conf.register_opts(ROOT_HELPER_OPTS, 'AGENT')

**** CubicPower OpenStack Study ****

def register_agent_state_opts_helper(conf):

    conf.register_opts(AGENT_STATE_OPTS, 'AGENT')

**** CubicPower OpenStack Study ****

def register_interface_driver_opts_helper(conf):

    conf.register_opts(INTERFACE_DRIVER_OPTS)

**** CubicPower OpenStack Study ****

def register_use_namespaces_opts_helper(conf):

    conf.register_opts(USE_NAMESPACES_OPTS)

**** CubicPower OpenStack Study ****

def get_root_helper(conf):

    root_helper = conf.AGENT.root_helper

    if root_helper != 'sudo':

        return root_helper

    root_helper = conf.root_helper

    if root_helper != 'sudo':

        LOG.deprecated(_('DEFAULT.root_helper is deprecated! Please move '

                         'root_helper configuration to [AGENT] section.'))

        return root_helper

    return 'sudo'

**** CubicPower OpenStack Study ****

def setup_conf():

    bind_opts = [

        cfg.StrOpt('state_path',

                   default='/var/lib/neutron',

                   help=_('Top-level directory for maintaining dhcp state')),

    ]

    conf = cfg.ConfigOpts()

    conf.register_opts(bind_opts)

    return conf

# add a logging setup method here for convenience

setup_logging = config.setup_logging