Skip to content

Commit 8a56dcd

Browse files
#959 added warning message when ordering legacy storage offerings from the cli, removed restriction on IOPS being multiples of 100 for performance volumes
1 parent e9b174c commit 8a56dcd

File tree

4 files changed

+28
-61
lines changed

4 files changed

+28
-61
lines changed

SoftLayer/CLI/block/order.py

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,14 @@
1717
required=True)
1818
@click.option('--size',
1919
type=int,
20-
help='Size of block storage volume in GB. Permitted Sizes:\n'
21-
'20, 40, 80, 100, 250, 500, 1000, 2000, 4000, 8000, 12000',
20+
help='Size of block storage volume in GB.',
2221
required=True)
2322
@click.option('--iops',
2423
type=int,
25-
help='Performance Storage IOPs,'
26-
' between 100 and 6000 in multiples of 100'
27-
' [required for storage-type performance]')
24+
help="""Performance Storage IOPs. Options vary based on storage size.
25+
[required for storage-type performance]""")
2826
@click.option('--tier',
29-
help='Endurance Storage Tier (IOP per GB)'
30-
' [required for storage-type endurance]',
27+
help='Endurance Storage Tier (IOP per GB) [required for storage-type endurance]',
3128
type=click.Choice(['0.25', '2', '4', '10']))
3229
@click.option('--os-type',
3330
help='Operating System',
@@ -49,8 +46,8 @@
4946
'space along with endurance block storage; specifies '
5047
'the size (in GB) of snapshot space to order')
5148
@click.option('--service-offering',
52-
help='The service offering package to use for placing '
53-
'the order [optional, default is \'storage_as_a_service\']',
49+
help="""The service offering package to use for placing the order.
50+
[optional, default is \'storage_as_a_service\']. enterprise and performance are depreciated""",
5451
default='storage_as_a_service',
5552
type=click.Choice([
5653
'storage_as_a_service',
@@ -71,26 +68,21 @@ def cli(env, storage_type, size, iops, tier, os_type,
7168
if billing.lower() == "hourly":
7269
hourly_billing_flag = True
7370

74-
if hourly_billing_flag and service_offering != 'storage_as_a_service':
75-
raise exceptions.CLIAbort(
76-
'Hourly billing is only available for the storage_as_a_service '
77-
'service offering'
78-
)
71+
if service_offering != 'storage_as_a_service':
72+
click.secho('{} is a legacy storage offering'.format(service_offering), fg='red')
73+
if hourly_billing_flag:
74+
raise exceptions.CLIAbort(
75+
'Hourly billing is only available for the storage_as_a_service service offering'
76+
)
7977

8078
if storage_type == 'performance':
8179
if iops is None:
82-
raise exceptions.CLIAbort(
83-
'Option --iops required with Performance')
84-
85-
if iops % 100 != 0:
86-
raise exceptions.CLIAbort(
87-
'Option --iops must be a multiple of 100'
88-
)
80+
raise exceptions.CLIAbort('Option --iops required with Performance')
8981

9082
if service_offering == 'performance' and snapshot_size is not None:
9183
raise exceptions.CLIAbort(
92-
'--snapshot-size is not available for performance volumes '
93-
'ordered with the \'performance\' service offering option'
84+
'--snapshot-size is not available for performance service offerings. '
85+
'Use --service-offering storage_as_a_service'
9486
)
9587

9688
try:
@@ -110,8 +102,7 @@ def cli(env, storage_type, size, iops, tier, os_type,
110102
if storage_type == 'endurance':
111103
if tier is None:
112104
raise exceptions.CLIAbort(
113-
'Option --tier required with Endurance in IOPS/GB '
114-
'[0.25,2,4,10]'
105+
'Option --tier required with Endurance in IOPS/GB [0.25,2,4,10]'
115106
)
116107

117108
try:
@@ -134,5 +125,4 @@ def cli(env, storage_type, size, iops, tier, os_type,
134125
for item in order['placedOrder']['items']:
135126
click.echo(" > %s" % item['description'])
136127
else:
137-
click.echo("Order could not be placed! Please verify your options " +
138-
"and try again.")
128+
click.echo("Order could not be placed! Please verify your options and try again.")

SoftLayer/CLI/file/order.py

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@
2121
required=True)
2222
@click.option('--iops',
2323
type=int,
24-
help='Performance Storage IOPs,'
25-
' between 100 and 6000 in multiples of 100'
26-
' [required for storage-type performance]')
24+
help="""Performance Storage IOPs. Options vary based on storage size.
25+
[required for storage-type performance]""")
2726
@click.option('--tier',
28-
help='Endurance Storage Tier (IOP per GB)'
29-
' [required for storage-type endurance]',
27+
help='Endurance Storage Tier (IOP per GB) [required for storage-type endurance]',
3028
type=click.Choice(['0.25', '2', '4', '10']))
3129
@click.option('--location',
3230
help='Datacenter short name (e.g.: dal09)',
@@ -59,22 +57,18 @@ def cli(env, storage_type, size, iops, tier,
5957
if billing.lower() == "hourly":
6058
hourly_billing_flag = True
6159

62-
if hourly_billing_flag and service_offering != 'storage_as_a_service':
63-
raise exceptions.CLIAbort(
64-
'Hourly billing is only available for the storage_as_a_service '
65-
'service offering'
66-
)
60+
if service_offering != 'storage_as_a_service':
61+
click.secho('{} is a legacy storage offering'.format(service_offering), fg='red')
62+
if hourly_billing_flag:
63+
raise exceptions.CLIAbort(
64+
'Hourly billing is only available for the storage_as_a_service service offering'
65+
)
6766

6867
if storage_type == 'performance':
6968
if iops is None:
7069
raise exceptions.CLIAbort(
7170
'Option --iops required with Performance')
7271

73-
if iops % 100 != 0:
74-
raise exceptions.CLIAbort(
75-
'Option --iops must be a multiple of 100'
76-
)
77-
7872
if service_offering == 'performance' and snapshot_size is not None:
7973
raise exceptions.CLIAbort(
8074
'--snapshot-size is not available for performance volumes '
@@ -97,8 +91,7 @@ def cli(env, storage_type, size, iops, tier,
9791
if storage_type == 'endurance':
9892
if tier is None:
9993
raise exceptions.CLIAbort(
100-
'Option --tier required with Endurance in IOPS/GB '
101-
'[0.25,2,4,10]'
94+
'Option --tier required with Endurance in IOPS/GB [0.25,2,4,10]'
10295
)
10396

10497
try:
@@ -120,5 +113,4 @@ def cli(env, storage_type, size, iops, tier,
120113
for item in order['placedOrder']['items']:
121114
click.echo(" > %s" % item['description'])
122115
else:
123-
click.echo("Order could not be placed! Please verify your options " +
124-
"and try again.")
116+
click.echo("Order could not be placed! Please verify your options and try again.")

tests/CLI/modules/block_tests.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,6 @@ def test_volume_order_performance_iops_not_given(self):
141141

142142
self.assertEqual(2, result.exit_code)
143143

144-
def test_volume_order_performance_iops_not_multiple_of_100(self):
145-
result = self.run_command(['block', 'volume-order',
146-
'--storage-type=performance', '--size=20',
147-
'--iops=122', '--os-type=linux',
148-
'--location=dal05'])
149-
150-
self.assertEqual(2, result.exit_code)
151-
152144
def test_volume_order_performance_snapshot_error(self):
153145
result = self.run_command(['block', 'volume-order',
154146
'--storage-type=performance', '--size=20',

tests/CLI/modules/file_tests.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,6 @@ def test_volume_order_performance_iops_not_given(self):
144144

145145
self.assertEqual(2, result.exit_code)
146146

147-
def test_volume_order_performance_iops_not_multiple_of_100(self):
148-
result = self.run_command(['file', 'volume-order',
149-
'--storage-type=performance', '--size=20',
150-
'--iops=122', '--location=dal05'])
151-
152-
self.assertEqual(2, result.exit_code)
153-
154147
def test_volume_order_performance_snapshot_error(self):
155148
result = self.run_command(['file', 'volume-order',
156149
'--storage-type=performance', '--size=20',

0 commit comments

Comments
 (0)