From 882b4ebbe5114cb672e499bf461f9918de3dd57e Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Thu, 20 Sep 2018 09:59:11 -0400 Subject: [PATCH] Optimize test_volume_swap_with_multiattach for server status wait The test creates two servers in serial and waits for each server to go to ACTIVE status in serial. We can optimize this by creating the two servers in parallel and waiting for them to be ACTIVE at the same time. Change-Id: Ia9c6db32789fd441b22d7431200283df22db3c59 --- tempest/api/compute/admin/test_volume_swap.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tempest/api/compute/admin/test_volume_swap.py b/tempest/api/compute/admin/test_volume_swap.py index 5439ebe353..a853182e19 100644 --- a/tempest/api/compute/admin/test_volume_swap.py +++ b/tempest/api/compute/admin/test_volume_swap.py @@ -156,15 +156,19 @@ class TestMultiAttachVolumeSwap(TestVolumeSwapBase): volume1 = self.create_volume(multiattach=True) volume2 = self.create_volume(multiattach=True) - # TODO(mriedem): Speed this up by waiting for both servers to be active - # in parallel. - # Boot server1 - server1 = self.create_test_server(wait_until='ACTIVE') + # Create two servers and wait for them to be ACTIVE. + reservation_id = self.create_test_server( + wait_until='ACTIVE', min_count=2, + return_reservation_id=True)['reservation_id'] + # Get the servers using the reservation_id. + servers = self.servers_client.list_servers( + reservation_id=reservation_id)['servers'] + self.assertEqual(2, len(servers)) # Attach volume1 to server1 + server1 = servers[0] self.attach_volume(server1, volume1) - # Boot server2 - server2 = self.create_test_server(wait_until='ACTIVE') # Attach volume1 to server2 + server2 = servers[1] self.attach_volume(server2, volume1) # Swap volume1 to volume2 on server1, volume1 should remain attached