Update accessing nova compute logs for RBD check

Nova compute logs are no longer accessible via accessing the
nova_compute container downstream. Instead the nova service logs are
available directly on the host via journalctl. Updated LogParserClient
to conditionally access nova service logs either via host or container.

Change-Id: I2cf0ded367e85fca1e49a2cab48adb23b1ed9807
This commit is contained in:
jamepark4 2024-08-29 11:44:49 -04:00
parent 2a09062deb
commit 261de3a036
4 changed files with 49 additions and 35 deletions

View File

@ -168,6 +168,7 @@
whitebox-tempest-plugin: https://opendev.org/openstack/whitebox-tempest-plugin.git
tempest_test_regex: '^whitebox_tempest_plugin.api.compute.test_rbd_direct_download'
devstack_localrc:
NOVA_SERVICE_REPORT_INTERVAL: 10
COMPUTE_FEATURE_RBD_DOWNLOAD: True
TEMPEST_PLUGINS: /opt/stack/whitebox-tempest-plugin
WHITEBOX_PRIVKEY_PATH: /home/tempest/.ssh/id_rsa

View File

@ -38,6 +38,10 @@ class TestRBDDirectDownload(base.BaseWhiteboxComputeTest):
raise cls.skipException(skip_msg)
def test_rbd_logs_and_conf(self):
with self.config_all_computes(
('libvirt', 'images_type', 'default'),
):
base_server = self.create_test_server(wait_until='ACTIVE')
image = self.create_image_from_server(
base_server['id'],
@ -52,16 +56,17 @@ class TestRBDDirectDownload(base.BaseWhiteboxComputeTest):
# Grab image id from newly created server
detailed_server_data = \
self.os_admin.servers_client.show_server(server['id'])['server']
image_id = detailed_server_data['image']['id']
self.os_admin.servers_client.show_server(server['id'])
image_id = detailed_server_data['server']['image']['id']
host = self.get_host_for_server(server['id'])
host_sm = clients.NovaServiceManager(host, 'nova-compute',
self.os_admin.services_client)
host_sm = clients.NovaServiceManager(
host, 'nova-compute', self.os_admin.services_client)
rbd_pool = host_sm.get_conf_opt('glance', 'rbd_pool')
# Assert RBD direct download conf options
self.assertEqual('images', rbd_pool)
self.assertTrue(host_sm.get_conf_opt('glance', 'enable_rbd_download'))
self.assertTrue(host_sm.get_conf_opt('glance',
'enable_rbd_download'))
log_query_string = f"Attempting to export RBD image: " \
f"[[]pool_name: {rbd_pool}[]] [[]image_uuid: " \
f"{image_id}[]]"

View File

@ -153,6 +153,10 @@ nova_compute_opts = [
help="Name of the utility to run LogParserClient commands. "
"Currently, supported values are 'journalctl' (default) "
"for devstack and 'zgrep' for TripleO"),
cfg.StrOpt(
'journalctl_unit',
default="devstack@n-cpu",
help="Unit to access when doing log query via journalctl"),
cfg.StrOpt(
'state_path',
default="/var/lib/nova",

View File

@ -89,10 +89,14 @@ class LogParserClient(SSHClient):
def parse(self, query_string):
log_query_command = CONF.whitebox_nova_compute.log_query_command
if log_query_command == 'zgrep':
command = 'sh -c "zgrep \'%s\' /var/log/nova/*"' % query_string
command = f'sh -c "zgrep \'{query_string}\' /var/log/nova/*"'
else:
command = 'journalctl -u devstack@n-cpu -g \'%s\'' % query_string
return self.execute(command, container_name='nova_compute', sudo=True)
unit = CONF.whitebox_nova_compute.journalctl_unit
command = f'journalctl -u {unit} -g \'{query_string}\''
services_dict = self.host_parameters.get('services', {})
nova_compute_srvc = services_dict.get('nova-compute')
container_name = nova_compute_srvc.get('container_name')
return self.execute(command, container_name=container_name, sudo=True)
class QEMUImgClient(SSHClient):