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 /nova/vnc | |
| 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 'nova/vnc')
| -rw-r--r-- | nova/vnc/__init__.py | 44 | ||||
| -rw-r--r-- | nova/vnc/xvp_proxy.py | 16 |
2 files changed, 38 insertions, 22 deletions
diff --git a/nova/vnc/__init__.py b/nova/vnc/__init__.py index 03cb75639..0b2581203 100644 --- a/nova/vnc/__init__.py +++ b/nova/vnc/__init__.py @@ -18,25 +18,33 @@ """Module for VNC Proxying.""" +from nova.common import cfg from nova import flags +vnc_opts = [ + cfg.StrOpt('novncproxy_base_url', + default='http://127.0.0.1:6080/vnc_auto.html', + help='location of vnc console proxy, in the form ' + '"http://127.0.0.1:6080/vnc_auto.html"'), + cfg.StrOpt('xvpvncproxy_base_url', + default='http://127.0.0.1:6081/console', + help='location of nova xvp vnc console proxy, in the form ' + '"http://127.0.0.1:6081/console"'), + cfg.StrOpt('vncserver_listen', + default='127.0.0.1', + help='Ip address on which instance vncserversshould listen'), + cfg.StrOpt('vncserver_proxyclient_address', + default='127.0.0.1', + help='the address to which proxy clients ' + '(like nova-xvpvncproxy) should connect'), + cfg.BoolOpt('vnc_enabled', + default=True, + help='enable vnc related features'), + cfg.StrOpt('vnc_keymap', + default='en-us', + help='keymap for vnc'), + ] + FLAGS = flags.FLAGS -flags.DEFINE_string('novncproxy_base_url', - 'http://127.0.0.1:6080/vnc_auto.html', - 'location of vnc console proxy, \ - in the form "http://127.0.0.1:6080/vnc_auto.html"') -flags.DEFINE_string('xvpvncproxy_base_url', - 'http://127.0.0.1:6081/console', - 'location of nova xvp vnc console proxy, \ - in the form "http://127.0.0.1:6081/console"') -flags.DEFINE_string('vncserver_listen', '127.0.0.1', - 'Ip address on which instance vncservers\ - should listen') -flags.DEFINE_string('vncserver_proxyclient_address', '127.0.0.1', - 'the address to which proxy clients \ - (like nova-xvpvncproxy) should connect') -flags.DEFINE_bool('vnc_enabled', True, - 'enable vnc related features') -flags.DEFINE_string('vnc_keymap', 'en-us', - 'keymap for vnc') +FLAGS.add_options(vnc_opts) diff --git a/nova/vnc/xvp_proxy.py b/nova/vnc/xvp_proxy.py index 1bcc83240..bf9ee5975 100644 --- a/nova/vnc/xvp_proxy.py +++ b/nova/vnc/xvp_proxy.py @@ -26,6 +26,7 @@ import eventlet.green import eventlet.greenio import eventlet.wsgi +from nova.common import cfg from nova import context from nova import flags from nova import log as logging @@ -35,13 +36,20 @@ from nova import wsgi LOG = logging.getLogger('nova.xvpvncproxy') + +xvp_proxy_opts = [ + cfg.IntOpt('xvpvncproxy_port', + default=6081, + help='Port that the XCP VNC proxy should bind to'), + cfg.StrOpt('xvpvncproxy_host', + default='0.0.0.0', + help='Address that the XCP VNC proxy should bind to'), + ] + FLAGS = flags.FLAGS +FLAGS.add_options(xvp_proxy_opts) flags.DECLARE('consoleauth_topic', 'nova.consoleauth') -flags.DEFINE_integer('xvpvncproxy_port', 6081, - 'Port that the XCP VNC proxy should bind to') -flags.DEFINE_string('xvpvncproxy_host', '0.0.0.0', - 'Address that the XCP VNC proxy should bind to') class XCPVNCProxy(object): |
