From 510ebb07909e13a700377cdd4902b9670a67a86e Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Sun, 4 Nov 2012 21:32:45 +0000 Subject: [PATCH] Switch from FLAGS to CONF in misc modules Use the global CONF variable instead of FLAGS. This is purely a cleanup since FLAGS is already just another reference to CONF. We leave the nova.flags imports until a later cleanup commit since removing them may cause unpredictable problems due to config options not being registered. Change-Id: Ib110ba8d1837780e90b0d3fe13f8e6b68ed15f65 --- nova/common/eventlet_backdoor.py | 9 +++++---- nova/flags.py | 11 ++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/nova/common/eventlet_backdoor.py b/nova/common/eventlet_backdoor.py index f8fccf26..4620d76a 100644 --- a/nova/common/eventlet_backdoor.py +++ b/nova/common/eventlet_backdoor.py @@ -25,6 +25,7 @@ import eventlet import eventlet.backdoor import greenlet +from nova import config from nova import flags from nova.openstack.common import cfg @@ -34,8 +35,8 @@ eventlet_backdoor_opts = [ help='port for eventlet backdoor to listen') ] -FLAGS = flags.FLAGS -FLAGS.register_opts(eventlet_backdoor_opts) +CONF = config.CONF +CONF.register_opts(eventlet_backdoor_opts) def dont_use_this(): @@ -62,7 +63,7 @@ backdoor_locals = { def initialize_if_enabled(): - if FLAGS.backdoor_port is None: + if CONF.backdoor_port is None: return # NOTE(johannes): The standard sys.displayhook will print the value of @@ -76,5 +77,5 @@ def initialize_if_enabled(): sys.displayhook = displayhook eventlet.spawn(eventlet.backdoor.backdoor_server, - eventlet.listen(('localhost', FLAGS.backdoor_port)), + eventlet.listen(('localhost', CONF.backdoor_port)), locals=backdoor_locals) diff --git a/nova/flags.py b/nova/flags.py index e3a33de1..497d65ca 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -30,10 +30,11 @@ import os import socket import sys +from nova import config from nova.openstack.common import cfg - -FLAGS = cfg.CONF +CONF = config.CONF +FLAGS = CONF def _get_my_ip(): @@ -88,8 +89,8 @@ debug_opts = [ help='Add python stack traces to SQL as comment strings'), ] -FLAGS.register_cli_opts(core_opts) -FLAGS.register_cli_opts(debug_opts) +CONF.register_cli_opts(core_opts) +CONF.register_cli_opts(debug_opts) global_opts = [ cfg.StrOpt('my_ip', @@ -376,4 +377,4 @@ global_opts = [ 'vmwareapi.VMWareESXDriver'), ] -FLAGS.register_opts(global_opts) +CONF.register_opts(global_opts)