diff --git a/nova/api/opts.py b/nova/api/opts.py index 3d4cfcf51d18..a1db655a1c52 100644 --- a/nova/api/opts.py +++ b/nova/api/opts.py @@ -106,7 +106,6 @@ import nova.scheduler.weights.metrics import nova.scheduler.weights.ram import nova.service import nova.servicegroup.api -import nova.spice import nova.utils import nova.vnc import nova.vnc.xvp_proxy diff --git a/nova/cmd/spicehtml5proxy.py b/nova/cmd/spicehtml5proxy.py index f6695dcf2870..1365215be5d8 100644 --- a/nova/cmd/spicehtml5proxy.py +++ b/nova/cmd/spicehtml5proxy.py @@ -20,25 +20,14 @@ SPICE HTML5 consoles. Leverages websockify.py by Joel Martin import sys -from oslo_config import cfg - from nova.cmd import baseproxy +import nova.conf +from nova.conf import spice from nova import config -opts = [ - cfg.StrOpt('html5proxy_host', - default='0.0.0.0', - help='Host on which to listen for incoming requests'), - cfg.IntOpt('html5proxy_port', - default=6082, - min=1, - max=65535, - help='Port on which to listen for incoming requests'), - ] - -CONF = cfg.CONF -CONF.register_cli_opts(opts, group='spice') +CONF = nova.conf.CONF +spice.register_cli_opts(CONF) def main(): diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 9e726efd8c39..8a6511c6db75 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -265,7 +265,6 @@ CONF.register_opts(timeout_opts) CONF.register_opts(running_deleted_opts) CONF.register_opts(instance_cleaning_opts) CONF.import_opt('host', 'nova.netconf') -CONF.import_opt('enabled', 'nova.spice', group='spice') LOG = logging.getLogger(__name__) diff --git a/nova/conf/__init__.py b/nova/conf/__init__.py index ec5beba37fae..3b04562a664c 100644 --- a/nova/conf/__init__.py +++ b/nova/conf/__init__.py @@ -71,7 +71,7 @@ from nova.conf import scheduler # from nova.conf import security from nova.conf import serial_console from nova.conf import service -# from nova.conf import spice +from nova.conf import spice # from nova.conf import ssl # from nova.conf import trusted_computing from nova.conf import upgrade_levels @@ -138,7 +138,7 @@ scheduler.register_opts(CONF) # security.register_opts(CONF) serial_console.register_opts(CONF) service.register_opts(CONF) -# spice.register_opts(CONF) +spice.register_opts(CONF) # ssl.register_opts(CONF) # trusted_computing.register_opts(CONF) upgrade_levels.register_opts(CONF) diff --git a/nova/conf/spice.py b/nova/conf/spice.py new file mode 100644 index 000000000000..6dcf29545bfb --- /dev/null +++ b/nova/conf/spice.py @@ -0,0 +1,104 @@ +# Copyright 2016 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 + +GROUP_NAME = 'spice' +spice_opt_group = cfg.OptGroup(GROUP_NAME) + + +enabled_opt = cfg.BoolOpt('enabled', + default=False, + help=""" +Enable spice related features. +""") + + +agent_enabled_opt = cfg.BoolOpt('agent_enabled', + default=True, + help=""" +Enable the spice guest agent support. +""") + + +html5proxy_base_url_opt = cfg.StrOpt('html5proxy_base_url', + default='http://127.0.0.1:6082/spice_auto.html', + help=""" +Location of spice HTML5 console proxy, in the form +"http://127.0.0.1:6082/spice_auto.html" +""") + + +html5proxy_host_opt = cfg.StrOpt('html5proxy_host', + default='0.0.0.0', + help=""" +Host on which to listen for incoming requests +""") + + +html5proxy_port_opt = cfg.IntOpt('html5proxy_port', + default=6082, + min=1, + max=65535, + help=""" +Port on which to listen for incoming requests +""") + + +server_listen_opt = cfg.StrOpt('server_listen', + default='127.0.0.1', + help=""" +IP address on which instance spice server should listen +""") + + +server_proxyclient_address_opt = cfg.StrOpt('server_proxyclient_address', + default='127.0.0.1', + help=""" +The address to which proxy clients (like nova-spicehtml5proxy) should connect +""") + + +keymap_opt = cfg.StrOpt('keymap', + default='en-us', + help=""" +Keymap for spice +""") + + +ALL_OPTS = [html5proxy_base_url_opt, + server_listen_opt, + server_proxyclient_address_opt, + enabled_opt, + agent_enabled_opt, + keymap_opt, + html5proxy_host_opt, + html5proxy_port_opt] + + +CLI_OPTS = [html5proxy_host_opt, + html5proxy_port_opt] + + +def register_opts(conf): + conf.register_opts(ALL_OPTS, group=spice_opt_group) + + +def register_cli_opts(conf): + conf.register_cli_opts(CLI_OPTS, group=spice_opt_group) + + +def list_opts(): + return {spice_opt_group: ALL_OPTS} diff --git a/nova/opts.py b/nova/opts.py index 9892fe63354a..9a3f349aadf8 100644 --- a/nova/opts.py +++ b/nova/opts.py @@ -30,7 +30,6 @@ import nova.image.download.file import nova.netconf import nova.paths import nova.servicegroup.api -import nova.spice import nova.volume import nova.volume.cinder @@ -52,9 +51,4 @@ def list_opts(): ('cinder', nova.volume.cinder.cinder_opts), ('api_database', nova.db.sqlalchemy.api.api_db_opts), ('database', nova.db.sqlalchemy.api.oslo_db_options.database_opts), - ('spice', - itertools.chain( - nova.cmd.spicehtml5proxy.opts, - nova.spice.spice_opts, - )) ] diff --git a/nova/spice/__init__.py b/nova/spice/__init__.py deleted file mode 100644 index 4efb6d3b9f20..000000000000 --- a/nova/spice/__init__.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2012 Red Hat, Inc. -# -# 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 SPICE Proxying.""" - -from oslo_config import cfg - - -spice_opts = [ - cfg.StrOpt('html5proxy_base_url', - default='http://127.0.0.1:6082/spice_auto.html', - help='Location of spice HTML5 console proxy, in the form ' - '"http://127.0.0.1:6082/spice_auto.html"'), - cfg.StrOpt('server_listen', - default='127.0.0.1', - help='IP address on which instance spice server should listen'), - cfg.StrOpt('server_proxyclient_address', - default='127.0.0.1', - help='The address to which proxy clients ' - '(like nova-spicehtml5proxy) should connect'), - cfg.BoolOpt('enabled', - default=False, - help='Enable spice related features'), - cfg.BoolOpt('agent_enabled', - default=True, - help='Enable spice guest agent support'), - cfg.StrOpt('keymap', - default='en-us', - help='Keymap for spice'), - ] - -CONF = cfg.CONF -CONF.register_opts(spice_opts, group='spice') diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 461efa22fc72..b695111024f2 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -315,7 +315,6 @@ CONF.register_opts(libvirt_opts, 'libvirt') CONF.import_opt('host', 'nova.netconf') CONF.import_opt('my_ip', 'nova.netconf') CONF.import_opt('live_migration_retry_count', 'nova.compute.manager') -CONF.import_opt('server_proxyclient_address', 'nova.spice', group='spice') CONF.import_opt('hw_disk_discard', 'nova.virt.libvirt.imagebackend', group='libvirt') CONF.import_opt('iscsi_use_multipath', 'nova.virt.libvirt.volume.iscsi',