diff options
-rw-r--r-- | etc/nova/nova.conf.sample | 491 | ||||
-rw-r--r-- | nova/api/openstack/compute/plugins/v3/servers.py | 9 | ||||
-rw-r--r-- | nova/cmd/novnc.py | 44 | ||||
-rw-r--r-- | nova/cmd/novncproxy.py | 30 | ||||
-rw-r--r-- | nova/cmd/spicehtml5proxy.py | 36 | ||||
-rw-r--r-- | nova/openstack/common/config/__init__.py | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | nova/openstack/common/config/generator.py (renamed from tools/conf/extract_opts.py) | 74 | ||||
-rw-r--r-- | nova/utils.py | 3 | ||||
-rwxr-xr-x | nova/virt/baremetal/tilera.py | 13 | ||||
-rw-r--r-- | openstack-common.conf | 1 | ||||
-rwxr-xr-x | tools/conf/generate_sample.sh | 6 |
11 files changed, 400 insertions, 307 deletions
diff --git a/etc/nova/nova.conf.sample b/etc/nova/nova.conf.sample index 29778a556..7524a7e5e 100644 --- a/etc/nova/nova.conf.sample +++ b/etc/nova/nova.conf.sample @@ -52,15 +52,6 @@ # -# Options defined in nova.manager -# - -# Some periodic tasks can be run in a separate process. Should -# we run them here? (boolean value) -#run_external_periodic_tasks=true - - -# # Options defined in nova.netconf # @@ -82,6 +73,13 @@ # # If set, send compute.instance.update notifications on +# instance state changes. Valid values are None for no +# notifications, "vm_state" for notifications on VM state +# changes, or "vm_and_task_state" for notifications on VM and +# task state changes. (string value) +#notify_on_state_change=<None> + +# If set, send compute.instance.update notifications on # instance state changes. Valid values are False for no # notifications, True for notifications on any instance # changes. (boolean value) @@ -91,13 +89,6 @@ # the API service. (boolean value) #notify_api_faults=false -# If set, send compute.instance.update notifications on -# instance state changes. Valid values are None for no -# notifications, "vm_state" for notifications on VM state -# changes, or "vm_and_task_state" for notifications on VM and -# task state changes. (string value) -#notify_on_state_change=<None> - # # Options defined in nova.paths @@ -143,6 +134,10 @@ # number of floating ips allowed per project (integer value) #quota_floating_ips=10 +# number of fixed ips allowed per project (this should be at +# least the number of instances allowed) (integer value) +#quota_fixed_ips=-1 + # number of metadata items allowed per instance (integer # value) #quota_metadata_items=128 @@ -276,9 +271,6 @@ # Length of generated instance admin passwords (integer value) #password_length=12 -# Whether to disable inter-process locks (boolean value) -#disable_process_locking=false - # time period to generate instance usages for. Time period # must be hour, day, month or year (string value) #instance_usage_audit_period=month @@ -541,19 +533,73 @@ # -# Options defined in nova.common.memorycache +# Options defined in nova.cmd.clear_rabbit_queues # -# Memcached servers or None for in process cache. (list value) -#memcached_servers=<None> +# Queues to delete (multi valued) +#queues= + +# delete nova exchange too. (boolean value) +#delete_exchange=false # -# Options defined in nova.compute +# Options defined in nova.cmd.novnc +# + +# Record sessions to FILE.[session_number] (boolean value) +#record=false + +# Become a daemon (background process) (boolean value) +#daemon=false + +# Disallow non-encrypted connections (boolean value) +#ssl_only=false + +# Source is ipv6 (boolean value) +#source_is_ipv6=false + +# SSL certificate file (string value) +#cert=self.pem + +# SSL key file (if separate from cert) (string value) +#key=<None> + +# Run webserver on same port. Serve files from DIR. (string +# value) +#web=/usr/share/spice-html5 + + +# +# Options defined in nova.cmd.novncproxy # -# The full class name of the compute API class to use (string +# Host on which to listen for incoming requests (string value) +#novncproxy_host=0.0.0.0 + +# Port on which to listen for incoming requests (integer # value) +#novncproxy_port=6080 + + +# +# Options defined in nova.cmd.spicehtml5proxy +# + +# Host on which to listen for incoming requests (string value) +#spicehtml5proxy_host=0.0.0.0 + +# Port on which to listen for incoming requests (integer +# value) +#spicehtml5proxy_port=6082 + + +# +# Options defined in nova.compute +# + +# The full class name of the compute API class to use +# (deprecated) (string value) #compute_api_class=nova.compute.api.API @@ -565,6 +611,10 @@ # when testing in single-host environments. (boolean value) #allow_resize_to_same_host=false +# Allow migrate machine to the same host. Useful when testing +# in single-host environments. (boolean value) +#allow_migrate_to_same_host=false + # availability zone to use when user doesn't specify one # (string value) #default_schedule_zone=<None> @@ -588,7 +638,7 @@ # -# Options defined in nova.compute.instance_types +# Options defined in nova.compute.flavors # # default instance type to use, testing only (string value) @@ -630,6 +680,10 @@ # interval to pull bandwidth usage info (integer value) #bandwidth_poll_interval=600 +# interval to sync power states between the database and the +# hypervisor (integer value) +#sync_power_state_interval=600 + # Number of seconds between instance info_cache self healing # updates (integer value) #heal_instance_info_cache_interval=60 @@ -1046,6 +1100,10 @@ # be on the bottom. (string value) #iptables_bottom_regex= +# The table that iptables to jump to when a packet is to be +# dropped. (string value) +#iptables_drop_action=DROP + # # Options defined in nova.network.manager @@ -1083,7 +1141,9 @@ # Number of addresses in each private subnet (integer value) #network_size=256 -# Fixed IP address block (string value) +# DEPRECATED - Fixed IP address block.If set to an empty +# string, the subnet range(s) will be automatically determined +# and configured. (string value) #fixed_range=10.0.0.0/8 # Fixed IPv6 address block (string value) @@ -1210,50 +1270,6 @@ # The full class name of the security API class (string value) #security_group_api=nova -# -# Options defined in bin.nova-clear-rabbit-queues -# - -# Queues to delete (multi valued) -#queues= - -# delete nova exchange too. (boolean value) -#delete_exchange=false - - -# -# Options defined in bin.nova-novncproxy -# - -# Record sessions to FILE.[session_number] (boolean value) -#record=false - -# Become a daemon (background process) (boolean value) -#daemon=false - -# Disallow non-encrypted connections (boolean value) -#ssl_only=false - -# Source is ipv6 (boolean value) -#source_is_ipv6=false - -# SSL certificate file (string value) -#cert=self.pem - -# SSL key file (if separate from cert) (string value) -#key=<None> - -# Run webserver on same port. Serve files from DIR. (string -# value) -#web=/usr/share/novnc - -# Host on which to listen for incoming requests (string value) -#novncproxy_host=0.0.0.0 - -# Port on which to listen for incoming requests (integer -# value) -#novncproxy_port=6080 - # # Options defined in nova.objectstore.s3server @@ -1287,7 +1303,7 @@ # The SQLAlchemy connection string used to connect to the # database (string value) -#sql_connection=sqlite:////nova/openstack/common/db/$sqlite_db +#sql_connection=sqlite:////common/db/$sqlite_db # the filename to use with sqlite (string value) #sqlite_db=nova.sqlite @@ -1363,13 +1379,9 @@ # Log output to standard error (boolean value) #use_stderr=true -# Default file mode used when creating log files (string -# value) -#logfile_mode=0644 - # format string to use for log messages with context (string # value) -#logging_context_format_string=%(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(user)s %(tenant)s] %(instance)s%(message)s +#logging_context_format_string=%(asctime)s.%(msecs)03d %(process)d %(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) @@ -1408,20 +1420,22 @@ #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 +# any of the available logging.LogRecord attributes. This +# option is deprecated. Please use +# logging_context_format_string and +# logging_default_format_string instead. (string value) +#log_format=<None> # 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) +# (Optional) Name of log file to output to. If no default is +# 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) +# (Optional) The base directory used for relative --log-file +# paths (string value) #log_dir=<None> # Use syslog for logging. (boolean value) @@ -1432,6 +1446,14 @@ # +# Options defined in nova.openstack.common.memorycache +# + +# Memcached servers or None for in process cache. (list value) +#memcached_servers=<None> + + +# # Options defined in nova.openstack.common.notifier.api # @@ -1457,6 +1479,15 @@ # +# Options defined in nova.openstack.common.periodic_task +# + +# Some periodic tasks can be run in a separate process. Should +# we run them here? (boolean value) +#run_external_periodic_tasks=true + + +# # Options defined in nova.openstack.common.rpc # @@ -1569,7 +1600,7 @@ # Qpid broker hostname (string value) #qpid_hostname=localhost -# Qpid broker port (string value) +# Qpid broker port (integer value) #qpid_port=5672 # Qpid HA cluster host:port pairs (list value) @@ -1624,7 +1655,7 @@ # Name of this node. Must be a valid hostname, FQDN, or IP # address. Must match "host" option, if running Nova. (string # value) -#rpc_zmq_host=sorcha +#rpc_zmq_host=nova # @@ -1634,6 +1665,12 @@ # Matchmaker ring file (JSON) (string value) #matchmaker_ringfile=/etc/nova/matchmaker_ring.json +# Heartbeat frequency (integer value) +#matchmaker_heartbeat_freq=300 + +# Heartbeat time-to-live. (integer value) +#matchmaker_heartbeat_ttl=600 + # # Options defined in nova.scheduler.driver @@ -1743,17 +1780,6 @@ # -# Options defined in nova.scheduler.multi -# - -# Driver to use for scheduling compute calls (string value) -#compute_scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler - -# Default driver to use for scheduling calls (string value) -#default_scheduler_driver=nova.scheduler.chance.ChanceScheduler - - -# # Options defined in nova.scheduler.rpcapi # @@ -1771,24 +1797,6 @@ # -# Options defined in nova.scheduler.weights.least_cost -# - -# Which cost functions the LeastCostScheduler should use (list -# value) -#least_cost_functions=<None> - -# How much weight to give the noop cost function (floating -# point value) -#noop_cost_fn_weight=1.0 - -# How much weight to give the fill-first cost function. A -# negative value will reverse behavior: e.g. spread-first -# (floating point value) -#compute_fill_first_cost_fn_weight=<None> - - -# # Options defined in nova.scheduler.weights.ram # @@ -1856,7 +1864,8 @@ # Driver to use for controlling virtualization. Options # include: libvirt.LibvirtDriver, xenapi.XenAPIDriver, # fake.FakeDriver, baremetal.BareMetalDriver, -# vmwareapi.VMWareESXDriver (string value) +# vmwareapi.VMwareESXDriver, vmwareapi.VMwareVCDriver (string +# value) #compute_driver=<None> # The default format an ephemeral_volume will be formatted @@ -1886,52 +1895,6 @@ # -# Options defined in nova.virt.hyperv.vif -# - -# 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 - -# Sets the admin password in the config drive image (boolean -# value) -#config_drive_inject_password=false - -# qemu-img is used to convert between different image types -# (string value) -#qemu_img_cmd=qemu-img.exe - -# Attaches the Config Drive image as a cdrom drive instead of -# a disk drive (boolean value) -#config_drive_cdrom=false - - -# -# Options defined in nova.virt.hyperv.volumeops -# - -# The number of times we retry on attaching volume (integer -# value) -#hyperv_attaching_volume_retry_count=10 - -# The seconds to wait between an volume attachment attempt -# (integer value) -#hyperv_wait_between_attach_retry=5 - -# Force volumeutils v1 (boolean value) -#force_volumeutils_v1=false - - -# # Options defined in nova.virt.images # @@ -2040,6 +2003,10 @@ # ["file=directsync","block=none"] (list value) #disk_cachemodes= +# Which pcpus can be used by vcpus of instance e.g: +# "4-12,^8,15" (string value) +#vcpu_pin_set=<None> + # # Options defined in nova.virt.libvirt.imagebackend @@ -2252,7 +2219,8 @@ # # Optional VIM Service WSDL Location e.g -# http://<server>/vimService.wsdl +# http://<server>/vimService.wsdl. Optional over-ride to +# default location for bug work-arounds (string value) #vmwareapi_wsdl_loc=<None> @@ -2278,11 +2246,18 @@ # (string value) #xenapi_agent_path=usr/sbin/xe-update-networking -# Disable XenAPI agent. Reduces the amount of time it takes -# nova to detect that a VM has started, when that VM does not -# have the agent installed (boolean value) +# Disables the use of the XenAPI agent in any image regardless +# of what image properties are present. (boolean value) #xenapi_disable_agent=false +# Determines if the xenapi agent should be used when the image +# used does not contain a hint to declare if the agent is +# present or not. The hint is a glance property +# "xenapi_use_agent" that has the value "true" or "false". +# Note that waiting for the agent when it is not present will +# significantly increase server boot times. (boolean value) +#xenapi_use_agent_default=false + # # Options defined in nova.virt.xenapi.driver @@ -2513,8 +2488,8 @@ # region name of this node (string value) #os_region_name=<None> -# Allow for a ca certificates file to be specified for cinder -# client requests (string value) +# Location of ca certicates file to use for cinder client +# requests. (string value) #cinder_ca_certificates_file=<None> # Number of cinderclient retries on failed http calls (integer @@ -2530,7 +2505,7 @@ #cinder_cross_az_attach=true -[HYPERV] +[hyperv] # # Options defined in nova.virt.hyperv.pathutils @@ -2544,6 +2519,71 @@ #instances_path_share= +# +# Options defined in nova.virt.hyperv.vif +# + +# 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 + +# Sets the admin password in the config drive image (boolean +# value) +#config_drive_inject_password=false + +# qemu-img is used to convert between different image types +# (string value) +#qemu_img_cmd=qemu-img.exe + +# Attaches the Config Drive image as a cdrom drive instead of +# a disk drive (boolean value) +#config_drive_cdrom=false + + +# +# Options defined in nova.virt.hyperv.volumeops +# + +# The number of times to retry to attach a volume (integer +# value) +#volume_attach_retry_count=10 + +# Interval between volume attachment attempts, in seconds +# (integer value) +#volume_attach_retry_interval=5 + +# Force volumeutils v1 (boolean value) +#force_volumeutils_v1=false + + +[osapi_v3] + +# +# Options defined in nova.api.openstack +# + +# Whether the V3 API is enabled or not (boolean value) +#enabled=false + +# A list of v3 API extensions to never load. Specify the +# extension aliases here. (list value) +#extensions_blacklist= + +# If the list is not empty then a v3 API extension will only +# be loaded if it exists in this list. Specify the extension +# aliases here. (list value) +#extensions_whitelist= + + [conductor] # @@ -2613,6 +2653,13 @@ # value) #call_timeout=60 +# Percentage of cell capacity to hold in reserve. Affects both +# memory and disk utilization (floating point value) +#reserve_percent=10.0 + +# Type of cell: api or compute (string value) +#cell_type=<None> + # # Options defined in nova.cells.rpc_driver @@ -2628,6 +2675,16 @@ # Options defined in nova.cells.scheduler # +# Filter classes the cells scheduler should use. An entry of +# "nova.cells.filters.all_filters"maps to all cells filters +# included with nova. (list value) +#scheduler_filter_classes=nova.cells.filters.all_filters + +# Weigher classes the cells scheduler should use. An entry of +# "nova.cells.weights.all_weighers"maps to all cell weighers +# included with nova. (list value) +#scheduler_weight_classes=nova.cells.weights.all_weighers + # How many retries when no cells are available. (integer # value) #scheduler_retries=10 @@ -2646,6 +2703,33 @@ #db_check_interval=60 +# +# Options defined in nova.cells.weights.mute_child +# + +# Multiplier used to weigh mute children. (The value should +# be negative.) (floating point value) +#mute_weight_multiplier=-10.0 + +# Weight value assigned to mute children. (The value should +# be positive.) (floating point value) +#mute_weight_value=1000.0 + +# Number of seconds after which a lack of capability and +# capacity updates signals the child cell is to be treated as +# a mute. (integer value) +#mute_child_interval=300 + + +# +# Options defined in nova.cells.weights.ram_by_instance_type +# + +# Multiplier used for weighing ram. Negative numbers mean to +# stack vs spread. (floating point value) +#ram_weight_multiplier=10.0 + + [zookeeper] # @@ -2767,15 +2851,42 @@ # +# Options defined in nova.virt.baremetal.tilera_pdu +# + +# ip address of tilera pdu (string value) +#tile_pdu_ip=10.0.100.1 + +# management script for tilera pdu (string value) +#tile_pdu_mgr=/tftpboot/pdu_mgr + +# power status of tilera PDU is OFF (integer value) +#tile_pdu_off=2 + +# power status of tilera PDU is ON (integer value) +#tile_pdu_on=1 + +# power status of tilera PDU (integer value) +#tile_pdu_status=9 + +# wait time in seconds until check the result after tilera +# power operations (integer value) +#tile_power_wait=9 + + +# # Options defined in nova.virt.baremetal.virtual_power_driver # # ip or name to virtual power host (string value) #virtual_power_ssh_host= +# Port to use for ssh to virtual power host (integer value) +#virtual_power_ssh_port=22 + # base command to use for virtual power(vbox,virsh) (string # value) -#virtual_power_type=vbox +#virtual_power_type=virsh # user to execute virtual power commands as (string value) #virtual_power_host_user= @@ -2783,6 +2894,9 @@ # password for virtual power host_user (string value) #virtual_power_host_pass= +# ssh key for virtual power host_user (string value) +#virtual_power_host_key=<None> + # # Options defined in nova.virt.baremetal.volume_driver @@ -2808,6 +2922,22 @@ #topics=notifications +[matchmaker_redis] + +# +# Options defined in nova.openstack.common.rpc.matchmaker_redis +# + +# Host to locate redis (string value) +#host=127.0.0.1 + +# Use this port to connect to redis host. (integer value) +#port=6379 + +# Password for Redis server. (optional) (string value) +#password=<None> + + [trusted_computing] # @@ -2872,25 +3002,4 @@ #keymap=en-us -[osapi_v3] - -# -# Options defined in nova.api.openstack -# - -# Whether the V3 API is enabled or not -#enabled=False - -# If the list is not empty then a v3 API extension -# will only be loaded if it exists in this list. -# Specify the extension aliases here -#extensions_whitelist= - -# A list of v3 API extensions to never load. -# Specify the extension aliases here. -# Note that if an extension is in both the blacklist and -# and whitelist then it will not be loaded -#extensions_blacklist= - - -# Total option count: 584 +# Total option count: 609 diff --git a/nova/api/openstack/compute/plugins/v3/servers.py b/nova/api/openstack/compute/plugins/v3/servers.py index d9b2d4a3b..5ba249c78 100644 --- a/nova/api/openstack/compute/plugins/v3/servers.py +++ b/nova/api/openstack/compute/plugins/v3/servers.py @@ -41,14 +41,9 @@ from nova.openstack.common import uuidutils from nova import utils -server_opts = [ - cfg.BoolOpt('enable_instance_password', - default=True, - help='Allows use of instance password during ' - 'server creation'), -] CONF = cfg.CONF -CONF.register_opts(server_opts) +CONF.import_opt('enable_instance_password', + 'nova.api.openstack.compute.servers') CONF.import_opt('network_api_class', 'nova.network') CONF.import_opt('reclaim_instance_interval', 'nova.compute.manager') diff --git a/nova/cmd/novnc.py b/nova/cmd/novnc.py new file mode 100644 index 000000000..c381984da --- /dev/null +++ b/nova/cmd/novnc.py @@ -0,0 +1,44 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright (c) 2012 OpenStack Foundation +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# 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. + +from oslo.config import cfg + +opts = [ + cfg.BoolOpt('record', + default=False, + help='Record sessions to FILE.[session_number]'), + cfg.BoolOpt('daemon', + default=False, + help='Become a daemon (background process)'), + cfg.BoolOpt('ssl_only', + default=False, + help='Disallow non-encrypted connections'), + cfg.BoolOpt('source_is_ipv6', + default=False, + help='Source is ipv6'), + cfg.StrOpt('cert', + default='self.pem', + help='SSL certificate file'), + cfg.StrOpt('key', + default=None, + help='SSL key file (if separate from cert)'), + cfg.StrOpt('web', + default='/usr/share/spice-html5', + help='Run webserver on same port. Serve files from DIR.'), + ] + +cfg.CONF.register_cli_opts(opts) diff --git a/nova/cmd/novncproxy.py b/nova/cmd/novncproxy.py index 449aea76e..2abba7c90 100644 --- a/nova/cmd/novncproxy.py +++ b/nova/cmd/novncproxy.py @@ -30,27 +30,6 @@ from nova.console import websocketproxy opts = [ - cfg.BoolOpt('record', - default=False, - help='Record sessions to FILE.[session_number]'), - cfg.BoolOpt('daemon', - default=False, - help='Become a daemon (background process)'), - cfg.BoolOpt('ssl_only', - default=False, - help='Disallow non-encrypted connections'), - cfg.BoolOpt('source_is_ipv6', - default=False, - help='Source is ipv6'), - cfg.StrOpt('cert', - default='self.pem', - help='SSL certificate file'), - cfg.StrOpt('key', - default=None, - help='SSL key file (if separate from cert)'), - cfg.StrOpt('web', - default='/usr/share/novnc', - help='Run webserver on same port. Serve files from DIR.'), cfg.StrOpt('novncproxy_host', default='0.0.0.0', help='Host on which to listen for incoming requests'), @@ -61,11 +40,18 @@ opts = [ CONF = cfg.CONF CONF.register_cli_opts(opts) -CONF.import_opt('debug', 'nova.openstack.common.log') +CONF.import_opt('record', 'nova.cmd.novnc') +CONF.import_opt('daemon', 'nova.cmd.novnc') +CONF.import_opt('ssl_only', 'nova.cmd.novnc') +CONF.import_opt('source_is_ipv6', 'nova.cmd.novnc') +CONF.import_opt('cert', 'nova.cmd.novnc') +CONF.import_opt('key', 'nova.cmd.novnc') +CONF.import_opt('web', 'nova.cmd.novnc') def main(): # Setup flags + CONF.set_defaults(CONF, web='/usr/share/novnc') config.parse_args(sys.argv) if CONF.ssl_only and not os.path.exists(CONF.cert): diff --git a/nova/cmd/spicehtml5proxy.py b/nova/cmd/spicehtml5proxy.py index c6f2be53d..561c6e7aa 100644 --- a/nova/cmd/spicehtml5proxy.py +++ b/nova/cmd/spicehtml5proxy.py @@ -28,29 +28,7 @@ from oslo.config import cfg from nova import config from nova.console import websocketproxy - opts = [ - cfg.BoolOpt('record', - default=False, - help='Record sessions to FILE.[session_number]'), - cfg.BoolOpt('daemon', - default=False, - help='Become a daemon (background process)'), - cfg.BoolOpt('ssl_only', - default=False, - help='Disallow non-encrypted connections'), - cfg.BoolOpt('source_is_ipv6', - default=False, - help='Source is ipv6'), - cfg.StrOpt('cert', - default='self.pem', - help='SSL certificate file'), - cfg.StrOpt('key', - default=None, - help='SSL key file (if separate from cert)'), - cfg.StrOpt('web', - default='/usr/share/spice-html5', - help='Run webserver on same port. Serve files from DIR.'), cfg.StrOpt('spicehtml5proxy_host', default='0.0.0.0', help='Host on which to listen for incoming requests'), @@ -59,13 +37,19 @@ opts = [ help='Port on which to listen for incoming requests'), ] +CONF = cfg.CONF +CONF.register_cli_opts(opts) +CONF.import_opt('record', 'nova.cmd.novnc') +CONF.import_opt('daemon', 'nova.cmd.novnc') +CONF.import_opt('ssl_only', 'nova.cmd.novnc') +CONF.import_opt('source_is_ipv6', 'nova.cmd.novnc') +CONF.import_opt('cert', 'nova.cmd.novnc') +CONF.import_opt('key', 'nova.cmd.novnc') +CONF.import_opt('web', 'nova.cmd.novnc') + def main(): # Setup flags - - CONF = cfg.CONF - CONF.register_cli_opts(opts) - CONF.import_opt('debug', 'nova.openstack.common.log') config.parse_args(sys.argv) if CONF.ssl_only and not os.path.exists(CONF.cert): diff --git a/nova/openstack/common/config/__init__.py b/nova/openstack/common/config/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/nova/openstack/common/config/__init__.py diff --git a/tools/conf/extract_opts.py b/nova/openstack/common/config/generator.py index deb49f7a9..7ab3abc70 100644..100755 --- a/tools/conf/extract_opts.py +++ b/nova/openstack/common/config/generator.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 SINA Corporation @@ -17,7 +18,6 @@ # # @author: Zhongyue Luo, SINA Corporation. # - """Extracts OpenStack config option info from module(s).""" import imp @@ -29,8 +29,10 @@ import textwrap from oslo.config import cfg +from nova.openstack.common import gettextutils from nova.openstack.common import importutils +gettextutils.install('nova') STROPT = "StrOpt" BOOLOPT = "BoolOpt" @@ -58,7 +60,7 @@ BASEDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")) WORDWRAP_WIDTH = 60 -def main(srcfiles): +def generate(srcfiles): mods_by_pkg = dict() for filepath in srcfiles: pkg_name = filepath.split(os.sep)[1] @@ -104,58 +106,37 @@ def _import_module(mod_str): return sys.modules[mod_str[4:]] else: return importutils.import_module(mod_str) - except (ValueError, AttributeError) as err: - return None except ImportError as ie: sys.stderr.write("%s\n" % str(ie)) return None - except Exception as e: + except Exception: return None -def _guess_groups(opt, mod_obj): - groups = [] +def _is_in_group(opt, group): + "Check if opt is in group." + for key, value in group._opts.items(): + if value['opt'] == opt: + return True + return False + +def _guess_groups(opt, mod_obj): # is it in the DEFAULT group? - if (opt.dest in cfg.CONF and - not isinstance(cfg.CONF[opt.dest], cfg.CONF.GroupAttr)): - groups.append('DEFAULT') + if _is_in_group(opt, cfg.CONF): + return 'DEFAULT' # what other groups is it in? for key, value in cfg.CONF.items(): - if not isinstance(value, cfg.CONF.GroupAttr): - continue - if opt.dest not in value: - continue - groups.append(key) - - if len(groups) == 1: - return groups[0] - - group = None - for g in groups: - if g in mod_obj.__name__: - group = g - break - - if group is None and 'DEFAULT' in groups: - sys.stderr.write("Guessing that " + opt.dest + - " in " + mod_obj.__name__ + - " is in DEFAULT group out of " + - ','.join(groups) + "\n") - return 'DEFAULT' - - if group is None: - sys.stderr.write("Unable to guess what group " + opt.dest + - " in " + mod_obj.__name__ + - " is in out of " + ','.join(groups) + "\n") - sys.exit(1) + if isinstance(value, cfg.CONF.GroupAttr): + if _is_in_group(opt, value._group): + return value._group.name - sys.stderr.write("Guessing that " + opt.dest + - " in " + mod_obj.__name__ + - " is in the " + group + - " group out of " + ','.join(groups) + "\n") - return group + raise RuntimeError( + "Unable to find group for option %s, " + "maybe it's defined twice in the same group?" + % opt.name + ) def _list_opts(obj): @@ -262,8 +243,11 @@ def _print_opt(opt): sys.exit(1) -if __name__ == '__main__': +def main(): if len(sys.argv) < 2: - print "usage: python %s [srcfile]...\n" % sys.argv[0] + print "usage: %s [srcfile]...\n" % sys.argv[0] sys.exit(0) - main(sys.argv[1:]) + generate(sys.argv[1:]) + +if __name__ == '__main__': + main() diff --git a/nova/utils.py b/nova/utils.py index 2b488a7e7..9067488d5 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -68,9 +68,6 @@ utils_opts = [ cfg.IntOpt('password_length', default=12, help='Length of generated instance admin passwords'), - cfg.BoolOpt('disable_process_locking', - default=False, - help='Whether to disable inter-process locks'), cfg.StrOpt('instance_usage_audit_period', default='month', help='time period to generate instance usages for. ' diff --git a/nova/virt/baremetal/tilera.py b/nova/virt/baremetal/tilera.py index d9a065bf1..7906fdddd 100755 --- a/nova/virt/baremetal/tilera.py +++ b/nova/virt/baremetal/tilera.py @@ -35,22 +35,13 @@ from nova.virt.baremetal import base from nova.virt.baremetal import db from nova.virt.baremetal import utils as bm_utils -tilera_opts = [ - cfg.StrOpt('net_config_template', - default='$pybasedir/nova/virt/baremetal/' - 'net-dhcp.ubuntu.template', - help='Template file for injected network config'), - ] LOG = logging.getLogger(__name__) -baremetal_group = cfg.OptGroup(name='baremetal', - title='Baremetal Options') - CONF = cfg.CONF -CONF.register_group(baremetal_group) -CONF.register_opts(tilera_opts, baremetal_group) CONF.import_opt('use_ipv6', 'nova.netconf') +CONF.import_opt('net_config_template', 'nova.virt.baremetal.pxe', + group='baremetal') CHEETAH = None diff --git a/openstack-common.conf b/openstack-common.conf index 297029dc1..05fca3167 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -2,6 +2,7 @@ # The list of modules to copy from oslo-incubator.git module=cliutils +module=config module=context module=db module=db.sqlalchemy diff --git a/tools/conf/generate_sample.sh b/tools/conf/generate_sample.sh index 283d7a654..d0f5c83c9 100755 --- a/tools/conf/generate_sample.sh +++ b/tools/conf/generate_sample.sh @@ -19,10 +19,12 @@ FILES=$(find nova -type f -name "*.py" ! -path "nova/tests/*" -exec \ grep -l "Opt(" {} \; | sort -u) -BINS=$(echo bin/nova-*) +BINS=$(echo bin/nova-* | grep -v nova-rootwrap) + +export EVENTLET_NO_GREENDNS=yes PYTHONPATH=./:${PYTHONPATH} \ - python $(dirname "$0")/extract_opts.py ${FILES} ${BINS} > \ + python $(dirname "$0")/../../nova/openstack/common/config/generator.py ${FILES} ${BINS} > \ etc/nova/nova.conf.sample # Remove compiled files created by imp.import_source() |