Merge "Test coverage for stable compute UUID"

This commit is contained in:
Zuul 2023-12-22 03:05:29 +00:00 committed by Gerrit Code Review
commit 9d66d41682
4 changed files with 74 additions and 3 deletions

View File

@ -64,6 +64,7 @@
$TEMPEST_CONFIG: $TEMPEST_CONFIG:
compute-feature-enabled: compute-feature-enabled:
volume_backed_live_migration: true volume_backed_live_migration: true
stable_compute_uuid_supported: true
auth: auth:
tempest_roles: creator tempest_roles: creator
post-config: post-config:

View File

@ -33,6 +33,11 @@ function configure {
iniset $TEMPEST_CONFIG compute-feature-enabled uefi_secure_boot "$COMPUTE_FEATURE_UEFI_SECURE_BOOT" iniset $TEMPEST_CONFIG compute-feature-enabled uefi_secure_boot "$COMPUTE_FEATURE_UEFI_SECURE_BOOT"
iniset $TEMPEST_CONFIG compute-feature-enabled vtpm_device_supported "$COMPUTE_FEATURE_VTPM_ENABLED" iniset $TEMPEST_CONFIG compute-feature-enabled vtpm_device_supported "$COMPUTE_FEATURE_VTPM_ENABLED"
iniset $TEMPEST_CONFIG compute-feature-enabled live_migrate_back_and_forth "$COMPUTE_FEATURE_LIVE_MIGRATE_BACK_AND_FORTH" iniset $TEMPEST_CONFIG compute-feature-enabled live_migrate_back_and_forth "$COMPUTE_FEATURE_LIVE_MIGRATE_BACK_AND_FORTH"
# matching devstack/lib/nova
# https://github.com/openstack/devstack/blob/6b0f055b4ed407f8a190f768d0e654235ac015dd/lib/nova#L46C36-L46C50
iniset $TEMPEST_CONFIG whitebox-nova-compute state_path $DATA_DIR/nova
} }
if [[ "$1" == "stack" ]]; then if [[ "$1" == "stack" ]]; then

View File

@ -0,0 +1,52 @@
#
# 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.
import os
from tempest import config
from whitebox_tempest_plugin.api.compute import base
from whitebox_tempest_plugin.services import clients
CONF = config.CONF
class TestStableCpuId(base.BaseWhiteboxComputeTest):
"""Test nova-compute generates a proper compute_id at startup.
"""
min_microversion = '2.53'
@classmethod
def skip_checks(cls):
super(TestStableCpuId, cls).skip_checks()
if not CONF.compute_feature_enabled.stable_compute_uuid_supported:
raise cls.skipException(
'Deployment requires support for stable compute UUID feature. '
'Set [compute-feature-enabled]stable_compute_uuid_supported '
'to True to enable these tests.')
def test_compute_id_file_match_db_state(self):
compute_id_path = os.path.join(
CONF.whitebox_nova_compute.state_path, "compute_id")
hypervisors = self.os_admin.hypervisor_client.list_hypervisors(
)["hypervisors"]
for hypervisor in hypervisors:
name = hypervisor['hypervisor_hostname']
ssh_client = clients.SSHClient(name)
uuid_on_disk = ssh_client.execute(f'cat {compute_id_path}')
self.assertEqual(
hypervisor['id'],
uuid_on_disk,
f"Compute UUID does not match on {name}: "
f"on disk: {uuid_on_disk}, in DB: {hypervisor['id']}",
)

View File

@ -128,7 +128,7 @@ general_opts = [
cfg.IntOpt( cfg.IntOpt(
'max_disk_devices_to_attach', 'max_disk_devices_to_attach',
default=None, default=None,
help='Maximum number of disks allowed to attach to a singler server') help='Maximum number of disks allowed to attach to a singler server'),
] ]
nova_compute_group = cfg.OptGroup( nova_compute_group = cfg.OptGroup(
@ -142,7 +142,12 @@ nova_compute_opts = [
choices=["journalctl", "zgrep"], choices=["journalctl", "zgrep"],
help="Name of the utility to run LogParserClient commands. " help="Name of the utility to run LogParserClient commands. "
"Currently, supported values are 'journalctl' (default) " "Currently, supported values are 'journalctl' (default) "
"for devstack and 'zgrep' for TripleO") "for devstack and 'zgrep' for TripleO"),
cfg.StrOpt(
'state_path',
default="/var/lib/nova",
help='The [DEFAULT]state_path passed to nova-compute. '
'Defaults to the default of nova'),
] ]
database_group = cfg.OptGroup( database_group = cfg.OptGroup(
@ -308,5 +313,13 @@ compute_features_group_opts = [
cfg.BoolOpt('vgpu_cold_migration_supported', cfg.BoolOpt('vgpu_cold_migration_supported',
default=False, default=False,
help='Cold migration and resize supported for guest instances ' help='Cold migration and resize supported for guest instances '
'with vGPU devices') 'with vGPU devices'),
cfg.BoolOpt('stable_compute_uuid_supported',
default=False,
help='Stable compute UUID feature is supported for the '
'deployment. This feature is available since 2023.1 '
'(Antelope) upstream. If the deployment does not use the '
'default value of [DEFAULT]state_path in the nova-compute'
'config, then [whitebox-nova-compute]state_path also '
'needs to be configured'),
] ]