Fix creation of EBS images in functional tests
OpenStack cannot delete a volume leaving its snapshots. As a result volumes of an instance which is base of an created EBS image are not deleted. This leads to quota faults in tests launched later. This patch add volumes of EBS instance to cleanup storag to delete them automatically at test's teardown operation. Change-Id: Ie34d26d4f10a2a4b5ebeff93a06d8fd43e305fc1
This commit is contained in:
parent
29e6ce24f0
commit
f340c63658
@ -152,6 +152,11 @@ class ImageTest(base.EC2TestCase):
|
||||
and 'ebs' in image['RootDeviceType'])
|
||||
|
||||
instance_id = self.run_instance(ImageId=image_id)
|
||||
instance = self.get_instance(instance_id)
|
||||
for bdm in instance.get('BlockDeviceMappings', []):
|
||||
if 'Ebs' in bdm:
|
||||
self.addResourceCleanUp(self.client.delete_volume,
|
||||
VolumeId=bdm['Ebs']['VolumeId'])
|
||||
|
||||
data = self.client.create_image(InstanceId=instance_id,
|
||||
Name=name, Description=desc)
|
||||
|
Loading…
Reference in New Issue
Block a user