conf: move few console opts to xenserver group
console_allowed_origins and console_public_hostname are specific to XenServer deployments, so moving them to xenserver group. Leaving the rest as they are or will be deprecated. Implements: bp centralize-config-options-ocata Co-Authored-By: Sarafraj Singh <sarafraj.singh@intel.com> Change-Id: I154f18ab2943465db5e3e9fcee06f2a7269df898
This commit is contained in:
parent
668f2f9631
commit
ffcdb42ba1
nova
conf
console
tests
releasenotes/notes
@ -13,12 +13,31 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import socket
|
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
console_group = cfg.OptGroup('console',
|
||||||
|
title='Console Options',
|
||||||
|
help="""
|
||||||
|
Options under this group allow to tune the configuration of the console proxy
|
||||||
|
service.
|
||||||
|
|
||||||
console_opts = [
|
Note: in configuration of every compute is a ``console_host`` option,
|
||||||
|
which allows to select the console proxy service to connect to.
|
||||||
|
""")
|
||||||
|
|
||||||
|
default_opts = [
|
||||||
|
# TODO(raj_singh): Deprecate this option
|
||||||
|
cfg.StrOpt('console_driver',
|
||||||
|
default='nova.console.xvp.XVPConsoleProxy',
|
||||||
|
help="""
|
||||||
|
Nova-console proxy is used to set up multi-tenant VM console access.
|
||||||
|
This option allows pluggable driver program for the console session
|
||||||
|
and represents driver to use for the console proxy.
|
||||||
|
|
||||||
|
Possible values:
|
||||||
|
|
||||||
|
* A string representing fully classified class name of console driver.
|
||||||
|
"""),
|
||||||
cfg.StrOpt('console_topic',
|
cfg.StrOpt('console_topic',
|
||||||
default='console',
|
default='console',
|
||||||
deprecated_for_removal=True,
|
deprecated_for_removal=True,
|
||||||
@ -37,21 +56,14 @@ host.
|
|||||||
Possible values:
|
Possible values:
|
||||||
|
|
||||||
* A string representing topic exchange name
|
* A string representing topic exchange name
|
||||||
"""),
|
""")
|
||||||
# TODO(pumaranikar): Move this config to stevedore plugin system.
|
]
|
||||||
cfg.StrOpt('console_driver',
|
|
||||||
default='nova.console.xvp.XVPConsoleProxy',
|
|
||||||
help="""
|
|
||||||
Nova-console proxy is used to set up multi-tenant VM console access.
|
|
||||||
This option allows pluggable driver program for the console session
|
|
||||||
and represents driver to use for the console proxy.
|
|
||||||
|
|
||||||
Possible values:
|
console_opts = [
|
||||||
|
cfg.ListOpt('allowed_origins',
|
||||||
* A string representing fully classified class name of console driver.
|
|
||||||
"""),
|
|
||||||
cfg.ListOpt('console_allowed_origins',
|
|
||||||
default=[],
|
default=[],
|
||||||
|
deprecated_group='default',
|
||||||
|
deprecated_name='console_allowed_origins',
|
||||||
help="""
|
help="""
|
||||||
Adds list of allowed origins to the console websocket proxy to allow
|
Adds list of allowed origins to the console websocket proxy to allow
|
||||||
connections from other origin hostnames.
|
connections from other origin hostnames.
|
||||||
@ -62,25 +74,18 @@ values other than host are allowed in the origin header.
|
|||||||
Possible values:
|
Possible values:
|
||||||
|
|
||||||
* A list where each element is an allowed origin hostnames, else an empty list
|
* A list where each element is an allowed origin hostnames, else an empty list
|
||||||
"""),
|
|
||||||
# TODO(sfinucan): Convert this to URIOpt
|
|
||||||
cfg.StrOpt('console_public_hostname',
|
|
||||||
default=socket.gethostname(),
|
|
||||||
help="""
|
|
||||||
Publicly visible name for this console host.
|
|
||||||
|
|
||||||
Possible values:
|
|
||||||
|
|
||||||
* A string representing a valid hostname
|
|
||||||
"""),
|
"""),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def register_opts(conf):
|
def register_opts(conf):
|
||||||
conf.register_opts(console_opts)
|
conf.register_group(console_group)
|
||||||
|
conf.register_opts(console_opts, group=console_group)
|
||||||
|
conf.register_opts(default_opts)
|
||||||
|
|
||||||
|
|
||||||
# TODO(pumaranikar): We can consider moving these options to console group
|
|
||||||
# and renaming them all to drop console bit.
|
|
||||||
def list_opts():
|
def list_opts():
|
||||||
return {"DEFAULT": console_opts}
|
return {
|
||||||
|
console_group: console_opts,
|
||||||
|
'DEFAULT': default_opts,
|
||||||
|
}
|
||||||
|
@ -13,8 +13,10 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
|
import socket
|
||||||
|
|
||||||
xenserver_group = cfg.OptGroup('xenserver',
|
xenserver_group = cfg.OptGroup('xenserver',
|
||||||
title='Xenserver Options',
|
title='Xenserver Options',
|
||||||
@ -585,6 +587,18 @@ that adding new host will fail, thus option to force join was introduced.
|
|||||||
"""),
|
"""),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
xenapi_console_opts = [
|
||||||
|
cfg.StrOpt('console_public_hostname',
|
||||||
|
default=socket.gethostname(),
|
||||||
|
deprecated_group='DEFAULT',
|
||||||
|
help="""
|
||||||
|
Publicly visible name for this console host.
|
||||||
|
|
||||||
|
Possible values:
|
||||||
|
|
||||||
|
* A string representing a valid hostname
|
||||||
|
"""),
|
||||||
|
]
|
||||||
|
|
||||||
ALL_XENSERVER_OPTS = (xenapi_agent_opts +
|
ALL_XENSERVER_OPTS = (xenapi_agent_opts +
|
||||||
xenapi_session_opts +
|
xenapi_session_opts +
|
||||||
@ -594,7 +608,8 @@ ALL_XENSERVER_OPTS = (xenapi_agent_opts +
|
|||||||
xenapi_vmops_opts +
|
xenapi_vmops_opts +
|
||||||
xenapi_volume_utils_opts +
|
xenapi_volume_utils_opts +
|
||||||
xenapi_ovs_integration_bridge_opts +
|
xenapi_ovs_integration_bridge_opts +
|
||||||
xenapi_pool_opts)
|
xenapi_pool_opts +
|
||||||
|
xenapi_console_opts)
|
||||||
|
|
||||||
|
|
||||||
def register_opts(conf):
|
def register_opts(conf):
|
||||||
|
@ -110,7 +110,8 @@ class ConsoleProxyManager(manager.Manager):
|
|||||||
pool_info['password'] = self.driver.fix_pool_password(
|
pool_info['password'] = self.driver.fix_pool_password(
|
||||||
pool_info['password'])
|
pool_info['password'])
|
||||||
pool_info['host'] = self.host
|
pool_info['host'] = self.host
|
||||||
pool_info['public_hostname'] = CONF.console_public_hostname
|
pool_info['public_hostname'] = \
|
||||||
|
CONF.xenserver.console_public_hostname
|
||||||
pool_info['console_type'] = self.driver.console_type
|
pool_info['console_type'] = self.driver.console_type
|
||||||
pool_info['compute_host'] = instance_host
|
pool_info['compute_host'] = instance_host
|
||||||
pool = self.db.console_pool_create(context, pool_info)
|
pool = self.db.console_pool_create(context, pool_info)
|
||||||
|
@ -116,7 +116,7 @@ class NovaProxyRequestHandlerBase(object):
|
|||||||
expected_origin_hostname = e.split(']')[0][1:]
|
expected_origin_hostname = e.split(']')[0][1:]
|
||||||
else:
|
else:
|
||||||
expected_origin_hostname = e.split(':')[0]
|
expected_origin_hostname = e.split(':')[0]
|
||||||
expected_origin_hostnames = CONF.console_allowed_origins
|
expected_origin_hostnames = CONF.console.allowed_origins
|
||||||
expected_origin_hostnames.append(expected_origin_hostname)
|
expected_origin_hostnames.append(expected_origin_hostname)
|
||||||
origin_url = self.headers.getheader('Origin')
|
origin_url = self.headers.getheader('Origin')
|
||||||
# missing origin header indicates non-browser client which is OK
|
# missing origin header indicates non-browser client which is OK
|
||||||
|
@ -22,7 +22,7 @@ class ConsolesSamplesJsonTest(test_servers.ServersSampleBase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ConsolesSamplesJsonTest, self).setUp()
|
super(ConsolesSamplesJsonTest, self).setUp()
|
||||||
self.flags(console_public_hostname='fake')
|
self.flags(console_public_hostname='fake', group='xenserver')
|
||||||
self.flags(console_host='fake')
|
self.flags(console_host='fake')
|
||||||
self.flags(console_driver='nova.console.fake.FakeConsoleProxy')
|
self.flags(console_driver='nova.console.fake.FakeConsoleProxy')
|
||||||
self.console = self.start_service('console', host='fake')
|
self.console = self.start_service('console', host='fake')
|
||||||
|
@ -27,8 +27,9 @@ class NovaProxyRequestHandlerBaseTestCase(test.NoDBTestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(NovaProxyRequestHandlerBaseTestCase, self).setUp()
|
super(NovaProxyRequestHandlerBaseTestCase, self).setUp()
|
||||||
|
|
||||||
self.flags(console_allowed_origins = ['allowed-origin-example-1.net',
|
self.flags(allowed_origins=['allowed-origin-example-1.net',
|
||||||
'allowed-origin-example-2.net'])
|
'allowed-origin-example-2.net'],
|
||||||
|
group='console')
|
||||||
self.wh = websocketproxy.NovaProxyRequestHandlerBase()
|
self.wh = websocketproxy.NovaProxyRequestHandlerBase()
|
||||||
self.wh.socket = mock.MagicMock()
|
self.wh.socket = mock.MagicMock()
|
||||||
self.wh.msg = mock.MagicMock()
|
self.wh.msg = mock.MagicMock()
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
``console_public_hostname`` console options under the ``DEFAULT`` group
|
||||||
|
have been moved to the ``xenserver`` group.
|
Loading…
x
Reference in New Issue
Block a user