Reproduce bug 1869050
This patch adds a functional test that reproduce the bug when stale scheduler instance info prevents booting server with anti-affinity. Change-Id: If485330b48ae2671651aafabc93f92a8999f7ca2 Related-Bug: #1869050 (cherry picked from commitb52c483308
) (cherry picked from commit016eeec984
) (cherry picked from commit66e4d82181
)
This commit is contained in:
parent
836da35b2b
commit
2a15e0096b
|
@ -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(
|
||||
self.admin_api, 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(self.admin_api, 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)
|
||||
|
|
Loading…
Reference in New Issue