From b132bd3bcde38e86bebc1b4aab05bf3ef1d22a3a Mon Sep 17 00:00:00 2001 From: James Parker Date: Wed, 27 Apr 2022 10:34:01 -0400 Subject: [PATCH] Handle libvirt modular daemon container names Tripleo has updated libvirt container organization to breakup libvirt processes that were normally all contained in nova_libvirt across multiple new containers. [1] When interacting with virsh downstream tests now need to access container 'nova_virtqemud' instead of nova_libvirtd. This update allows the container name for libvirt to be a parameter that will default to nova_libvirtd if nothing is provided. [1] https://opendev.org/openstack/puppet-tripleo/commit/bbdad5c27e41691dc2a9272af6f451b10e58f8fb Change-Id: I5b4e5323c7734968cadd9736abd5ba92b5c5cea6 --- whitebox_tempest_plugin/config.py | 5 +++++ whitebox_tempest_plugin/services/clients.py | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/whitebox_tempest_plugin/config.py b/whitebox_tempest_plugin/config.py index 412b6db7..7e622b7a 100644 --- a/whitebox_tempest_plugin/config.py +++ b/whitebox_tempest_plugin/config.py @@ -173,6 +173,11 @@ libvirt_opts = [ help='Similar to the mask_command option, this config options sets ' 'the command to unmask libvirt. If set, it will be run before ' 'every start command.'), + cfg.StrOpt( + 'libvirt_container_name', + default="nova_libvirt", + help='The container name to use when needing to interact with the ' + 'respective virsh command of the compute host'), ] database_group = cfg.OptGroup( diff --git a/whitebox_tempest_plugin/services/clients.py b/whitebox_tempest_plugin/services/clients.py index 693dc4f3..6d6d2719 100644 --- a/whitebox_tempest_plugin/services/clients.py +++ b/whitebox_tempest_plugin/services/clients.py @@ -59,17 +59,24 @@ class SSHClient(object): class VirshXMLClient(SSHClient): """A client to obtain libvirt XML from a remote host.""" + def __init__(self, ctlplane_address): + super(VirshXMLClient, self).__init__(ctlplane_address) + self.container_name = CONF.whitebox_libvirt.libvirt_container_name + def dumpxml(self, domain): command = 'virsh dumpxml %s' % domain - return self.execute(command, container_name='nova_libvirt', sudo=True) + return self.execute( + command, container_name=self.container_name, sudo=True) def capabilities(self): command = 'virsh capabilities' - return self.execute(command, container_name='nova_libvirt', sudo=True) + return self.execute( + command, container_name=self.container_name, sudo=True) def domblklist(self, server_id): command = 'virsh domblklist %s' % server_id - return self.execute(command, container_name='nova_libvirt', sudo=True) + return self.execute( + command, container_name=self.container_name, sudo=True) class LogParserClient(SSHClient):