Skip to content

Commit

Permalink
Bugfix: gracefully handle incorrectly set min_disk property (#689)
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Büchse <[email protected]>
  • Loading branch information
mbuechse authored Aug 6, 2024
1 parent c580700 commit 2d7f7d3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Tests/iaas/entropy/entropy-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,17 @@ def create_vm(env, all_flavors, image, server_name=SERVER_NAME):
# try to pick a frugal flavor
flavor = min(flavors, key=lambda flv: flv.vcpus + flv.ram / 3.0 + flv.disk / 10.0)
userdata = next((value for key, value in SERVER_USERDATA.items() if image.name.lower().startswith(key)), None)
volume_size = max(image.min_disk, 8) # sometimes, the min_disk property is not set correctly
# create a server with the image and the flavor as well as
# the previously created keys and security group
logger.debug(
f"Creating instance of image '{image.name}' using flavor '{flavor.name}' and "
f"{image.min_disk} GiB ephemeral boot volume"
f"{volume_size} GiB ephemeral boot volume"
)
server = env.conn.create_server(
server_name, image=image, flavor=flavor, key_name=env.keypair.name, network=env.network,
security_groups=[env.sec_group.id], userdata=userdata, wait=True, timeout=500, auto_ip=True,
boot_from_volume=True, terminate_volume=True, volume_size=image.min_disk,
boot_from_volume=True, terminate_volume=True, volume_size=volume_size,
)
logger.debug(f"Server '{server_name}' ('{server.id}') has been created")
return server
Expand Down

0 comments on commit 2d7f7d3

Please sign in to comment.