From 3859af4596bd2fba6de0242e900ebd64ea0ae28a Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Wed, 21 Nov 2012 22:44:07 +0000 Subject: Move compute opts from nova.config A bunch of config options are declared in nova.config but only used in nova.compute.api or nova.compute.manager. Move them to the module which uses them. blueprint: scope-config-opts Change-Id: Id33182e9276f61e799305b6b743d1a1f34f25625 --- nova/compute/api.py | 29 ++++++++++++++++++++++++----- nova/compute/manager.py | 28 ++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 11 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 48068eca1..a9c465909 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -59,13 +59,32 @@ from nova import volume LOG = logging.getLogger(__name__) +compute_opts = [ + cfg.BoolOpt('allow_resize_to_same_host', + default=False, + help='Allow destination machine to match source for resize. ' + 'Useful when testing in single-host environments.'), + cfg.StrOpt('default_schedule_zone', + default=None, + help='availability zone to use when user doesn\'t specify one'), + cfg.ListOpt('non_inheritable_image_properties', + default=['cache_in_nova', + 'bittorrent'], + help='These are image properties which a snapshot should not' + ' inherit from an instance'), + cfg.StrOpt('null_kernel', + default='nokernel', + help='kernel image that indicates not to use a kernel, but to ' + 'use a raw disk image instead'), + cfg.StrOpt('security_group_handler', + default='nova.network.sg.NullSecurityGroupHandler', + help='The full class name of the security group handler class'), +] + + CONF = cfg.CONF -CONF.import_opt('allow_resize_to_same_host', 'nova.config') +CONF.register_opts(compute_opts) CONF.import_opt('compute_topic', 'nova.config') -CONF.import_opt('default_schedule_zone', 'nova.config') -CONF.import_opt('non_inheritable_image_properties', 'nova.config') -CONF.import_opt('null_kernel', 'nova.config') -CONF.import_opt('security_group_handler', 'nova.config') CONF.import_opt('consoleauth_topic', 'nova.consoleauth') MAX_USERDATA_SIZE = 65535 diff --git a/nova/compute/manager.py b/nova/compute/manager.py index eab4906b0..51916e4ee 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -139,23 +139,39 @@ compute_opts = [ cfg.BoolOpt('instance_usage_audit', default=False, help="Generate periodic compute.instance.exists notifications"), + cfg.IntOpt('bandwidth_poll_interval', + default=600, + help='interval to pull bandwidth usage info'), + cfg.BoolOpt('resume_guests_state_on_host_boot', + default=False, + help='Whether to start guests that were running before the ' + 'host rebooted'), + cfg.BoolOpt('start_guests_on_host_boot', + default=False, + help='Whether to restart guests when the host reboots'), + cfg.StrOpt('default_access_ip_network_name', + default=None, + help='Name of network to use to set access ips for instances'), + cfg.BoolOpt('defer_iptables_apply', + default=False, + help='Whether to batch up the application of IPTables rules' + ' during a host restart and apply all at the end of the' + ' init phase'), + cfg.IntOpt('reclaim_instance_interval', + default=0, + help='Interval in seconds for reclaiming deleted instances'), ] CONF = cfg.CONF CONF.register_opts(compute_opts) -CONF.import_opt('allow_resize_to_same_host', 'nova.config') -CONF.import_opt('bandwidth_poll_interval', 'nova.config') +CONF.import_opt('allow_resize_to_same_host', 'nova.compute.api') CONF.import_opt('compute_driver', 'nova.config') CONF.import_opt('console_topic', 'nova.config') -CONF.import_opt('default_access_ip_network_name', 'nova.config') -CONF.import_opt('defer_iptables_apply', 'nova.config') CONF.import_opt('host', 'nova.config') CONF.import_opt('my_ip', 'nova.config') CONF.import_opt('network_manager', 'nova.config') CONF.import_opt('password_length', 'nova.config') CONF.import_opt('reclaim_instance_interval', 'nova.config') -CONF.import_opt('resume_guests_state_on_host_boot', 'nova.config') -CONF.import_opt('start_guests_on_host_boot', 'nova.config') CONF.import_opt('vpn_image_id', 'nova.config') CONF.import_opt('my_ip', 'nova.config') CONF.import_opt('state_path', 'nova.config') -- cgit