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