Remove 'test_cold_migrate_with_physnet_fails' test

This never actually worked. What we wanted to do was test a setup where
we had two hosts, one with the necessary configuration needed for a
specific request and one without, and attempt to cold migrate the
instance from the former to the latter resulting in a fail. However,
because it's not possible to use different configuration for different
hosts, we were attempting to "break" the configuration on one host.
Unfortunately, the driver correctly detects this broken behavior,
resulting in an error message like so:

  ERROR [nova.compute.manager] Error updating resources for node test_compute1.
  Traceback (most recent call last):
    File "nova/compute/manager.py", line 8524, in _update_available_resource_for_node
      startup=startup)
    File "nova/compute/resource_tracker.py", line 867, in update_available_resource
      resources = self.driver.get_available_resource(nodename)
    File "nova/virt/libvirt/driver.py", line 7907, in get_available_resource
      numa_topology = self._get_host_numa_topology()
    File "nova/virt/libvirt/driver.py", line 7057, in _get_host_numa_topology
      physnet_affinities = _get_physnet_numa_affinity()
    File "nova/virt/libvirt/driver.py", line 7039, in _get_physnet_numa_affinity
      raise exception.InvalidNetworkNUMAAffinity(reason=msg)
  InvalidNetworkNUMAAffinity: Invalid NUMA network affinity configured: node 1 for
  physnet foo is not present in host affinity set {0: set([])}

There isn't really an alternative. We can't configure compute nodes
separately so that's ruled out and the virt driver will correctly detect
any other attempts to break the configuration. Since the test never
actually worked, the correct thing to do seems to be to remove it.

NOTE(stephenfin): This was backported to make the backport of change
I0322d872bdff68936033a6f5a54e8296a6fb3434 cleaner, but it also applies
here.

Conflicts:
	nova/tests/functional/libvirt/test_numa_servers.py

NOTE(stephenfin): Conflicts are due to change
I8ef852d449e9e637d45e4ac92ffc5d1abd8d31c5 ("Include all network devices
in nova diagnostics") which modified the test we are removing here.

Change-Id: I14637d788205408dcf9a007d7727358c03033dcd
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
(cherry picked from commit a4ca0b531c)
(cherry picked from commit 8b766d14cf)
(cherry picked from commit d41afc7276)
This commit is contained in:
Stephen Finucane 2019-09-23 14:41:03 +01:00 committed by Lee Yarwood
parent 7207b9ee6c
commit 4ac7575717
1 changed files with 0 additions and 57 deletions

View File

@ -568,60 +568,3 @@ class NUMAServersWithNetworksTest(NUMAServersTestBase):
network_metadata = args[1].network_metadata
self.assertIsNotNone(network_metadata)
self.assertEqual(set(['foo']), network_metadata.physnets)
def test_cold_migrate_with_physnet_fails(self):
host_infos = [
# host 1 has room on both nodes
fakelibvirt.NUMAHostInfo(cpu_nodes=2, cpu_sockets=1,
cpu_cores=2, cpu_threads=2,
kB_mem=15740000),
# host 2 has no second node, where the desired physnet is
# reported to be attached
fakelibvirt.NUMAHostInfo(cpu_nodes=1, cpu_sockets=1,
cpu_cores=1, cpu_threads=1,
kB_mem=15740000),
]
# Start services
self.computes = {}
for host in ['test_compute0', 'test_compute1']:
host_info = host_infos.pop(0)
fake_connection = self._get_connection(host_info=host_info)
fake_connection.getHostname = lambda: host
# This is fun. Firstly we need to do a global'ish mock so we can
# actually start the service.
with mock.patch('nova.virt.libvirt.host.Host.get_connection',
return_value=fake_connection):
compute = self.start_service('compute', host=host)
# Once that's done, we need to do some tweaks to each individual
# compute "service" to make sure they return unique objects
compute.driver._host.get_connection = lambda: fake_connection
self.computes[host] = compute
# Create server
extra_spec = {'hw:numa_nodes': '1'}
flavor_id = self._create_flavor(extra_spec=extra_spec)
networks = [
{'uuid': NUMAAffinityNeutronFixture.network_1['id']},
]
good_server = self._build_server(flavor_id)
good_server['networks'] = networks
post = {'server': good_server}
created_server = self.api.post_server(post)
server = self._wait_for_state_change(created_server, 'BUILD')
self.assertEqual('ACTIVE', server['status'])
# TODO(stephenfin): The mock of 'migrate_disk_and_power_off' should
# probably be less...dumb
with mock.patch('nova.virt.libvirt.driver.LibvirtDriver'
'.migrate_disk_and_power_off', return_value='{}'):
ex = self.assertRaises(client.OpenStackApiException,
self.api.post_server_action,
server['id'], {'migrate': None})
self.assertEqual(400, ex.response.status_code)
self.assertIn('No valid host', six.text_type(ex))