Merge "Fixing 'test_verify_created_server_ephemeral_disk' test"

This commit is contained in:
Jenkins 2016-11-04 10:22:52 +00:00 committed by Gerrit Code Review
commit 7d109103ae

View File

@ -265,22 +265,24 @@ class ServersWithSpecificFlavorTestJSON(base.BaseV2ComputeAdminTest):
self.flavor_ref)['flavor']
def create_flavor_with_ephemeral(ephem_disk):
if ephem_disk > 0:
flavor_name = data_utils.rand_name('eph_flavor')
else:
flavor_name = data_utils.rand_name('no_eph_flavor')
flavor_with_eph_disk_id = data_utils.rand_int_id(start=1000)
ram = flavor_base['ram']
vcpus = flavor_base['vcpus']
disk = flavor_base['disk']
# Create a flavor with ephemeral disk
flavor = (self.flavor_client.
create_flavor(name=flavor_name,
ram=ram, vcpus=vcpus, disk=disk,
id=flavor_with_eph_disk_id,
ephemeral=ephem_disk))['flavor']
if ephem_disk > 0:
# Create a flavor with ephemeral disk
flavor_name = data_utils.rand_name('eph_flavor')
flavor = self.flavor_client.create_flavor(
name=flavor_name, ram=ram, vcpus=vcpus, disk=disk,
id=flavor_with_eph_disk_id, ephemeral=ephem_disk)['flavor']
else:
# Create a flavor without ephemeral disk
flavor_name = data_utils.rand_name('no_eph_flavor')
flavor = self.flavor_client.create_flavor(
name=flavor_name, ram=ram, vcpus=vcpus, disk=disk,
id=flavor_with_eph_disk_id)['flavor']
self.addCleanup(flavor_clean_up, flavor['id'])
return flavor['id']