Beispiel #1
0
 def parse_args(self, argv):
     """Parses command-line arguments."""
     cli_opts = [
         cfg.BoolOpt('no-site-packages',
                     default=False,
                     short='n',
                     help="Do not inherit packages from global Python"
                     "install"),
     ]
     CLI = cfg.ConfigOpts()
     CLI.register_cli_opts(cli_opts)
     CLI(argv[1:])
     return CLI
Beispiel #2
0
# alternative middleware configuration in the main application's
# configuration file e.g. in nova.conf
# [keystone_authtoken]
# auth_host = 127.0.0.1
# auth_port = 35357
# auth_protocol = http
# admin_tenant_name = admin
# admin_user = admin
# admin_password = badpassword
opts = [
    cfg.StrOpt('auth_admin_prefix', default=''),
    cfg.StrOpt('auth_host', default='127.0.0.1'),
    cfg.IntOpt('auth_port', default=35357),
    cfg.StrOpt('auth_protocol', default='https'),
    cfg.StrOpt('auth_uri', default=None),
    cfg.BoolOpt('delay_auth_decision', default=False),
    cfg.StrOpt('admin_token'),
    cfg.StrOpt('admin_user'),
    cfg.StrOpt('admin_password'),
    cfg.StrOpt('admin_tenant_name', default='admin'),
    cfg.StrOpt('certfile'),
    cfg.StrOpt('keyfile'),
    cfg.StrOpt('signing_dir'),
    cfg.ListOpt('memcache_servers'),
    cfg.IntOpt('token_cache_time', default=300),
]
CONF.register_opts(opts, group='keystone_authtoken')


def will_expire_soon(expiry):
    """ Determines if expiration is about to occur.
Beispiel #3
0
               default=60,
               help='Seconds to wait for a response from call or multicall'),
    cfg.IntOpt('rpc_cast_timeout',
               default=30,
               help='Seconds to wait before a cast expires (TTL). '
               'Only supported by impl_zmq.'),
    cfg.ListOpt('allowed_rpc_exception_modules',
                default=[
                    'openstack.common.exception',
                    'nova.exception',
                    'cinder.exception',
                ],
                help='Modules of exceptions that are permitted to be recreated'
                'upon receiving exception data from an rpc call.'),
    cfg.BoolOpt('fake_rabbit',
                default=False,
                help='If passed, use a fake RabbitMQ provider'),
    #
    # The following options are not registered here, but are expected to be
    # present. The project using this library must register these options with
    # the configuration so that project-specific defaults may be defined.
    #
    #cfg.StrOpt('control_exchange',
    #           default='nova',
    #           help='AMQP exchange to connect to if using RabbitMQ or Qpid'),
]

cfg.CONF.register_opts(rpc_opts)


def create_connection(new=True):
Beispiel #4
0
import tempfile
import time
import weakref

from eventlet import semaphore

from openstack.common import cfg
from openstack.common import fileutils
from openstack.common.gettextutils import _
from openstack.common import log as logging

LOG = logging.getLogger(__name__)

util_opts = [
    cfg.BoolOpt('disable_process_locking',
                default=False,
                help='Whether to disable inter-process locks'),
    cfg.StrOpt('lock_path',
               default=os.path.abspath(
                   os.path.join(os.path.dirname(__file__), '../')),
               help='Directory to use for lock files')
]

CONF = cfg.CONF
CONF.register_opts(util_opts)


class _InterProcessLock(object):
    """Lock implementation which allows multiple locks, working around
    issues like bugs.debian.org/cgi-bin/bugreport.cgi?bug=632857 and does
    not require any cleanup. Since the lock is always held on a file
Beispiel #5
0
               default='',
               help='Username for qpid connection'),
    cfg.StrOpt('qpid_password',
               default='',
               help='Password for qpid connection'),
    cfg.StrOpt('qpid_sasl_mechanisms',
               default='',
               help='Space separated list of SASL mechanisms to use for auth'),
    cfg.IntOpt('qpid_heartbeat',
               default=60,
               help='Seconds between connection keepalive heartbeats'),
    cfg.StrOpt('qpid_protocol',
               default='tcp',
               help="Transport to use, either 'tcp' or 'ssl'"),
    cfg.BoolOpt('qpid_tcp_nodelay',
                default=True,
                help='Disable Nagle algorithm'),
]

cfg.CONF.register_opts(qpid_opts)


class ConsumerBase(object):
    """Consumer base class."""
    def __init__(self, session, callback, node_name, node_opts, link_name,
                 link_opts):
        """Declare a queue on an amqp session.

        'session' is the amqp session to use
        'callback' is the callback to call when messages are received
        'node_name' is the first part of the Qpid address string, before ';'
Beispiel #6
0
            help='SSL cert file (valid only if SSL enabled)'),
 cfg.StrOpt('kombu_ssl_ca_certs',
            default='',
            help=('SSL certification authority file '
                  '(valid only if SSL enabled)')),
 cfg.StrOpt('rabbit_host',
            default='localhost',
            help='The RabbitMQ broker address where a single node is used'),
 cfg.IntOpt('rabbit_port',
            default=5672,
            help='The RabbitMQ broker port where a single node is used'),
 cfg.ListOpt('rabbit_hosts',
             default=['$rabbit_host:$rabbit_port'],
             help='RabbitMQ HA cluster host:port pairs'),
 cfg.BoolOpt('rabbit_use_ssl',
             default=False,
             help='connect over SSL for RabbitMQ'),
 cfg.StrOpt('rabbit_userid', default='guest', help='the RabbitMQ userid'),
 cfg.StrOpt('rabbit_password',
            default='guest',
            help='the RabbitMQ password'),
 cfg.StrOpt('rabbit_virtual_host',
            default='/',
            help='the RabbitMQ virtual host'),
 cfg.IntOpt('rabbit_retry_interval',
            default=1,
            help='how frequently to retry connecting with RabbitMQ'),
 cfg.IntOpt('rabbit_retry_backoff',
            default=2,
            help='how long to backoff for between retries when connecting '
            'to RabbitMQ'),
Beispiel #7
0
               default='%(asctime)s %(process)d %(levelname)s %(name)s [-]'
               ' %(instance)s%(message)s',
               help='format string to use for log messages without context'),
    cfg.StrOpt('logging_debug_format_suffix',
               default='%(funcName)s %(pathname)s:%(lineno)d',
               help='data to append to log format when level is DEBUG'),
    cfg.StrOpt('logging_exception_prefix',
               default='%(asctime)s %(process)d TRACE %(name)s %(instance)s',
               help='prefix each line of exception output with this format'),
    cfg.ListOpt('default_log_levels',
                default=[
                    'amqplib=WARN', 'sqlalchemy=WARN', 'boto=WARN',
                    'suds=INFO', 'keystone=INFO', 'eventlet.wsgi.server=WARN'
                ],
                help='list of logger=LEVEL pairs'),
    cfg.BoolOpt('publish_errors', default=False, help='publish error events'),

    # NOTE(mikal): there are two options here because sometimes we are handed
    # a full instance (and could include more information), and other times we
    # are just handed a UUID for the instance.
    cfg.StrOpt('instance_format',
               default='[instance: %(uuid)s] ',
               help='If an instance is passed with the log message, format '
               'it like this'),
    cfg.StrOpt('instance_uuid_format',
               default='[instance: %(uuid)s] ',
               help='If an instance UUID is passed with the log message, '
               'format it like this'),
]

generic_log_opts = [
Beispiel #8
0
import traceback

from openstack.common import cfg
from openstack.common.gettextutils import _
from openstack.common import jsonutils
from openstack.common import local
from openstack.common import notifier


_DEFAULT_LOG_FORMAT = "%(asctime)s %(levelname)8s [%(name)s] %(message)s"
_DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"

common_cli_opts = [
    cfg.BoolOpt('debug',
                short='d',
                default=False,
                help='Print debugging output (set logging level to '
                     'DEBUG instead of default WARNING level).'),
    cfg.BoolOpt('verbose',
                short='v',
                default=False,
                help='Print more verbose output (set logging level to '
                     'INFO instead of default WARNING level).'),
]

logging_cli_opts = [
    cfg.StrOpt('log-config',
               metavar='PATH',
               help='If this option is specified, the logging configuration '
                    'file specified is used and overrides any other logging '
                    'options specified. Please see the Python logging module '
Beispiel #9
0
            default='localhost',
            help='Qpid broker hostname'),
 cfg.StrOpt('qpid_port',
            default='5672',
            help='Qpid broker port'),
 cfg.StrOpt('qpid_username',
            default='',
            help='Username for qpid connection'),
 cfg.StrOpt('qpid_password',
            default='',
            help='Password for qpid connection'),
 cfg.StrOpt('qpid_sasl_mechanisms',
            default='',
            help='Space separated list of SASL mechanisms to use for auth'),
 cfg.BoolOpt('qpid_reconnect',
             default=True,
             help='Automatically reconnect'),
 cfg.IntOpt('qpid_reconnect_timeout',
            default=0,
            help='Reconnection timeout in seconds'),
 cfg.IntOpt('qpid_reconnect_limit',
            default=0,
            help='Max reconnections before giving up'),
 cfg.IntOpt('qpid_reconnect_interval_min',
            default=0,
            help='Minimum seconds between reconnection attempts'),
 cfg.IntOpt('qpid_reconnect_interval_max',
            default=0,
            help='Maximum seconds between reconnection attempts'),
 cfg.IntOpt('qpid_reconnect_interval',
            default=0,
Beispiel #10
0
            default='',
            help='SSL version to use (valid only if SSL enabled)'),
 cfg.StrOpt('kombu_ssl_keyfile',
            default='',
            help='SSL key file (valid only if SSL enabled)'),
 cfg.StrOpt('kombu_ssl_certfile',
            default='',
            help='SSL cert file (valid only if SSL enabled)'),
 cfg.StrOpt('kombu_ssl_ca_certs',
            default='',
            help=('SSL certification authority file '
                  '(valid only if SSL enabled)')),
 cfg.StrOpt('rabbit_host', default='localhost', help='the RabbitMQ host'),
 cfg.IntOpt('rabbit_port', default=5672, help='the RabbitMQ port'),
 cfg.BoolOpt('rabbit_use_ssl',
             default=False,
             help='connect over SSL for RabbitMQ'),
 cfg.StrOpt('rabbit_userid', default='guest', help='the RabbitMQ userid'),
 cfg.StrOpt('rabbit_password',
            default='guest',
            help='the RabbitMQ password'),
 cfg.StrOpt('rabbit_virtual_host',
            default='/',
            help='the RabbitMQ virtual host'),
 cfg.IntOpt('rabbit_retry_interval',
            default=1,
            help='how frequently to retry connecting with RabbitMQ'),
 cfg.IntOpt('rabbit_retry_backoff',
            default=2,
            help='how long to backoff for between retries when connecting '
            'to RabbitMQ'),