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