diff options
| author | Mark McLoughlin <markmc@redhat.com> | 2012-01-23 11:51:14 +0000 |
|---|---|---|
| committer | Mark McLoughlin <markmc@redhat.com> | 2012-01-28 12:37:16 +0000 |
| commit | 82049af90e86380043c59741fa4e1cd2cf24aaa7 (patch) | |
| tree | fd5a35b7a373de888ece003929f8c499b34ce83c /bin | |
| parent | 02b872625b94c3c63674d8c64b23f80215b04a15 (diff) | |
| download | nova-82049af90e86380043c59741fa4e1cd2cf24aaa7.tar.gz nova-82049af90e86380043c59741fa4e1cd2cf24aaa7.tar.xz nova-82049af90e86380043c59741fa4e1cd2cf24aaa7.zip | |
Refactor away the flags.DEFINE_* helpers
The next obvious step in porting to cfg is to define all options using
cfg schemas directly rather than using the flags.DEFINE_* helpers.
This is a large change, but it is almost entirely pure refactoring and
does not result in any functional changes.
The only change to note is that the default values for glance_host,
glance_api_servers and default_publisher_id options are now using opt
value interpolation i.e.
-glance_host=_get_my_ip()
+glance_host='$my_ip'
-glance_api_servers=['%s:%d' % (FLAGS.glance_host, FLAGS.glance_port)]
+glance_api_servers=['$glance_host:$glance_port']
-default_publisher_id=FLAGS.host
+default_publisher_id='$host'
Also note that the lower_bound check on the {report,periodic}_interval
options are no more, but this has been true since cfg was first added.
Change-Id: Ia58c8f0aaf61628bb55b1b8485118a2a9852ed17
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/clear_rabbit_queues | 8 | ||||
| -rwxr-xr-x | bin/nova-ajax-console-proxy | 10 | ||||
| -rwxr-xr-x | bin/nova-direct-api | 13 |
3 files changed, 26 insertions, 5 deletions
diff --git a/bin/clear_rabbit_queues b/bin/clear_rabbit_queues index 7a000e5d8..f697ef6b4 100755 --- a/bin/clear_rabbit_queues +++ b/bin/clear_rabbit_queues @@ -40,6 +40,7 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'nova', '__init__.py')): gettext.install('nova', unicode=1) +from nova.common import cfg from nova import context from nova import exception from nova import flags @@ -48,8 +49,13 @@ from nova import rpc from nova import utils +delete_exchange_opt = \ + cfg.BoolOpt('delete_exchange', + default=False, + help='delete nova exchange too.') + FLAGS = flags.FLAGS -flags.DEFINE_boolean('delete_exchange', False, 'delete nova exchange too.') +FLAGS.add_option(delete_exchange_opt) def delete_exchange(exch): diff --git a/bin/nova-ajax-console-proxy b/bin/nova-ajax-console-proxy index a6b284987..7dd5266a7 100755 --- a/bin/nova-ajax-console-proxy +++ b/bin/nova-ajax-console-proxy @@ -38,6 +38,7 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +from nova.common import cfg from nova import flags from nova import log as logging from nova import rpc @@ -45,9 +46,14 @@ from nova import service from nova import utils from nova import wsgi + +ajax_console_idle_timeout_opt = \ + cfg.IntOpt('ajax_console_idle_timeout', + default=300, + help='Seconds before idle connection destroyed') + FLAGS = flags.FLAGS -flags.DEFINE_integer('ajax_console_idle_timeout', 300, - 'Seconds before idle connection destroyed') +FLAGS.add_option(ajax_console_idle_timeout_opt) LOG = logging.getLogger('nova.ajax_console_proxy') diff --git a/bin/nova-direct-api b/bin/nova-direct-api index 28cc29634..f77311914 100755 --- a/bin/nova-direct-api +++ b/bin/nova-direct-api @@ -35,6 +35,7 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +from nova.common import cfg from nova import compute from nova import flags from nova import log as logging @@ -46,9 +47,17 @@ from nova import wsgi from nova.api import direct +direct_api_opts = [ + cfg.IntOpt('direct_port', + default=8001, + help='Direct API port'), + cfg.StrOpt('direct_host', + default='0.0.0.0', + help='Direct API host'), + ] + FLAGS = flags.FLAGS -flags.DEFINE_integer('direct_port', 8001, 'Direct API port') -flags.DEFINE_string('direct_host', '0.0.0.0', 'Direct API host') +FLAGS.add_options(direct_api_opts) # An example of an API that only exposes read-only methods. |
