diff --git a/nova/cmd/novncproxy.py b/nova/cmd/novncproxy.py index 4cae89171ba2..30f7308c45fb 100644 --- a/nova/cmd/novncproxy.py +++ b/nova/cmd/novncproxy.py @@ -20,27 +20,13 @@ noVNC consoles. Leverages websockify.py by Joel Martin import sys -from oslo_config import cfg from nova.cmd import baseproxy +import nova.conf from nova import config -opts = [ - cfg.StrOpt('novncproxy_host', - default='0.0.0.0', - help='Host on which to listen for incoming requests', - deprecated_group='DEFAULT'), - cfg.IntOpt('novncproxy_port', - default=6080, - min=1, - max=65535, - help='Port on which to listen for incoming requests', - deprecated_group='DEFAULT'), - ] - -CONF = cfg.CONF -CONF.register_cli_opts(opts, 'vnc') +CONF = nova.conf.CONF def main(): diff --git a/nova/conf/__init__.py b/nova/conf/__init__.py index c02abb9a3424..3a1eb4e9e36d 100644 --- a/nova/conf/__init__.py +++ b/nova/conf/__init__.py @@ -69,7 +69,7 @@ from nova.conf import serial_console # from nova.conf import upgrade_levels from nova.conf import virt # from nova.conf import vmware -# from nova.conf import vnc +from nova.conf import vnc # from nova.conf import volume # from nova.conf import workarounds # from nova.conf import wsgi @@ -129,7 +129,7 @@ serial_console.register_opts(CONF) # upgrade_levels.register_opts(CONF) virt.register_opts(CONF) # vmware.register_opts(CONF) -# vnc.register_opts(CONF) +vnc.register_opts(CONF) # volume.register_opts(CONF) # workarounds.register_opts(CONF) # wsgi.register_opts(CONF) diff --git a/nova/conf/vnc.py b/nova/conf/vnc.py new file mode 100644 index 000000000000..3c5b5c64bc65 --- /dev/null +++ b/nova/conf/vnc.py @@ -0,0 +1,118 @@ +# Copyright (c) 2010 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 + +vnc_group = cfg.OptGroup( + 'vnc', + title='VNC options') + +enabled = cfg.BoolOpt( + 'enabled', + default=True, + help='Enable VNC related features', + deprecated_group='DEFAULT', + deprecated_name='vnc_enabled') + +keymap = cfg.StrOpt( + 'keymap', + default='en-us', + help='Keymap for VNC', + deprecated_group='DEFAULT', + deprecated_name='vnc_keymap') + +vncserver_listen = cfg.StrOpt( + 'vncserver_listen', + default='127.0.0.1', + help='IP address on which instance vncservers should listen', + deprecated_group='DEFAULT') + +vncserver_proxyclient_address = cfg.StrOpt( + 'vncserver_proxyclient_address', + default='127.0.0.1', + help='The address to which proxy clients ' + '(like nova-xvpvncproxy) should connect', + deprecated_group='DEFAULT') + +novncproxy_host = cfg.StrOpt( + 'novncproxy_host', + default='0.0.0.0', + help='Host on which to listen for incoming requests', + deprecated_group='DEFAULT') + +novncproxy_port = cfg.IntOpt( + 'novncproxy_port', + default=6080, + min=1, + max=65535, + help='Port on which to listen for incoming requests', + deprecated_group='DEFAULT') + +xvpvncproxy_host = cfg.StrOpt( + 'xvpvncproxy_host', + default='0.0.0.0', + help='Address that the XVP VNC console proxy should bind to', + deprecated_group='DEFAULT') + +xvpvncproxy_port = cfg.IntOpt( + 'xvpvncproxy_port', + default=6081, + min=1, + max=65535, + help='Port that the XVP VNC console proxy should bind to', + deprecated_group='DEFAULT') + +novncproxy_base_url = 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"', + deprecated_group='DEFAULT') + +xvpvncproxy_base_url = cfg.StrOpt( + 'xvpvncproxy_base_url', + default='http://127.0.0.1:6081/console', + help='Location of XVP VNC console proxy, in the form ' + '"http://127.0.0.1:6081/console"', + deprecated_group='DEFAULT') + +ALL_OPTS = [ + enabled, + keymap, + vncserver_listen, + vncserver_proxyclient_address, + novncproxy_host, + novncproxy_port, + xvpvncproxy_host, + xvpvncproxy_port, + novncproxy_base_url, + xvpvncproxy_base_url] + +CLI_OPTS = [ + novncproxy_host, + novncproxy_port] + + +def register_opts(conf): + conf.register_group(vnc_group) + conf.register_opts(ALL_OPTS, group=vnc_group) + + +def register_cli_opts(conf): + conf.register_cli_opts(CLI_OPTS, group=vnc_group) + + +def list_opts(): + return {vnc_group: ALL_OPTS} diff --git a/nova/opts.py b/nova/opts.py index e901ee8dad2f..43e1dfba227d 100644 --- a/nova/opts.py +++ b/nova/opts.py @@ -16,7 +16,6 @@ import nova.availability_zones import nova.baserpc import nova.cloudpipe.pipelib import nova.cmd.novnc -import nova.cmd.novncproxy import nova.cmd.serialproxy import nova.cmd.spicehtml5proxy import nova.conductor.api @@ -52,8 +51,6 @@ import nova.servicegroup.api import nova.servicegroup.drivers.zk import nova.spice import nova.utils -import nova.vnc -import nova.vnc.xvp_proxy import nova.volume import nova.volume.cinder import nova.wsgi @@ -71,7 +68,6 @@ def list_opts(): nova.availability_zones.availability_zone_opts, nova.cloudpipe.pipelib.cloudpipe_opts, nova.cmd.novnc.opts, - nova.cmd.novncproxy.opts, nova.cmd.spicehtml5proxy.opts, nova.console.manager.console_manager_opts, nova.console.rpcapi.rpcapi_opts, @@ -117,11 +113,6 @@ def list_opts(): [nova.console.rpcapi.rpcapi_cap_opt], [nova.consoleauth.rpcapi.rpcapi_cap_opt], )), - ('vnc', - itertools.chain( - nova.vnc.vnc_opts, - nova.vnc.xvp_proxy.xvp_proxy_opts, - )), ('workarounds', nova.utils.workarounds_opts), ('zookeeper', nova.servicegroup.drivers.zk.zk_driver_opts) ] diff --git a/nova/vnc/__init__.py b/nova/vnc/__init__.py index 1c7745867b6e..e69de29bb2d1 100644 --- a/nova/vnc/__init__.py +++ b/nova/vnc/__init__.py @@ -1,59 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2010 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. - -"""Module for VNC Proxying.""" - -from oslo_config import cfg - - -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"', - deprecated_group='DEFAULT', - deprecated_name='novncproxy_base_url'), - 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"', - deprecated_group='DEFAULT', - deprecated_name='xvpvncproxy_base_url'), - cfg.StrOpt('vncserver_listen', - default='127.0.0.1', - help='IP address on which instance vncservers should listen', - deprecated_group='DEFAULT', - deprecated_name='vncserver_listen'), - cfg.StrOpt('vncserver_proxyclient_address', - default='127.0.0.1', - help='The address to which proxy clients ' - '(like nova-xvpvncproxy) should connect', - deprecated_group='DEFAULT', - deprecated_name='vncserver_proxyclient_address'), - cfg.BoolOpt('enabled', - default=True, - help='Enable VNC related features', - deprecated_group='DEFAULT', - deprecated_name='vnc_enabled'), - cfg.StrOpt('keymap', - default='en-us', - help='Keymap for VNC', - deprecated_group='DEFAULT', - deprecated_name='vnc_keymap'), - ] - -CONF = cfg.CONF -CONF.register_opts(vnc_opts, group='vnc') diff --git a/nova/vnc/xvp_proxy.py b/nova/vnc/xvp_proxy.py index 4b6014340df0..06929d8fa151 100644 --- a/nova/vnc/xvp_proxy.py +++ b/nova/vnc/xvp_proxy.py @@ -22,10 +22,10 @@ import eventlet import eventlet.green import eventlet.greenio import eventlet.wsgi -from oslo_config import cfg from oslo_log import log as logging import webob +import nova.conf from nova.consoleauth import rpcapi as consoleauth_rpcapi from nova import context from nova.i18n import _LI @@ -35,22 +35,7 @@ from nova import wsgi LOG = logging.getLogger(__name__) - -xvp_proxy_opts = [ - cfg.IntOpt('xvpvncproxy_port', - default=6081, - min=1, - max=65535, - help='Port that the XCP VNC proxy should bind to', - deprecated_group='DEFAULT'), - cfg.StrOpt('xvpvncproxy_host', - default='0.0.0.0', - help='Address that the XCP VNC proxy should bind to', - deprecated_group='DEFAULT'), - ] - -CONF = cfg.CONF -CONF.register_opts(xvp_proxy_opts, group='vnc') +CONF = nova.conf.CONF class XCPVNCProxy(object):