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] bbdad5c27e

Change-Id: I5b4e5323c7734968cadd9736abd5ba92b5c5cea6
This commit is contained in:
James Parker 2022-04-27 10:34:01 -04:00
parent d8dde5e6d1
commit b132bd3bcd
2 changed files with 15 additions and 3 deletions

View File

@ -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(

View File

@ -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):