Re-use common methods in test_rebuild_server_with_volume_attached
This changes test_rebuild_server_with_volume_attached to re-use
the common volume create/attach methods in the base compute API
test class.
Change-Id: Ieaa69f851148dea329e9e43fc746f308dbe5d343
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 062e920..28ee739 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -235,20 +235,10 @@
@test.services('volume')
def test_rebuild_server_with_volume_attached(self):
# create a new volume and attach it to the server
- volume = self.volumes_client.create_volume(
- size=CONF.volume.volume_size)
- volume = volume['volume']
- self.addCleanup(self.volumes_client.delete_volume, volume['id'])
- waiters.wait_for_volume_status(self.volumes_client, volume['id'],
- 'available')
+ volume = self.create_volume()
- self.client.attach_volume(self.server_id, volumeId=volume['id'])
- self.addCleanup(waiters.wait_for_volume_status, self.volumes_client,
- volume['id'], 'available')
- self.addCleanup(self.client.detach_volume,
- self.server_id, volume['id'])
- waiters.wait_for_volume_status(self.volumes_client, volume['id'],
- 'in-use')
+ server = self.client.show_server(self.server_id)['server']
+ self.attach_volume(server, volume)
# run general rebuild test
self.test_rebuild_server()