Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed custom storage for AMIs #5625

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions deployability/modules/allocation/aws/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,15 @@ def __create_ec2_instance(config: AWSConfig) -> str:
# Describe the AMI to get the root device name
ami = client.describe_images(ImageIds=[config.ami])
root_device_name = ami['Images'][0]['RootDeviceName']
ami_storage = ami['Images'][0]['BlockDeviceMappings'][0]['Ebs']['VolumeSize']

if ami_storage > config.storage:
config.storage = ami_storage

if config.platform == 'windows':
with open(windosUserData_file, 'r') as file:
userData = file.read()
userData = userData.replace('ChangeMe', config.key_name)
config.storage = 60
else:
with open(userData_file, 'r') as file:
userData = file.read()
Expand Down Expand Up @@ -278,12 +281,11 @@ def __parse_config(cls, params: CreationPayload, credentials: AWSCredentials, is
# Parse the configuration.
if platform == 'macos':
os_specs['zone'] = os_specs['zone'] + 'c'
config['storage'] = 0
if arch == 'arm64':
config['type'] = 'mac2.metal'
config['storage'] = 100
if arch == 'amd64':
config['type'] = 'mac1.metal'
config['storage'] = 100
else:
for spec in size_specs:
if fnmatch.fnmatch(arch, spec):
Expand Down