import tempfile import threading import time import weakref from essential.config import cfg from essential import fileutils from essential.gettextutils import _, _LE, _LI from essential 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.environ.get("ESSENTIAL_LOCK_PATH"), help=('Directory to use for lock files.')) ] CONF = cfg.CONF CONF.register_opts(util_opts) def set_defaults(lock_path): cfg.set_defaults(util_opts, lock_path=lock_path) class _FileLock(object):
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', secret=True), 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 '
from eventlet import semaphore import six from essential.config import cfg from essential import excutils from essential.gettextutils import _, _LE from essential import local from essential import log as logging from essential.rpc import common as rpc_common amqp_opts = [ cfg.BoolOpt('amqp_durable_queues', default=False, deprecated_name='rabbit_durable_queues', deprecated_group='DEFAULT', help='Use durable queues in amqp.'), cfg.BoolOpt('amqp_auto_delete', default=False, help='Auto-delete queues in amqp.'), ] cfg.CONF.register_opts(amqp_opts) UNIQUE_ID = '_unique_id' LOG = logging.getLogger(__name__) class Pool(pools.Pool): """Class that implements a Pool of Connections."""
_SANITIZE_PATTERNS = [] _FORMAT_PATTERNS = [ r'(%(key)s\s*[=]\s*[\"\']).*?([\"\'])', r'(<%(key)s>).*?(</%(key)s>)', r'([\"\']%(key)s[\"\']\s*:\s*[\"\']).*?([\"\'])', r'([\'"].*?%(key)s[\'"]\s*:\s*u?[\'"]).*?([\'"])' ] for key in _SANITIZE_KEYS: for pattern in _FORMAT_PATTERNS: reg_ex = re.compile(pattern % {'key': key}, re.DOTALL) _SANITIZE_PATTERNS.append(reg_ex) 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-append', metavar='PATH', deprecated_name='log-config', help='The name of logging configuration file. It does not ' 'disable existing loggers, but just appends specified '
from framework import context socket_opts = [ cfg.IntOpt('backlog', default=4096, help=_("Number of backlog requests to configure " "the socket with")), cfg.IntOpt('tcp_keepidle', default=600, help=_("Sets the value of TCP_KEEPIDLE in seconds for each " "server socket. Not supported on OS X.")), cfg.IntOpt('retry_until_window', default=30, help=_("Number of seconds to keep retrying to listen")), cfg.BoolOpt('use_ssl', default=False, help=_('Enable SSL on the API server')), cfg.StrOpt('ssl_ca_file', default=None, help=_("CA certificate file to use to verify " "connecting clients")), cfg.StrOpt('ssl_cert_file', default=None, help=_("Certificate file to use when starting " "the server securely")), cfg.StrOpt('ssl_key_file', default=None, help=_("Private key file to use when starting " "the server securely")), ]
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import copy from essential.config import cfg database_opts = [ cfg.StrOpt('sqlite_db', deprecated_group='DEFAULT', default='essential.sqlite', help='The file name to use with SQLite'), cfg.BoolOpt('sqlite_synchronous', deprecated_group='DEFAULT', default=True, help='If True, SQLite uses synchronous mode'), cfg.StrOpt('backend', default='sqlalchemy', deprecated_name='db_backend', deprecated_group='DEFAULT', help='The backend to use for db'), cfg.StrOpt('connection', help='The SQLAlchemy connection string used to connect to the ' 'database', secret=True, deprecated_opts=[cfg.DeprecatedOpt('sql_connection', group='DEFAULT'), cfg.DeprecatedOpt('sql_connection', group='DATABASE'), cfg.DeprecatedOpt('connection',
help='Username for qpid connection'), cfg.StrOpt('qpid_password', default='', help='Password for qpid connection', secret=True), 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'), # NOTE(russellb) If any additional versions are added (beyond 1 and 2), # this file could probably use some additional refactoring so that the # differences between each version are split into different classes. cfg.IntOpt('qpid_topology_version', default=1, help="The qpid topology version to use. Version 1 is what " "was originally used by impl_qpid. Version 2 includes " "some backwards-incompatible changes that allow broker " "federation to work. Users should update to version 2 " "when they are able to take everything down, as it " "requires a clean break."), ] cfg.CONF.register_opts(qpid_opts)
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import time from essential.config import cfg import six from essential.gettextutils import _, _LE, _LI from essential import log as logging periodic_opts = [ cfg.BoolOpt('run_external_periodic_tasks', default=True, help=('Some periodic tasks can be run in a separate process. ' 'Should we run them here?')), ] CONF = cfg.CONF CONF.register_opts(periodic_opts) LOG = logging.getLogger(__name__) DEFAULT_INTERVAL = 60.0 class InvalidPeriodicTaskArg(Exception): message = _("Unexpected argument for periodic task creation: %(arg)s.")
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=[ 'nova.exception', 'cinder.exception', 'exceptions', ], 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'), cfg.StrOpt('control_exchange', default='openstack', help='AMQP exchange to connect to if using RabbitMQ or Qpid'), ] CONF = cfg.CONF CONF.register_opts(rpc_opts) def set_defaults(control_exchange): cfg.set_defaults(rpc_opts, control_exchange=control_exchange) def create_connection(new=True):