From 35a2d1ea1cacbd20f5db775b4fae92aa81f6964e Mon Sep 17 00:00:00 2001 From: Rafael Galarza Date: Wed, 9 Mar 2016 14:03:53 -0600 Subject: [PATCH] Modified volume create and volume attach process Change-Id: Ia32d15a171b7a1c0c75465743aa709703ee90793 --- .../compute/live_migrate_integration_test.py | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/cloudroast/blockstorage/volumes_api/integration/compute/live_migrate_integration_test.py b/cloudroast/blockstorage/volumes_api/integration/compute/live_migrate_integration_test.py index c5cd2829..abece884 100644 --- a/cloudroast/blockstorage/volumes_api/integration/compute/live_migrate_integration_test.py +++ b/cloudroast/blockstorage/volumes_api/integration/compute/live_migrate_integration_test.py @@ -19,7 +19,6 @@ from cloudcafe.compute.composites import ComputeAdminComposite from cloudroast.blockstorage.volumes_api.integration.compute.fixtures \ import ComputeIntegrationTestFixture -# from cloudcafe.blockstorage.datasets import ComputeIntegrationDatasets from cloudroast.blockstorage.volumes_api.integration.compute.datasets \ import bfv_datasets @@ -41,18 +40,35 @@ class BootFromVolumeLiveMigrateIntegration(ComputeIntegrationTestFixture): volume.id_, True, 'vda', volume.size, volume_type.id_) # Boot a server from the volume - server = self.servers.behaviors.create_active_server( + self.server = self.servers.behaviors.create_active_server( name=self.random_server_name(), flavor_ref=flavor.id, block_device_mapping=bdm).entity # Connect to server - self.server_conn = self.connect_to_instance(server, os_type=os_type) + self.server_conn = self.connect_to_instance( + self.server, os_type=os_type) + + # Create list for extra volumes + extra_volumes = [] # Create and attach seven volumes - for x in range(0, 6): - extra_volumes = self.new_volume() - self.compute.volume_attachments.behaviors.attach_volume_to_server( - server.id, extra_volumes.id_) + for x in range(0, 7): + bonus_volume = self.new_volume() + resp = self.compute.volume_attachments.behaviors. \ + _validated_volume_attach(self.server.id, bonus_volume.id_) + extra_volumes.append((bonus_volume, resp.entity)) + + for extra_volume, attachment in extra_volumes: + + # Todo: This works because a single volume attaches to a server + # Must be fixed when multi-attach becomes available + + self.compute.volume_attachments.behaviors. \ + wait_for_attachment_to_propagate( + attachment.id_, self.server.id) + self.compute.volume_attachments.behaviors. \ + verify_volume_status_progression_during_attachment( + extra_volume.id_) # Write data to the root disk resp = self.server_conn.create_large_file(multiplier=0.1) @@ -65,4 +81,9 @@ class BootFromVolumeLiveMigrateIntegration(ComputeIntegrationTestFixture): self.compute_admin.servers.client.live_migrate_server( self.server.id, block_migration=True, disk_over_commit=False) self.compute_admin.servers.behaviors.wait_for_server_status( - self.server.id, "active") + self.server.id, "ACTIVE") + + # Verify seven volumes are "in use" + for extra_volume, attachment in extra_volumes: + self.compute.volume_attachments.behaviors._get_volume_status( + extra_volume.id_)