Skip to content

Commit 08113fe

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "nova-status: Remove consoleauth workaround check"
2 parents 62faf55 + bedaeab commit 08113fe

File tree

3 files changed

+5
-245
lines changed

3 files changed

+5
-245
lines changed

nova/cmd/status.py

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -386,83 +386,6 @@ def _check_request_spec_migration(self):
386386
return upgradecheck.Result(upgradecheck.Code.FAILURE, msg)
387387
return upgradecheck.Result(upgradecheck.Code.SUCCESS)
388388

389-
def _check_console_auths(self):
390-
"""Checks for console usage and warns with info for rolling upgrade.
391-
392-
Iterates all cells checking to see if the nova-consoleauth service is
393-
non-deleted/non-disabled and whether there are any console token auths
394-
in that cell database. If there is a nova-consoleauth service being
395-
used and no console token auths in the cell database, emit a warning
396-
telling the user to set [workarounds]enable_consoleauth = True if they
397-
are performing a rolling upgrade.
398-
"""
399-
# If the operator has already enabled the workaround, we don't need
400-
# to check anything.
401-
if CONF.workarounds.enable_consoleauth:
402-
return upgradecheck.Result(upgradecheck.Code.SUCCESS)
403-
404-
# We need to check cell0 for nova-consoleauth service records because
405-
# it's possible a deployment could have services stored in the cell0
406-
# database, if they've defaulted their [database]connection in
407-
# nova.conf to cell0.
408-
mappings = self._get_cell_mappings()
409-
410-
if not mappings:
411-
# There are no cell mappings so we can't determine this, just
412-
# return a warning. The cellsv2 check would have already failed
413-
# on this.
414-
msg = (_('Unable to check consoles without cell mappings.'))
415-
return upgradecheck.Result(upgradecheck.Code.WARNING, msg)
416-
417-
ctxt = nova_context.get_admin_context()
418-
# If we find a non-deleted, non-disabled nova-consoleauth service in
419-
# any cell, we will assume the deployment is using consoles.
420-
using_consoles = False
421-
for mapping in mappings:
422-
with nova_context.target_cell(ctxt, mapping) as cctxt:
423-
# Check for any non-deleted, non-disabled nova-consoleauth
424-
# service.
425-
meta = MetaData(bind=db_session.get_engine(context=cctxt))
426-
services = Table('services', meta, autoload=True)
427-
consoleauth_service_record = (
428-
select([services.c.id]).select_from(services).where(and_(
429-
services.c.binary == 'nova-consoleauth',
430-
services.c.deleted == 0,
431-
services.c.disabled == false())).execute().first())
432-
if consoleauth_service_record:
433-
using_consoles = True
434-
break
435-
436-
if using_consoles:
437-
# If the deployment is using consoles, we can only be certain the
438-
# upgrade is complete if each compute service is >= Rocky and
439-
# supports storing console token auths in the database backend.
440-
for mapping in mappings:
441-
# Skip cell0 as no compute services should be in it.
442-
if mapping.is_cell0():
443-
continue
444-
# Get the minimum nova-compute service version in this
445-
# cell.
446-
with nova_context.target_cell(ctxt, mapping) as cctxt:
447-
min_version = self._get_min_service_version(
448-
cctxt, 'nova-compute')
449-
# We could get None for the minimum version in the case of
450-
# new install where there are no computes. If there are
451-
# compute services, they should all have versions.
452-
if min_version is not None and min_version < 35:
453-
msg = _("One or more cells were found which have "
454-
"nova-compute services older than Rocky. "
455-
"Please set the "
456-
"'[workarounds]enable_consoleauth' "
457-
"configuration option to 'True' on your "
458-
"console proxy host if you are performing a "
459-
"rolling upgrade to enable consoles to "
460-
"function during a partial upgrade.")
461-
return upgradecheck.Result(upgradecheck.Code.WARNING,
462-
msg)
463-
464-
return upgradecheck.Result(upgradecheck.Code.SUCCESS)
465-
466389
def _check_cinder(self):
467390
"""Checks to see that the cinder API is available at a given minimum
468391
microversion.
@@ -507,8 +430,6 @@ def _check_cinder(self):
507430
(_('Ironic Flavor Migration'), _check_ironic_flavor_migration),
508431
# Added in Rocky
509432
(_('Request Spec Migration'), _check_request_spec_migration),
510-
# Added in Stein (but also useful going back to Rocky)
511-
(_('Console Auths'), _check_console_auths),
512433
# Added in Train
513434
(_('Cinder API'), _check_cinder),
514435
)

nova/tests/unit/cmd/test_status.py

Lines changed: 0 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -617,172 +617,6 @@ def test_unmigrated_request_spec_instances(self):
617617
self.cell_mappings['cell2'].uuid, result.details)
618618

619619

620-
class TestUpgradeCheckConsoles(test.NoDBTestCase):
621-
"""Tests for the nova-status upgrade check for consoles."""
622-
623-
# We'll setup the database ourselves because we need to use cells fixtures
624-
# for multiple cell mappings.
625-
USES_DB_SELF = True
626-
627-
# This will create three cell mappings: cell0, cell1 (default) and cell2
628-
NUMBER_OF_CELLS = 2
629-
630-
def setUp(self):
631-
super(TestUpgradeCheckConsoles, self).setUp()
632-
self.output = StringIO()
633-
self.useFixture(fixtures.MonkeyPatch('sys.stdout', self.output))
634-
# We always need the API DB to be setup.
635-
self.useFixture(nova_fixtures.Database(database='api'))
636-
self.cmd = status.UpgradeCommands()
637-
638-
@staticmethod
639-
def _create_service_in_cell(ctxt, cell, binary, is_deleted=False,
640-
disabled=False, version=None,
641-
create_token_auth=False):
642-
with context.target_cell(ctxt, cell) as cctxt:
643-
service = objects.Service(context=cctxt, binary=binary,
644-
disabled=disabled, host='dontcare')
645-
if version:
646-
service.version = version
647-
service.create()
648-
649-
if is_deleted:
650-
service.destroy()
651-
652-
if create_token_auth:
653-
# We have to create an instance in order to create a token
654-
# auth.
655-
inst = objects.Instance(context=cctxt,
656-
uuid=uuidutils.generate_uuid())
657-
inst.create()
658-
auth = objects.ConsoleAuthToken(context=cctxt,
659-
console_type='novnc',
660-
host='hostname', port=6080,
661-
instance_uuid=inst.uuid)
662-
auth.authorize(CONF.consoleauth.token_ttl)
663-
664-
return service
665-
666-
def test_check_workaround_enabled(self):
667-
"""This is a 'success' case since the console auths check is
668-
ignored when the workaround is already enabled.
669-
"""
670-
self.flags(enable_consoleauth=True, group='workarounds')
671-
result = self.cmd._check_console_auths()
672-
self.assertEqual(upgradecheck.Code.SUCCESS, result.code)
673-
674-
def test_deleted_disabled_consoleauth(self):
675-
"""Tests that services other than nova-consoleauth and deleted/disabled
676-
nova-consoleauth services are filtered out.
677-
"""
678-
self._setup_cells()
679-
ctxt = context.get_admin_context()
680-
681-
# Create a compute service in cell1.
682-
self._create_service_in_cell(ctxt, self.cell_mappings['cell1'],
683-
'nova-compute')
684-
# Create a deleted consoleauth service in cell1.
685-
self._create_service_in_cell(ctxt, self.cell_mappings['cell1'],
686-
'nova-consoleauth', is_deleted=True)
687-
# Create a compute service in cell2.
688-
self._create_service_in_cell(ctxt, self.cell_mappings['cell2'],
689-
'nova-compute')
690-
# Create a disabled consoleauth service in cell2.
691-
self._create_service_in_cell(ctxt, self.cell_mappings['cell2'],
692-
'nova-consoleauth', disabled=True)
693-
694-
result = self.cmd._check_console_auths()
695-
self.assertEqual(upgradecheck.Code.SUCCESS, result.code)
696-
697-
def test_consoleauth_with_upgrade_not_started(self):
698-
"""Tests the scenario where the deployment is using consoles but has no
699-
compute services >= Rocky, i.e. a not started upgrade.
700-
"""
701-
self._setup_cells()
702-
ctxt = context.get_admin_context()
703-
704-
# Create a deleted consoleauth service in cell1.
705-
self._create_service_in_cell(ctxt, self.cell_mappings['cell1'],
706-
'nova-consoleauth', is_deleted=True)
707-
# Create a live consoleauth service in cell0. (Asserts we check cell0).
708-
self._create_service_in_cell(ctxt, self.cell_mappings['cell0'],
709-
'nova-consoleauth')
710-
# Create Queens compute services in the cells.
711-
for cell in ['cell1', 'cell2']:
712-
self._create_service_in_cell(ctxt, self.cell_mappings[cell],
713-
'nova-compute', version=30)
714-
715-
result = self.cmd._check_console_auths()
716-
self.assertEqual(upgradecheck.Code.WARNING, result.code)
717-
718-
def test_consoleauth_with_upgrade_complete(self):
719-
"""Tests the scenario where the deployment is using consoles and has
720-
all compute services >= Rocky in every cell database, i.e. a completed
721-
upgrade.
722-
"""
723-
self._setup_cells()
724-
ctxt = context.get_admin_context()
725-
726-
# Create a live consoleauth service in cell1 with token auth.
727-
self._create_service_in_cell(ctxt, self.cell_mappings['cell1'],
728-
'nova-consoleauth',
729-
create_token_auth=True)
730-
731-
# Create a live consoleauth service in cell2 with token auth.
732-
self._create_service_in_cell(ctxt, self.cell_mappings['cell2'],
733-
'nova-consoleauth',
734-
create_token_auth=True)
735-
736-
# Create Rocky compute services in the cells.
737-
for cell in ['cell1', 'cell2']:
738-
self._create_service_in_cell(ctxt, self.cell_mappings[cell],
739-
'nova-compute', version=35)
740-
741-
# Create a Queens compute service in cell0. This not actually valid,
742-
# we do it to assert that we skip cell0 when checking service versions.
743-
self._create_service_in_cell(ctxt, self.cell_mappings['cell0'],
744-
'nova-compute', version=30)
745-
746-
result = self.cmd._check_console_auths()
747-
self.assertEqual(upgradecheck.Code.SUCCESS, result.code)
748-
749-
def test_consoleauth_with_upgrade_partial(self):
750-
"""Tests the scenario where the deployment is using consoles and has
751-
compute services >= Rocky in at least one, but not all, cell databases,
752-
i.e. a partial upgrade.
753-
"""
754-
self._setup_cells()
755-
ctxt = context.get_admin_context()
756-
757-
# Create a live consoleauth service in cell1.
758-
self._create_service_in_cell(ctxt, self.cell_mappings['cell1'],
759-
'nova-consoleauth')
760-
761-
# Create a live consoleauth service in cell2 with token auth.
762-
self._create_service_in_cell(ctxt, self.cell_mappings['cell2'],
763-
'nova-consoleauth',
764-
create_token_auth=True)
765-
766-
# Create a Queens compute service in cell1.
767-
self._create_service_in_cell(ctxt, self.cell_mappings['cell1'],
768-
'nova-compute', version=30)
769-
770-
# Create a Rocky compute service in cell2.
771-
self._create_service_in_cell(ctxt, self.cell_mappings['cell2'],
772-
'nova-compute', version=35)
773-
774-
result = self.cmd._check_console_auths()
775-
776-
self.assertEqual(upgradecheck.Code.WARNING, result.code)
777-
self.assertIn("One or more cells were found which have nova-compute "
778-
"services older than Rocky. "
779-
"Please set the '[workarounds]enable_consoleauth' "
780-
"configuration option to 'True' on your console proxy "
781-
"host if you are performing a rolling upgrade to enable "
782-
"consoles to function during a partial upgrade.",
783-
result.details)
784-
785-
786620
class TestUpgradeCheckCinderAPI(test.NoDBTestCase):
787621

788622
def setUp(self):
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
upgrade:
3+
- |
4+
A check for the use of the ``nova-consoleauth`` service, added to the
5+
``nova-status upgrade check`` CLI in Rocky, is now removed.

0 commit comments

Comments
 (0)