diff options
author | Zuul <zuul@review.opendev.org> | 2020-05-15 23:31:56 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2020-05-15 23:31:56 +0000 |
commit | a2bcaa14358b17a83f31881a614fbb422f2ccc17 (patch) | |
tree | 23e1164d46a821af507c6afe6f528e93ed3fd199 | |
parent | 895334f0c7529d1487ae4355733636e896c38d6f (diff) | |
parent | b52c483308f32f3744dd8a5df424b9f518c13155 (diff) | |
download | nova-a2bcaa14358b17a83f31881a614fbb422f2ccc17.tar.gz |
Merge "Reproduce bug 1869050"
-rw-r--r-- | nova/tests/functional/test_server_group.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/nova/tests/functional/test_server_group.py b/nova/tests/functional/test_server_group.py index e6b593d293..f104cfd3c4 100644 --- a/nova/tests/functional/test_server_group.py +++ b/nova/tests/functional/test_server_group.py @@ -371,6 +371,53 @@ class ServerGroupTestV21(ServerGroupTestBase): self.assertNotEqual(servers[0]['OS-EXT-SRV-ATTR:host'], migrated_server['OS-EXT-SRV-ATTR:host']) + def test_migrate_with_anti_affinity_stale_scheduler_instance_info(self): + # Start additional host to test migration with anti-affinity + compute3 = self.start_service('compute', host='host3') + + # make sure that compute syncing instance info to scheduler + # this tells the scheduler that it can expect such updates periodically + # and don't have to look into the db for it at the start of each + # scheduling + for compute in [self.compute, self.compute2, compute3]: + compute.manager._sync_scheduler_instance_info( + context.get_admin_context()) + + created_group = self.api.post_server_groups(self.anti_affinity) + servers = self._boot_servers_to_group(created_group) + + post = {'migrate': {}} + self.admin_api.post_server_action(servers[1]['id'], post) + migrated_server = self._wait_for_state_change( + servers[1], 'VERIFY_RESIZE') + + self.assertNotEqual(servers[0]['OS-EXT-SRV-ATTR:host'], + migrated_server['OS-EXT-SRV-ATTR:host']) + + # We have 3 hosts, so after the move is confirmed one of the hosts + # should be considered empty so we could boot a 3rd server on that host + post = {'confirmResize': {}} + self.admin_api.post_server_action(servers[1]['id'], post) + self._wait_for_state_change(servers[1], 'ACTIVE') + + # NOTE(gibi): This is bug 1869050. The confirm resize does to update + # the scheduler instance info so the migrate_server occupies two host + # according to the stale information in the scheduler. + # Alternatively waiting for the periodic _sync_scheduler_instance_info + # call would update the stale data. + + server3 = self._boot_a_server_to_group( + created_group, expected_status='ERROR') + self.assertIn('No valid host', server3['fault']['message']) + + # When bug 1869050 is fixed the following is expected: + # server3 = self._boot_a_server_to_group(created_group) + # + # # we have 3 servers that should occupy 3 different hosts + # hosts = {server['OS-EXT-SRV-ATTR:host'] + # for server in [servers[0], migrated_server, server3]} + # self.assertEqual(3, len(hosts)) + def test_resize_to_same_host_with_anti_affinity(self): self.flags(allow_resize_to_same_host=True) created_group = self.api.post_server_groups(self.anti_affinity) |