Skip to content

Commit 9335852

Browse files
committed
Rename custom disk for simulated ssd backed instances
1 parent 249834f commit 9335852

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

ec2stack/configure.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ def _set_optional_attributes_of_profile(config, profile):
169169
@return: configparser configuration.
170170
"""
171171

172-
configure_instance_type_mapings = raw_input(
173-
'Do you wish to input a local custom storage disk for instances? (Yes/No): '
172+
configure_instance_disk = raw_input(
173+
'Do you wish to input a second custom storage disk for instances? (Yes/No): '
174174
)
175175

176-
if configure_instance_type_mapings.lower() in ['yes', 'y']:
176+
if configure_instance_disk.lower() in ['yes', 'y']:
177177
config = _set_attribute_of_profile(
178-
config, profile, 'cloudstack_local_custom_disk_offering', 'Cloudstack custom local disk offering name', 'CustomLocal'
178+
config, profile, 'cloudstack_instance_custom_disk_offering', 'Cloudstack custom instance disk offering name', 'CustomInstance'
179179
)
180180

181181
configure_instance_type_mapings = raw_input(

ec2stack/providers/cloudstack/instances.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from ec2stack.providers import cloudstack
1111
from ec2stack.providers.cloudstack import requester, service_offerings, zones, \
12-
disk_offerings, volumes
12+
disk_offerings
1313
from ec2stack import helpers, errors
1414

1515

@@ -178,9 +178,15 @@ def _run_instance_request():
178178
if helpers.get('BlockDeviceMapping.1.Ebs.VolumeType') is not None:
179179
disk_type = helpers.get('BlockDeviceMapping.1.Ebs.VolumeType')
180180
if disk_type == 'gp2':
181-
args['diskofferingid'] = disk_offerings.get_disk_offering(
182-
current_app.config['CLOUDSTACK_LOCAL_CUSTOM_DISK_OFFERING']
183-
)['id']
181+
if 'CLOUDSTACK_INSTANCE_CUSTOM_DISK_OFFERING' in current_app.config:
182+
args['diskofferingid'] = disk_offerings.get_disk_offering(
183+
current_app.config['CLOUDSTACK_INSTANCE_CUSTOM_DISK_OFFERING']
184+
)['id']
185+
else:
186+
errors.invalid_request(
187+
"Unable to configure secondary disk, please run ec2stack-configure and choose to "
188+
"configure an instance disk")
189+
184190
if helpers.get('BlockDeviceMapping.1.Ebs.VolumeSize') is None:
185191
errors.invalid_request("VolumeSize not found in BlockDeviceMapping")
186192
else:

0 commit comments

Comments
 (0)