bdc7dfc00c
Downstream computes are accessed via cloud-admin and does not have access to /var/lib/nova/compute_id. Enable check via sudo to gather compute uuid info. Also remove trailing newline cat output of /var/lib/nova/compute_id file before doing assert. Change-Id: I6683727c31bd5a732ee463c72bc71d758ed37888
55 lines
2.1 KiB
Python
55 lines
2.1 KiB
Python
#
|
|
# 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}',
|
|
sudo=True)
|
|
uuid_on_disk = uuid_on_disk.rstrip()
|
|
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']}",
|
|
)
|