Skip to content

Commit fe1d00d

Browse files
Merge pull request softlayer#838 from dpickle2/feature/file-block-ordering-updates
Update file/block ordering to support storage_as_a_service package
2 parents 5fd3ecc + 15abd82 commit fe1d00d

File tree

16 files changed

+4685
-2565
lines changed

16 files changed

+4685
-2565
lines changed

SoftLayer/CLI/block/detail.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,18 @@ def cli(env, volume_id):
8686
replicant['id']])
8787
replicant_table.add_row([
8888
'Volume Name',
89-
replicant['username']])
89+
utils.lookup(replicant, 'username')])
9090
replicant_table.add_row([
9191
'Target IP',
92-
replicant['serviceResourceBackendIpAddress']])
92+
utils.lookup(replicant, 'serviceResourceBackendIpAddress')])
9393
replicant_table.add_row([
9494
'Data Center',
95-
replicant['serviceResource']['datacenter']['name']])
95+
utils.lookup(replicant,
96+
'serviceResource', 'datacenter', 'name')])
9697
replicant_table.add_row([
9798
'Schedule',
98-
replicant['replicationSchedule']['type']['keyname']])
99+
utils.lookup(replicant,
100+
'replicationSchedule', 'type', 'keyname')])
99101
replicant_list.append(replicant_table)
100102
table.add_row(['Replicant Volumes', replicant_list])
101103

SoftLayer/CLI/block/order.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,17 @@
4848
help='Optional parameter for ordering snapshot '
4949
'space along with endurance block storage; specifies '
5050
'the size (in GB) of snapshot space to order')
51+
@click.option('--service-offering',
52+
help='The service offering package to use for placing '
53+
'the order [optional, default is \'storage_as_a_service\']',
54+
default='storage_as_a_service',
55+
type=click.Choice([
56+
'storage_as_a_service',
57+
'enterprise',
58+
'performance']))
5159
@environment.pass_env
5260
def cli(env, storage_type, size, iops, tier, os_type,
53-
location, snapshot_size):
61+
location, snapshot_size, service_offering):
5462
"""Order a block storage volume."""
5563
block_manager = SoftLayer.BlockStorageManager(env.client)
5664
storage_type = storage_type.lower()
@@ -60,28 +68,26 @@ def cli(env, storage_type, size, iops, tier, os_type,
6068
raise exceptions.CLIAbort(
6169
'Option --iops required with Performance')
6270

63-
if iops < 100 or iops > 6000:
64-
raise exceptions.CLIAbort(
65-
'Option --iops must be between 100 and 6000, inclusive')
66-
6771
if iops % 100 != 0:
6872
raise exceptions.CLIAbort(
6973
'Option --iops must be a multiple of 100'
7074
)
7175

72-
if snapshot_size is not None:
76+
if service_offering == 'performance' and snapshot_size is not None:
7377
raise exceptions.CLIAbort(
74-
'Option --snapshot-size not allowed for performance volumes.'
75-
'Snapshots are only available for endurance storage.'
78+
'--snapshot-size is not available for performance volumes '
79+
'ordered with the \'performance\' service offering option'
7680
)
7781

7882
try:
7983
order = block_manager.order_block_volume(
80-
storage_type='performance_storage_iscsi',
84+
storage_type=storage_type,
8185
location=location,
8286
size=int(size),
8387
iops=iops,
84-
os_type=os_type
88+
os_type=os_type,
89+
snapshot_size=snapshot_size,
90+
service_offering=service_offering
8591
)
8692
except ValueError as ex:
8793
raise exceptions.ArgumentError(str(ex))
@@ -95,12 +101,13 @@ def cli(env, storage_type, size, iops, tier, os_type,
95101

96102
try:
97103
order = block_manager.order_block_volume(
98-
storage_type='storage_service_enterprise',
104+
storage_type=storage_type,
99105
location=location,
100106
size=int(size),
101107
tier_level=float(tier),
102108
os_type=os_type,
103-
snapshot_size=snapshot_size
109+
snapshot_size=snapshot_size,
110+
service_offering=service_offering
104111
)
105112
except ValueError as ex:
106113
raise exceptions.ArgumentError(str(ex))

SoftLayer/CLI/block/snapshot/order.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
required=True)
1616
@click.option('--tier',
1717
help='Endurance Storage Tier (IOPS per GB) of the block'
18-
' volume for which space is ordered [optional]',
19-
type=click.Choice(['0.25', '2', '4']))
18+
' volume for which space is ordered [optional, and only'
19+
' valid for endurance storage volumes]',
20+
type=click.Choice(['0.25', '2', '4', '10']))
2021
@click.option('--upgrade',
2122
type=bool,
2223
help='Flag to indicate that the order is an upgrade',

SoftLayer/CLI/file/detail.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,18 @@ def cli(env, volume_id):
102102
replicant['id']])
103103
replicant_table.add_row([
104104
'Volume Name',
105-
replicant['username']])
105+
utils.lookup(replicant, 'username')])
106106
replicant_table.add_row([
107107
'Target IP',
108-
replicant['serviceResourceBackendIpAddress']])
108+
utils.lookup(replicant, 'serviceResourceBackendIpAddress')])
109109
replicant_table.add_row([
110110
'Data Center',
111-
replicant['serviceResource']['datacenter']['name']])
111+
utils.lookup(replicant,
112+
'serviceResource', 'datacenter', 'name')])
112113
replicant_table.add_row([
113114
'Schedule',
114-
replicant['replicationSchedule']['type']['keyname']])
115+
utils.lookup(replicant,
116+
'replicationSchedule', 'type', 'keyname')])
115117
replicant_list.append(replicant_table)
116118
table.add_row(['Replicant Volumes', replicant_list])
117119

SoftLayer/CLI/file/order.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,17 @@
3636
help='Optional parameter for ordering snapshot '
3737
'space along with endurance file storage; specifies '
3838
'the size (in GB) of snapshot space to order')
39+
@click.option('--service-offering',
40+
help='The service offering package to use for placing '
41+
'the order [optional, default is \'storage_as_a_service\']',
42+
default='storage_as_a_service',
43+
type=click.Choice([
44+
'storage_as_a_service',
45+
'enterprise',
46+
'performance']))
3947
@environment.pass_env
4048
def cli(env, storage_type, size, iops, tier,
41-
location, snapshot_size):
49+
location, snapshot_size, service_offering):
4250
"""Order a file storage volume."""
4351
file_manager = SoftLayer.FileStorageManager(env.client)
4452
storage_type = storage_type.lower()
@@ -48,27 +56,25 @@ def cli(env, storage_type, size, iops, tier,
4856
raise exceptions.CLIAbort(
4957
'Option --iops required with Performance')
5058

51-
if iops < 100 or iops > 6000:
52-
raise exceptions.CLIAbort(
53-
'Option --iops must be between 100 and 6000, inclusive')
54-
5559
if iops % 100 != 0:
5660
raise exceptions.CLIAbort(
5761
'Option --iops must be a multiple of 100'
5862
)
5963

60-
if snapshot_size is not None:
64+
if service_offering == 'performance' and snapshot_size is not None:
6165
raise exceptions.CLIAbort(
62-
'Option --snapshot-size not allowed for performance volumes.'
63-
' Snapshots are only available for endurance storage.'
66+
'--snapshot-size is not available for performance volumes '
67+
'ordered with the \'performance\' service offering option'
6468
)
6569

6670
try:
6771
order = file_manager.order_file_volume(
68-
storage_type='performance_storage_nfs',
72+
storage_type=storage_type,
6973
location=location,
7074
size=size,
71-
iops=iops
75+
iops=iops,
76+
snapshot_size=snapshot_size,
77+
service_offering=service_offering
7278
)
7379
except ValueError as ex:
7480
raise exceptions.ArgumentError(str(ex))
@@ -82,11 +88,12 @@ def cli(env, storage_type, size, iops, tier,
8288

8389
try:
8490
order = file_manager.order_file_volume(
85-
storage_type='storage_service_enterprise',
91+
storage_type=storage_type,
8692
location=location,
8793
size=size,
8894
tier_level=float(tier),
89-
snapshot_size=snapshot_size
95+
snapshot_size=snapshot_size,
96+
service_offering=service_offering
9097
)
9198
except ValueError as ex:
9299
raise exceptions.ArgumentError(str(ex))

SoftLayer/CLI/file/snapshot/order.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
required=True)
1616
@click.option('--tier',
1717
help='Endurance Storage Tier (IOPS per GB) of the file'
18-
' volume for which space is ordered [optional]',
19-
type=click.Choice(['0.25', '2', '4']))
18+
' volume for which space is ordered [optional, and only'
19+
' valid for endurance storage volumes]',
20+
type=click.Choice(['0.25', '2', '4', '10']))
2021
@click.option('--upgrade',
2122
type=bool,
2223
help='Flag to indicate that the order is an upgrade',

0 commit comments

Comments
 (0)