Merge "Follow up for I4660043fcccec6721e197c4d77390744e356c59e"
This commit is contained in:
commit
09d56749ea
@ -37,7 +37,6 @@ class BaseWhiteboxComputeTest(base.BaseV2ComputeAdminTest):
|
|||||||
cls.servers_client = cls.os_admin.servers_client
|
cls.servers_client = cls.os_admin.servers_client
|
||||||
cls.flavors_client = cls.os_admin.flavors_client
|
cls.flavors_client = cls.os_admin.flavors_client
|
||||||
cls.service_client = cls.os_admin.services_client
|
cls.service_client = cls.os_admin.services_client
|
||||||
cls.hypervisor_client = cls.os_admin.hypervisor_client
|
|
||||||
cls.image_client = cls.os_admin.image_client_v2
|
cls.image_client = cls.os_admin.image_client_v2
|
||||||
cls.admin_migration_client = cls.os_admin.migrations_client
|
cls.admin_migration_client = cls.os_admin.migrations_client
|
||||||
|
|
||||||
@ -100,24 +99,25 @@ class BaseWhiteboxComputeTest(base.BaseV2ComputeAdminTest):
|
|||||||
|
|
||||||
return new_image['id']
|
return new_image['id']
|
||||||
|
|
||||||
def get_ctrlplane_address(self, compute_hostname):
|
def get_ctlplane_address(self, compute_hostname):
|
||||||
"""Return the appropriate host address depending on a deployment.
|
"""Return the appropriate host address depending on a deployment.
|
||||||
|
|
||||||
In TripleO deployments the Undercloud does not have DNS entries for
|
In TripleO deployments the Undercloud does not have DNS entries for
|
||||||
the compute hosts. This method checks if there are 'DNS' mappings of
|
the compute hosts. This method checks if there are 'DNS' mappings of
|
||||||
the provided hostname to it's control plane IP address and returns it.
|
the provided hostname to its control plane IP address and returns it.
|
||||||
For Devstack deployments, no such parameters will exist and the method
|
For Devstack deployments, no such parameters will exist and the method
|
||||||
will just return compute_hostname
|
will just return compute_hostname
|
||||||
|
|
||||||
:param compute_hostname: str the compute hostname
|
:param compute_hostname: str the compute hostname
|
||||||
:return str simply pass the provided compute_hostname back or
|
:return: The address to be used to access the compute host. For
|
||||||
return the associated control plane IP address
|
devstack deployments, this is compute_host itself. For
|
||||||
|
TripleO, it needs to be looked up in the configuration.
|
||||||
"""
|
"""
|
||||||
if not CONF.whitebox.ctrlplane_addresses:
|
if not CONF.whitebox.ctlplane_addresses:
|
||||||
return compute_hostname
|
return compute_hostname
|
||||||
|
|
||||||
if compute_hostname in CONF.whitebox.ctrlplane_addresses:
|
if compute_hostname in CONF.whitebox.ctlplane_addresses:
|
||||||
return CONF.whitebox.ctrlplane_addresses[compute_hostname]
|
return CONF.whitebox.ctlplane_addresses[compute_hostname]
|
||||||
|
|
||||||
raise exceptions.CtrlplaneAddressResolutionError(host=compute_hostname)
|
raise exceptions.CtrlplaneAddressResolutionError(host=compute_hostname)
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ class BaseWhiteboxComputeTest(base.BaseV2ComputeAdminTest):
|
|||||||
def get_server_xml(self, server_id):
|
def get_server_xml(self, server_id):
|
||||||
server = self.servers_client.show_server(server_id)
|
server = self.servers_client.show_server(server_id)
|
||||||
host = server['server']['OS-EXT-SRV-ATTR:host']
|
host = server['server']['OS-EXT-SRV-ATTR:host']
|
||||||
cntrlplane_addr = self.get_ctrlplane_address(host)
|
cntrlplane_addr = self.get_ctlplane_address(host)
|
||||||
server_instance_name = self.servers_client.show_server(
|
server_instance_name = self.servers_client.show_server(
|
||||||
server_id)['server']['OS-EXT-SRV-ATTR:instance_name']
|
server_id)['server']['OS-EXT-SRV-ATTR:instance_name']
|
||||||
|
|
||||||
|
@ -334,15 +334,8 @@ class CPUThreadPolicyTest(BasePinningTest):
|
|||||||
"""
|
"""
|
||||||
siblings = {}
|
siblings = {}
|
||||||
|
|
||||||
if CONF.whitebox.hypervisors:
|
host = self.get_ctlplane_address(host)
|
||||||
try:
|
virshxml = clients.VirshXMLClient(host)
|
||||||
host_address = CONF.whitebox.hypervisors[host]
|
|
||||||
except KeyError:
|
|
||||||
raise exceptions.CtrlplaneAddressResolutionError(host=host)
|
|
||||||
else:
|
|
||||||
host_address = host
|
|
||||||
|
|
||||||
virshxml = clients.VirshXMLClient(host_address)
|
|
||||||
capxml = virshxml.capabilities()
|
capxml = virshxml.capabilities()
|
||||||
root = ET.fromstring(capxml)
|
root = ET.fromstring(capxml)
|
||||||
cpu_cells = root.findall('./host/topology/cells/cell/cpus')
|
cpu_cells = root.findall('./host/topology/cells/cell/cpus')
|
||||||
@ -489,7 +482,7 @@ class NUMALiveMigrationTest(BasePinningTest):
|
|||||||
return set([len(cpu_list) for cpu_list in chain(*args)])
|
return set([len(cpu_list) for cpu_list in chain(*args)])
|
||||||
|
|
||||||
def test_cpu_pinning(self):
|
def test_cpu_pinning(self):
|
||||||
host1, host2 = [self.get_ctrlplane_address(host) for host in
|
host1, host2 = [self.get_ctlplane_address(host) for host in
|
||||||
self.list_compute_hosts()]
|
self.list_compute_hosts()]
|
||||||
|
|
||||||
numaclient_1 = clients.NUMAClient(host1)
|
numaclient_1 = clients.NUMAClient(host1)
|
||||||
@ -555,7 +548,7 @@ class NUMALiveMigrationTest(BasePinningTest):
|
|||||||
# Live migrate server_b to server_a's compute, adding the second
|
# Live migrate server_b to server_a's compute, adding the second
|
||||||
# NUMA node's CPUs to vcpu_pin_set
|
# NUMA node's CPUs to vcpu_pin_set
|
||||||
host_a = self.get_host_other_than(server_b['id'])
|
host_a = self.get_host_other_than(server_b['id'])
|
||||||
host_a_addr = self.get_ctrlplane_address(host_a)
|
host_a_addr = self.get_ctlplane_address(host_a)
|
||||||
host_a_sm = clients.ServiceManager(host_a_addr, 'nova-compute')
|
host_a_sm = clients.ServiceManager(host_a_addr, 'nova-compute')
|
||||||
numaclient_a = clients.NUMAClient(host_a_addr)
|
numaclient_a = clients.NUMAClient(host_a_addr)
|
||||||
topo_a = numaclient_a.get_host_topology()
|
topo_a = numaclient_a.get_host_topology()
|
||||||
@ -594,7 +587,7 @@ class NUMALiveMigrationTest(BasePinningTest):
|
|||||||
|
|
||||||
def test_emulator_threads(self):
|
def test_emulator_threads(self):
|
||||||
# Need 4 CPUs on each host
|
# Need 4 CPUs on each host
|
||||||
host1, host2 = [self.get_ctrlplane_address(host) for host in
|
host1, host2 = [self.get_ctlplane_address(host) for host in
|
||||||
self.list_compute_hosts()]
|
self.list_compute_hosts()]
|
||||||
|
|
||||||
for host in [host1, host2]:
|
for host in [host1, host2]:
|
||||||
@ -656,7 +649,7 @@ class NUMALiveMigrationTest(BasePinningTest):
|
|||||||
self.delete_server(server_b['id'])
|
self.delete_server(server_b['id'])
|
||||||
|
|
||||||
def test_hugepages(self):
|
def test_hugepages(self):
|
||||||
host_a, host_b = [self.get_ctrlplane_address(host) for host in
|
host_a, host_b = [self.get_ctlplane_address(host) for host in
|
||||||
self.list_compute_hosts()]
|
self.list_compute_hosts()]
|
||||||
|
|
||||||
numaclient_a = clients.NUMAClient(host_a)
|
numaclient_a = clients.NUMAClient(host_a)
|
||||||
|
@ -70,7 +70,7 @@ class VolumesAdminNegativeTest(base.BaseWhiteboxComputeTest,
|
|||||||
self.assertGreater(
|
self.assertGreater(
|
||||||
len(disks_after_attach),
|
len(disks_after_attach),
|
||||||
len(disks_before_attach))
|
len(disks_before_attach))
|
||||||
host = self.get_ctrlplane_address(server['OS-EXT-SRV-ATTR:host'])
|
host = self.get_ctlplane_address(server['OS-EXT-SRV-ATTR:host'])
|
||||||
|
|
||||||
# stop the nova_libvirt service
|
# stop the nova_libvirt service
|
||||||
clients.ServiceManager(host, 'nova-libvirt').stop()
|
clients.ServiceManager(host, 'nova-libvirt').stop()
|
||||||
|
@ -40,13 +40,13 @@ general_opts = [
|
|||||||
default=False,
|
default=False,
|
||||||
help='Deployment is containerized.'),
|
help='Deployment is containerized.'),
|
||||||
cfg.DictOpt(
|
cfg.DictOpt(
|
||||||
'ctrlplane_addresses',
|
'ctlplane_addresses',
|
||||||
help="Dictionary of control plane addresses. The keys are the "
|
help="Dictionary of control plane addresses. The keys are the "
|
||||||
"compute hostnames as they appear in the OS-EXT-SRV-ATTR:host "
|
"compute hostnames as they appear in the OS-EXT-SRV-ATTR:host "
|
||||||
"field of Nova's show server details API. The values are the "
|
"field of Nova's show server details API. The values are the "
|
||||||
"control plane addresses. For example:"
|
"control plane addresses. For example:"
|
||||||
""
|
""
|
||||||
" ctrlplane_addresses = compute-0.localdomain:172.16.42.11,"
|
" ctlplane_addresses = compute-0.localdomain:172.16.42.11,"
|
||||||
" compute-1.localdomain:172.16.42.10"
|
" compute-1.localdomain:172.16.42.10"
|
||||||
""
|
""
|
||||||
"While this looks like a poor man's DNS, this is needed "
|
"While this looks like a poor man's DNS, this is needed "
|
||||||
|
@ -17,7 +17,7 @@ from tempest.lib import exceptions
|
|||||||
|
|
||||||
|
|
||||||
class CtrlplaneAddressResolutionError(exceptions.TempestException):
|
class CtrlplaneAddressResolutionError(exceptions.TempestException):
|
||||||
message = "Unable to find IP in conf. for host: %(host)s."
|
message = "Unable to find address in conf. Host: %(host)s."
|
||||||
|
|
||||||
|
|
||||||
class MissingServiceSectionException(exceptions.TempestException):
|
class MissingServiceSectionException(exceptions.TempestException):
|
||||||
|
@ -44,17 +44,18 @@ class ComputeBaseTestCase(base.WhiteboxPluginTestCase):
|
|||||||
self.test_class.service_client = mock.Mock()
|
self.test_class.service_client = mock.Mock()
|
||||||
self.test_class.servers_client.show_server = fake_show_server
|
self.test_class.servers_client.show_server = fake_show_server
|
||||||
self.test_class.service_client.list_services = fake_list_services
|
self.test_class.service_client.list_services = fake_list_services
|
||||||
self.flags(hypervisors={'fake-host': 'fake-ip',
|
self.flags(ctlplane_addresses={'fake-host': 'fake-ip',
|
||||||
'fake-host2': 'fake-ip2'}, group='whitebox')
|
'fake-host2': 'fake-ip2'},
|
||||||
|
group='whitebox')
|
||||||
|
|
||||||
def test_get_ctrlplane_address(self):
|
def test_get_ctlplane_address(self):
|
||||||
self.assertEqual('fake-ip',
|
self.assertEqual('fake-ip',
|
||||||
self.test_class.get_ctrlplane_address('fake-host'))
|
self.test_class.get_ctlplane_address('fake-host'))
|
||||||
|
|
||||||
@mock.patch.object(compute_base.LOG, 'error')
|
@mock.patch.object(compute_base.LOG, 'error')
|
||||||
def test_get_ctrlplane_address_keyerror(self, mock_log):
|
def test_get_ctlplane_address_keyerror(self, mock_log):
|
||||||
self.assertRaises(exceptions.CtrlplaneAddressResolutionError,
|
self.assertRaises(exceptions.CtrlplaneAddressResolutionError,
|
||||||
self.test_class.get_ctrlplane_address, 'missing-id')
|
self.test_class.get_ctlplane_address, 'missing-id')
|
||||||
|
|
||||||
def test_list_compute_hosts(self):
|
def test_list_compute_hosts(self):
|
||||||
self.assertItemsEqual(['fake-host', 'fake-host2'],
|
self.assertItemsEqual(['fake-host', 'fake-host2'],
|
||||||
|
Loading…
Reference in New Issue
Block a user