Merge "Sync latest cfg from oslo-incubator"

This commit is contained in:
Jenkins 2013-01-23 12:52:11 +00:00 committed by Gerrit Code Review
commit bb108c6bd3
8 changed files with 162 additions and 152 deletions

View File

@ -61,6 +61,7 @@ opts = [
CONF = cfg.CONF
CONF.register_cli_opts(opts)
CONF.import_opt('debug', 'nova.openstack.common.log')
if __name__ == '__main__':

View File

@ -61,6 +61,7 @@ opts = [
CONF = cfg.CONF
CONF.register_cli_opts(opts)
CONF.import_opt('debug', 'nova.openstack.common.log')
if __name__ == '__main__':

View File

@ -1,46 +1,5 @@
[DEFAULT]
#
# Options defined in nova.openstack.common.cfg:CommonConfigOpts
#
# Print debugging output (boolean value)
#debug=false
# Print more verbose output (boolean value)
#verbose=false
# 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
# documentation for details on logging configuration files.
# (string value)
#log_config=<None>
# A logging.Formatter log message format string which may use
# any of the available logging.LogRecord attributes. Default:
# %(default)s (string value)
#log_format=%(asctime)s %(levelname)8s [%(name)s] %(message)s
# Format string for %%(asctime)s in log records. Default:
# %(default)s (string value)
#log_date_format=%Y-%m-%d %H:%M:%S
# (Optional) Name of log file to output to. If not set,
# logging will go to stdout. (string value)
#log_file=<None>
# (Optional) The directory to keep log files in (will be
# prepended to --log-file) (string value)
#log_dir=<None>
# Use syslog for logging. (boolean value)
#use_syslog=false
# syslog facility to receive log lines (string value)
#syslog_log_facility=LOG_USER
#
# Options defined in nova.availability_zones
#
@ -485,6 +444,22 @@
#osapi_hide_server_address_states=building
#
# Options defined in nova.api.openstack.compute.contrib.os_tenant_networks
#
# Enables or disables quotaing of tenant networks (boolean
# value)
#enable_network_quota=false
# Control for checking for default networks (string value)
#use_quantum_default_nets=False
# Default tenant id when creating quantum networks (string
# value)
#quantum_default_tenant_id=default
#
# Options defined in nova.api.openstack.compute.extensions
#
@ -1123,10 +1098,6 @@
# Autoassigning floating ip to VM (boolean value)
#auto_assign_floating_ip=false
# Network host to use for ip allocation in flat modes (string
# value)
#network_host=nova
# If passed, use fake network devices and addresses (boolean
# value)
#fake_network=false
@ -1207,6 +1178,10 @@
# (string value)
#quantum_auth_strategy=keystone
# Name of Integration Bridge used by Open vSwitch (string
# value)
#quantum_ovs_bridge=br-int
#
# Options defined in nova.network.rpcapi
@ -1253,6 +1228,14 @@
# Options defined in nova.openstack.common.log
#
# Print debugging output (set logging level to DEBUG instead
# of default WARNING level). (boolean value)
#debug=false
# Print more verbose output (set logging level to INFO instead
# of default WARNING level). (boolean value)
#verbose=false
# Log output to standard error (boolean value)
#use_stderr=true
@ -1262,11 +1245,11 @@
# format string to use for log messages with context (string
# value)
#logging_context_format_string=%(asctime)s %(levelname)s %(name)s [%(request_id)s %(user_id)s %(project_id)s] %(instance)s%(message)s
#logging_context_format_string=%(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(user)s %(tenant)s] %(instance)s%(message)s
# format string to use for log messages without context
# (string value)
#logging_default_format_string=%(asctime)s %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s
#logging_default_format_string=%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s
# data to append to log format when level is DEBUG (string
# value)
@ -1274,7 +1257,7 @@
# prefix each line of exception output with this format
# (string value)
#logging_exception_prefix=%(asctime)s %(process)d TRACE %(name)s %(instance)s
#logging_exception_prefix=%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s
# list of logger=LEVEL pairs (list value)
#default_log_levels=amqplib=WARN,sqlalchemy=WARN,boto=WARN,suds=INFO,keystone=INFO,eventlet.wsgi.server=WARN
@ -1293,6 +1276,36 @@
# it like this (string value)
#instance_uuid_format="[instance: %(uuid)s] "
# 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
# documentation for details on logging configuration files.
# (string value)
#log_config=<None>
# A logging.Formatter log message format string which may use
# any of the available logging.LogRecord attributes. Default:
# %(default)s (string value)
#log_format=%(asctime)s %(levelname)8s [%(name)s] %(message)s
# Format string for %%(asctime)s in log records. Default:
# %(default)s (string value)
#log_date_format=%Y-%m-%d %H:%M:%S
# (Optional) Name of log file to output to. If not set,
# logging will go to stdout. (string value)
#log_file=<None>
# (Optional) The directory to keep log files in (will be
# prepended to --log-file) (string value)
#log_dir=<None>
# Use syslog for logging. (boolean value)
#use_syslog=false
# syslog facility to receive log lines (string value)
#syslog_log_facility=LOG_USER
#
# Options defined in nova.openstack.common.notifier.api
@ -1724,13 +1737,18 @@
#
# Options defined in nova.virt.hyperv.vmops
# Options defined in nova.virt.hyperv.vif
#
# Default vSwitch Name, if none provided first external is
# used (string value)
# External virtual switch Name, if not provided, the first
# external virtual switch is used (string value)
#vswitch_name=<None>
#
# Options defined in nova.virt.hyperv.vmops
#
# Required for live migration among hosts with different CPU
# features (boolean value)
#limit_cpu_features=false
@ -1985,26 +2003,26 @@
# Options defined in nova.virt.vmwareapi.driver
#
# URL for connection to VMWare ESX host.Required if
# compute_driver is vmwareapi.VMWareESXDriver. (string value)
# URL for connection to VMware ESX host.Required if
# compute_driver is vmwareapi.VMwareESXDriver. (string value)
#vmwareapi_host_ip=<None>
# Username for connection to VMWare ESX host. Used only if
# compute_driver is vmwareapi.VMWareESXDriver. (string value)
# Username for connection to VMware ESX host. Used only if
# compute_driver is vmwareapi.VMwareESXDriver. (string value)
#vmwareapi_host_username=<None>
# Password for connection to VMWare ESX host. Used only if
# compute_driver is vmwareapi.VMWareESXDriver. (string value)
# Password for connection to VMware ESX host. Used only if
# compute_driver is vmwareapi.VMwareESXDriver. (string value)
#vmwareapi_host_password=<None>
# The interval used for polling of remote tasks. Used only if
# compute_driver is vmwareapi.VMWareESXDriver. (floating point
# compute_driver is vmwareapi.VMwareESXDriver. (floating point
# value)
#vmwareapi_task_poll_interval=5.0
# The number of times we retry on failures, e.g., socket
# error, etc. Used only if compute_driver is
# vmwareapi.VMWareESXDriver. (integer value)
# vmwareapi.VMwareESXDriver. (integer value)
#vmwareapi_api_retry_count=10
@ -2278,12 +2296,15 @@
# (string value)
#cinder_endpoint_template=<None>
# region name of this node (string value)
#os_region_name=<None>
# Number of cinderclient retries on failed http calls (integer
# value)
#cinder_http_retries=3
# Allow to perform insecure SSL (https) requests to cinder
# (boolean value)
# Allow to perform insecure SSL requests to cinder (boolean
# value)
#cinder_api_insecure=false
@ -2550,4 +2571,4 @@
#keymap=en-us
# Total option count: 520
# Total option count: 525

View File

@ -217,7 +217,7 @@ log files::
...
]
This module also contains a global instance of the CommonConfigOpts class
This module also contains a global instance of the ConfigOpts class
in order to support a common usage pattern in OpenStack::
from nova.openstack.common import cfg
@ -236,10 +236,11 @@ in order to support a common usage pattern in OpenStack::
Positional command line arguments are supported via a 'positional' Opt
constructor argument::
>>> CONF.register_cli_opt(MultiStrOpt('bar', positional=True))
>>> conf = ConfigOpts()
>>> conf.register_cli_opt(MultiStrOpt('bar', positional=True))
True
>>> CONF(['a', 'b'])
>>> CONF.bar
>>> conf(['a', 'b'])
>>> conf.bar
['a', 'b']
It is also possible to use argparse "sub-parsers" to parse additional
@ -249,10 +250,11 @@ command line arguments using the SubCommandOpt class:
... list_action = subparsers.add_parser('list')
... list_action.add_argument('id')
...
>>> CONF.register_cli_opt(SubCommandOpt('action', handler=add_parsers))
>>> conf = ConfigOpts()
>>> conf.register_cli_opt(SubCommandOpt('action', handler=add_parsers))
True
>>> CONF(['list', '10'])
>>> CONF.action.name, CONF.action.id
>>> conf(args=['list', '10'])
>>> conf.action.name, conf.action.id
('list', '10')
"""
@ -1726,62 +1728,4 @@ class ConfigOpts(collections.Mapping):
return value
class CommonConfigOpts(ConfigOpts):
DEFAULT_LOG_FORMAT = "%(asctime)s %(levelname)8s [%(name)s] %(message)s"
DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
common_cli_opts = [
BoolOpt('debug',
short='d',
default=False,
help='Print debugging output'),
BoolOpt('verbose',
short='v',
default=False,
help='Print more verbose output'),
]
logging_cli_opts = [
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 '
'documentation for details on logging configuration '
'files.'),
StrOpt('log-format',
default=DEFAULT_LOG_FORMAT,
metavar='FORMAT',
help='A logging.Formatter log message format string which may '
'use any of the available logging.LogRecord attributes. '
'Default: %(default)s'),
StrOpt('log-date-format',
default=DEFAULT_LOG_DATE_FORMAT,
metavar='DATE_FORMAT',
help='Format string for %%(asctime)s in log records. '
'Default: %(default)s'),
StrOpt('log-file',
metavar='PATH',
deprecated_name='logfile',
help='(Optional) Name of log file to output to. '
'If not set, logging will go to stdout.'),
StrOpt('log-dir',
deprecated_name='logdir',
help='(Optional) The directory to keep log files in '
'(will be prepended to --log-file)'),
BoolOpt('use-syslog',
default=False,
help='Use syslog for logging.'),
StrOpt('syslog-log-facility',
default='LOG_USER',
help='syslog facility to receive log lines')
]
def __init__(self):
super(CommonConfigOpts, self).__init__()
self.register_cli_opts(self.common_cli_opts)
self.register_cli_opts(self.logging_cli_opts)
CONF = CommonConfigOpts()
CONF = ConfigOpts()

View File

@ -54,7 +54,7 @@ class BaseParser(object):
value = value.strip()
if ((value and value[0] == value[-1]) and
(value[0] == "\"" or value[0] == "'")):
(value[0] == "\"" or value[0] == "'")):
value = value[1:-1]
return key.strip(), [value]

View File

@ -47,6 +47,67 @@ from nova.openstack.common import local
from nova.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 '
'documentation for details on logging configuration '
'files.'),
cfg.StrOpt('log-format',
default=_DEFAULT_LOG_FORMAT,
metavar='FORMAT',
help='A logging.Formatter log message format string which may '
'use any of the available logging.LogRecord attributes. '
'Default: %(default)s'),
cfg.StrOpt('log-date-format',
default=_DEFAULT_LOG_DATE_FORMAT,
metavar='DATE_FORMAT',
help='Format string for %%(asctime)s in log records. '
'Default: %(default)s'),
cfg.StrOpt('log-file',
metavar='PATH',
deprecated_name='logfile',
help='(Optional) Name of log file to output to. '
'If not set, logging will go to stdout.'),
cfg.StrOpt('log-dir',
deprecated_name='logdir',
help='(Optional) The directory to keep log files in '
'(will be prepended to --log-file)'),
cfg.BoolOpt('use-syslog',
default=False,
help='Use syslog for logging.'),
cfg.StrOpt('syslog-log-facility',
default='LOG_USER',
help='syslog facility to receive log lines')
]
generic_log_opts = [
cfg.BoolOpt('use_stderr',
default=True,
help='Log output to standard error'),
cfg.StrOpt('logfile_mode',
default='0644',
help='Default file mode used when creating log files'),
]
log_opts = [
cfg.StrOpt('logging_context_format_string',
default='%(asctime)s.%(msecs)03d %(levelname)s %(name)s '
@ -94,24 +155,9 @@ log_opts = [
'format it like this'),
]
generic_log_opts = [
cfg.StrOpt('logdir',
default=None,
help='Log output to a per-service log file in named directory'),
cfg.StrOpt('logfile',
default=None,
help='Log output to a named file'),
cfg.BoolOpt('use_stderr',
default=True,
help='Log output to standard error'),
cfg.StrOpt('logfile_mode',
default='0644',
help='Default file mode used when creating log files'),
]
CONF = cfg.CONF
CONF.register_cli_opts(common_cli_opts)
CONF.register_cli_opts(logging_cli_opts)
CONF.register_opts(generic_log_opts)
CONF.register_opts(log_opts)
@ -149,8 +195,8 @@ def _get_binary_name():
def _get_log_file_path(binary=None):
logfile = CONF.log_file or CONF.logfile
logdir = CONF.log_dir or CONF.logdir
logfile = CONF.log_file
logdir = CONF.log_dir
if logfile and not logdir:
return logfile

View File

@ -74,10 +74,6 @@ def main(srcfiles):
# The options list is a list of (module, options) tuples
opts_by_group = {'DEFAULT': []}
opts_by_group['DEFAULT'].append(
(cfg.__name__ + ':' + cfg.CommonConfigOpts.__name__,
_list_opts(cfg.CommonConfigOpts)[0][1]))
for pkg_name in pkg_names:
mods = mods_by_pkg.get(pkg_name)
mods.sort()

View File

@ -42,6 +42,7 @@ cleaner_opts = [
]
CONF = cfg.CONF
CONF.register_opts(cleaner_opts)
CONF.import_opt('verbose', 'nova.openstack.common.log')
CONF.import_opt("resize_confirm_window", "nova.compute.manager")