Skip to content

Commit 2398b78

Browse files
committed
Remove nova-consoleauth
Obliterate all references to the aforementioned service. This mostly consists of removing the core service and any references to the now removed '[workarounds] enable_consoleauth' configuration option. Part of blueprint remove-consoleauth Change-Id: I0498599fd636aa9e30df932f0d893db5efa23260 Signed-off-by: Stephen Finucane <[email protected]> Depends-On: Icfc175c49a1fc650d1c9ad06b77209a70c6386db
1 parent bedaeab commit 2398b78

24 files changed

+61
-1081
lines changed

nova/api/openstack/compute/console_auth_tokens.py

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
from nova.api.openstack import wsgi
1919
import nova.conf
20-
from nova.consoleauth import rpcapi as consoleauth_rpcapi
2120
from nova import context as nova_context
2221
from nova.i18n import _
2322
from nova import objects
@@ -27,9 +26,6 @@
2726

2827

2928
class ConsoleAuthTokensController(wsgi.Controller):
30-
def __init__(self):
31-
super(ConsoleAuthTokensController, self).__init__()
32-
self._consoleauth_rpcapi = consoleauth_rpcapi.ConsoleAuthAPI()
3329

3430
def _show(self, req, id, rdp_only):
3531
"""Checks a console auth token and returns the related connect info."""
@@ -42,21 +38,19 @@ def _show(self, req, id, rdp_only):
4238
raise webob.exc.HTTPBadRequest(explanation=msg)
4339

4440
connect_info = None
45-
if CONF.workarounds.enable_consoleauth:
46-
connect_info = self._consoleauth_rpcapi.check_token(context, token)
47-
else:
48-
results = nova_context.scatter_gather_skip_cell0(
49-
context, objects.ConsoleAuthToken.validate, token)
50-
# NOTE(melwitt): Console token auths are stored in cell databases,
51-
# but with only the token as a request param, we can't know which
52-
# cell database contains the token's corresponding connection info.
53-
# So, we must query all cells for the info and we can break the
54-
# loop as soon as we find a result because the token is associated
55-
# with one instance, which can only be in one cell.
56-
for result in results.values():
57-
if not nova_context.is_cell_failure_sentinel(result):
58-
connect_info = result.to_dict()
59-
break
41+
42+
results = nova_context.scatter_gather_skip_cell0(
43+
context, objects.ConsoleAuthToken.validate, token)
44+
# NOTE(melwitt): Console token auths are stored in cell databases,
45+
# but with only the token as a request param, we can't know which
46+
# cell database contains the token's corresponding connection info.
47+
# So, we must query all cells for the info and we can break the
48+
# loop as soon as we find a result because the token is associated
49+
# with one instance, which can only be in one cell.
50+
for result in results.values():
51+
if not nova_context.is_cell_failure_sentinel(result):
52+
connect_info = result.to_dict()
53+
break
6054

6155
if not connect_info:
6256
raise webob.exc.HTTPNotFound(explanation=_("Token not found"))

nova/api/openstack/compute/hosts.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ def index(self, req):
5353
| {'host_name': 'some.celly.host.name',
5454
| 'service': 'cells',
5555
| 'zone': 'internal'},
56-
| {'host_name': 'console1.host.com',
57-
| 'service': 'consoleauth',
58-
| 'zone': 'internal'},
5956
| {'host_name': 'network1.host.com',
6057
| 'service': 'network',
6158
| 'zone': 'internal'},

nova/cmd/consoleauth.py

Lines changed: 0 additions & 50 deletions
This file was deleted.

nova/compute/api.py

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
from nova.compute import vm_states
5252
from nova import conductor
5353
import nova.conf
54-
from nova.consoleauth import rpcapi as consoleauth_rpcapi
5554
from nova import context as nova_context
5655
from nova import crypto
5756
from nova.db import base
@@ -259,7 +258,6 @@ def __init__(self, image_api=None, network_api=None, volume_api=None,
259258
self._placementclient = None # Lazy-load on first access.
260259
self.security_group_api = (security_group_api or
261260
openstack_driver.get_openstack_security_group_driver())
262-
self.consoleauth_rpcapi = consoleauth_rpcapi.ConsoleAuthAPI()
263261
self.compute_rpcapi = compute_rpcapi.ComputeAPI()
264262
self.compute_task_api = conductor.ComputeTaskAPI()
265263
self.servicegroup_api = servicegroup.API()
@@ -2066,13 +2064,6 @@ def _delete(self, context, instance, delete_type, cb, **instance_attrs):
20662064
instance.progress = 0
20672065
instance.save()
20682066

2069-
if CONF.workarounds.enable_consoleauth:
2070-
# TODO(melwitt): Remove the conditions for running this line
2071-
# with cells v2, when consoleauth is no longer being used by
2072-
# cells v2, in Stein.
2073-
self.consoleauth_rpcapi.delete_tokens_for_instance(
2074-
context, instance.uuid)
2075-
20762067
if not instance.host and not may_have_ports_or_volumes:
20772068
try:
20782069
with compute_utils.notify_about_instance_delete(
@@ -3803,18 +3794,6 @@ def get_vnc_console(self, context, instance, console_type):
38033794
"""Get a url to an instance Console."""
38043795
connect_info = self.compute_rpcapi.get_vnc_console(context,
38053796
instance=instance, console_type=console_type)
3806-
3807-
# TODO(melwitt): In Rocky, the compute manager puts the
3808-
# console authorization in the database in the above method.
3809-
# The following will be removed when everything has been
3810-
# converted to use the database, in Stein.
3811-
if CONF.workarounds.enable_consoleauth:
3812-
self.consoleauth_rpcapi.authorize_console(context,
3813-
connect_info['token'], console_type,
3814-
connect_info['host'], connect_info['port'],
3815-
connect_info['internal_access_path'], instance.uuid,
3816-
access_url=connect_info['access_url'])
3817-
38183797
return {'url': connect_info['access_url']}
38193798

38203799
@check_instance_host
@@ -3824,17 +3803,6 @@ def get_spice_console(self, context, instance, console_type):
38243803
"""Get a url to an instance Console."""
38253804
connect_info = self.compute_rpcapi.get_spice_console(context,
38263805
instance=instance, console_type=console_type)
3827-
# TODO(melwitt): In Rocky, the compute manager puts the
3828-
# console authorization in the database in the above method.
3829-
# The following will be removed when everything has been
3830-
# converted to use the database, in Stein.
3831-
if CONF.workarounds.enable_consoleauth:
3832-
self.consoleauth_rpcapi.authorize_console(context,
3833-
connect_info['token'], console_type,
3834-
connect_info['host'], connect_info['port'],
3835-
connect_info['internal_access_path'], instance.uuid,
3836-
access_url=connect_info['access_url'])
3837-
38383806
return {'url': connect_info['access_url']}
38393807

38403808
@check_instance_host
@@ -3844,17 +3812,6 @@ def get_rdp_console(self, context, instance, console_type):
38443812
"""Get a url to an instance Console."""
38453813
connect_info = self.compute_rpcapi.get_rdp_console(context,
38463814
instance=instance, console_type=console_type)
3847-
# TODO(melwitt): In Rocky, the compute manager puts the
3848-
# console authorization in the database in the above method.
3849-
# The following will be removed when everything has been
3850-
# converted to use the database, in Stein.
3851-
if CONF.workarounds.enable_consoleauth:
3852-
self.consoleauth_rpcapi.authorize_console(context,
3853-
connect_info['token'], console_type,
3854-
connect_info['host'], connect_info['port'],
3855-
connect_info['internal_access_path'], instance.uuid,
3856-
access_url=connect_info['access_url'])
3857-
38583815
return {'url': connect_info['access_url']}
38593816

38603817
@check_instance_host
@@ -3864,17 +3821,6 @@ def get_serial_console(self, context, instance, console_type):
38643821
"""Get a url to a serial console."""
38653822
connect_info = self.compute_rpcapi.get_serial_console(context,
38663823
instance=instance, console_type=console_type)
3867-
3868-
# TODO(melwitt): In Rocky, the compute manager puts the
3869-
# console authorization in the database in the above method.
3870-
# The following will be removed when everything has been
3871-
# converted to use the database, in Stein.
3872-
if CONF.workarounds.enable_consoleauth:
3873-
self.consoleauth_rpcapi.authorize_console(context,
3874-
connect_info['token'], console_type,
3875-
connect_info['host'], connect_info['port'],
3876-
connect_info['internal_access_path'], instance.uuid,
3877-
access_url=connect_info['access_url'])
38783824
return {'url': connect_info['access_url']}
38793825

38803826
@check_instance_host
@@ -3884,16 +3830,6 @@ def get_mks_console(self, context, instance, console_type):
38843830
"""Get a url to a MKS console."""
38853831
connect_info = self.compute_rpcapi.get_mks_console(context,
38863832
instance=instance, console_type=console_type)
3887-
# TODO(melwitt): In Rocky, the compute manager puts the
3888-
# console authorization in the database in the above method.
3889-
# The following will be removed when everything has been
3890-
# converted to use the database, in Stein.
3891-
if CONF.workarounds.enable_consoleauth:
3892-
self.consoleauth_rpcapi.authorize_console(context,
3893-
connect_info['token'], console_type,
3894-
connect_info['host'], connect_info['port'],
3895-
connect_info['internal_access_path'], instance.uuid,
3896-
access_url=connect_info['access_url'])
38973833
return {'url': connect_info['access_url']}
38983834

38993835
@check_instance_host
@@ -4493,15 +4429,6 @@ def live_migrate(self, context, instance, block_migration,
44934429
self._record_action_start(context, instance,
44944430
instance_actions.LIVE_MIGRATION)
44954431

4496-
# TODO(melwitt): In Rocky, we optionally store console authorizations
4497-
# in both the consoleauth service and the database while
4498-
# we convert to using the database. Remove the condition for running
4499-
# this line with cells v2, when consoleauth is no longer being used by
4500-
# cells v2, in Stein.
4501-
if CONF.workarounds.enable_consoleauth:
4502-
self.consoleauth_rpcapi.delete_tokens_for_instance(
4503-
context, instance.uuid)
4504-
45054432
# NOTE(sbauza): Force is a boolean by the new related API version
45064433
if force is False and host_name:
45074434
# Unset the host to make sure we call the scheduler

nova/conf/compute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@
12891289
to register new compute services in disabled state and then enabled them at a
12901290
later point in time. This option only sets this behavior for nova-compute
12911291
services, it does not auto-disable other services like nova-conductor,
1292-
nova-scheduler, nova-consoleauth, or nova-osapi_compute.
1292+
nova-scheduler, or nova-osapi_compute.
12931293
12941294
Possible values:
12951295

nova/conf/consoleauth.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232
A console auth token is used in authorizing console access for a user.
3333
Once the auth token time to live count has elapsed, the token is
3434
considered expired. Expired tokens are then deleted.
35-
36-
Related options:
37-
38-
* ``[workarounds]/enable_consoleauth``
3935
""")
4036
]
4137

nova/conf/upgrade_levels.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,6 @@
108108
109109
Possible values:
110110
111-
* By default send the latest version the client knows about
112-
* A string representing a version number in the format 'N.N';
113-
for example, possible values might be '1.12' or '2.0'.
114-
* An OpenStack release name, in lower case, such as 'mitaka' or
115-
'liberty'.
116-
"""),
117-
cfg.StrOpt('consoleauth',
118-
deprecated_for_removal=True,
119-
deprecated_since='18.0.0',
120-
deprecated_reason="""
121-
The nova-consoleauth service was deprecated in 18.0.0 (Rocky) and will be
122-
removed in an upcoming release.
123-
""",
124-
help="""
125-
Consoleauth RPC API version cap.
126-
127-
Possible values:
128-
129111
* By default send the latest version the client knows about
130112
* A string representing a version number in the format 'N.N';
131113
for example, possible values might be '1.12' or '2.0'.

nova/conf/workarounds.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -154,38 +154,6 @@
154154
compute service to the scheduler service.
155155
"""),
156156

157-
cfg.BoolOpt(
158-
'enable_consoleauth',
159-
default=False,
160-
deprecated_for_removal=True,
161-
deprecated_since="18.0.0",
162-
deprecated_reason="""
163-
This option has been added as deprecated originally because it is used
164-
for avoiding a upgrade issue and it will not be used in the future.
165-
See the help text for more details.
166-
""",
167-
help="""
168-
Enable the consoleauth service to avoid resetting unexpired consoles.
169-
170-
Console token authorizations have moved from the ``nova-consoleauth`` service
171-
to the database, so all new consoles will be supported by the database backend.
172-
With this, consoles that existed before database backend support will be reset.
173-
For most operators, this should be a minimal disruption as the default TTL of a
174-
console token is 10 minutes.
175-
176-
Operators that have much longer token TTL configured or otherwise wish to avoid
177-
immediately resetting all existing consoles can enable this flag to continue
178-
using the ``nova-consoleauth`` service in addition to the database backend.
179-
Once all of the old ``nova-consoleauth`` supported console tokens have expired,
180-
this flag should be disabled. For example, if a deployment has configured a
181-
token TTL of one hour, the operator may disable the flag, one hour after
182-
deploying the new code during an upgrade.
183-
184-
Related options:
185-
186-
* ``[consoleauth]/token_ttl``
187-
"""),
188-
189157
cfg.BoolOpt(
190158
'enable_numa_live_migration',
191159
default=False,

nova/console/websocketproxy.py

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
from nova.compute import rpcapi as compute_rpcapi
3232
import nova.conf
33-
from nova.consoleauth import rpcapi as consoleauth_rpcapi
3433
from nova import context
3534
from nova import exception
3635
from nova.i18n import _
@@ -125,14 +124,8 @@ def _check_console_port(self, ctxt, instance_uuid, port, console_type):
125124
str(port),
126125
console_type)
127126

128-
def _get_connect_info_consoleauth(self, ctxt, token):
129-
# NOTE(PaulMurray) consoleauth check_token() validates the token
130-
# and does an rpc to compute manager to check the console port
131-
# is correct.
132-
rpcapi = consoleauth_rpcapi.ConsoleAuthAPI()
133-
return rpcapi.check_token(ctxt, token=token)
134-
135-
def _get_connect_info_database(self, ctxt, token):
127+
def _get_connect_info(self, ctxt, token):
128+
"""Validate the token and get the connect info."""
136129
# NOTE(PaulMurray) ConsoleAuthToken.validate validates the token.
137130
# We call the compute manager directly to check the console port
138131
# is correct.
@@ -147,25 +140,6 @@ def _get_connect_info_database(self, ctxt, token):
147140

148141
return connect_info
149142

150-
def _get_connect_info(self, ctxt, token):
151-
"""Validate the token and get the connect info."""
152-
connect_info = None
153-
154-
# NOTE(melwitt): If consoleauth is enabled to aid in transitioning
155-
# to the database backend, check it first before falling back to
156-
# the database. Tokens that existed pre-database-backend will
157-
# reside in the consoleauth service storage.
158-
if CONF.workarounds.enable_consoleauth:
159-
connect_info = self._get_connect_info_consoleauth(ctxt, token)
160-
# If consoleauth is enabled to aid in transitioning to the database
161-
# backend and we didn't find a token in the consoleauth service
162-
# storage, check the database for a token because it's probably a
163-
# post-database-backend token, which are stored in the database.
164-
if not connect_info:
165-
connect_info = self._get_connect_info_database(ctxt, token)
166-
167-
return connect_info
168-
169143
def new_websocket_client(self):
170144
"""Called after a new WebSocket connection has been established."""
171145
# Reopen the eventlet hub to make sure we don't share an epoll

0 commit comments

Comments
 (0)