|
9 | 9 |
|
10 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) |
11 | 11 | @click.argument('volume_id') |
12 | | -@click.option('--capacity', |
| 12 | +@click.option('--iops', |
13 | 13 | type=int, |
14 | | - help='Size of snapshot space to create in GB', |
| 14 | + help='Performance Storage IOPs, between 100 and 6000 in multiples of 100.') |
| 15 | +@click.option('--size', |
| 16 | + type=int, |
| 17 | + help='Size of snapshot space to create in GB.', |
15 | 18 | required=True) |
16 | 19 | @click.option('--tier', |
17 | 20 | help='Endurance Storage Tier (IOPS per GB) of the block' |
18 | 21 | ' volume for which space is ordered [optional, and only' |
19 | | - ' valid for endurance storage volumes]', |
| 22 | + ' valid for endurance storage volumes].', |
20 | 23 | type=click.Choice(['0.25', '2', '4', '10'])) |
21 | 24 | @click.option('--upgrade', |
22 | 25 | type=bool, |
23 | | - help='Flag to indicate that the order is an upgrade', |
| 26 | + help='Flag to indicate that the order is an upgrade.', |
24 | 27 | default=False, |
25 | 28 | is_flag=True) |
26 | 29 | @environment.pass_env |
27 | | -def cli(env, volume_id, capacity, tier, upgrade): |
| 30 | +def cli(env, volume_id, size, tier, upgrade, iops): |
28 | 31 | """Order snapshot space for a block storage volume.""" |
29 | 32 | block_manager = SoftLayer.BlockStorageManager(env.client) |
30 | 33 |
|
31 | 34 | if tier is not None: |
32 | 35 | tier = float(tier) |
33 | 36 |
|
| 37 | + if iops is not None: |
| 38 | + if iops < 100 or iops > 6000: |
| 39 | + raise exceptions.ArgumentError(f"Invalid value for '--iops' / '-i': '{iops}' is not one " |
| 40 | + "of between 100 and 6000.") |
| 41 | + if iops % 100 != 0: |
| 42 | + raise exceptions.ArgumentError(f"Invalid value for '--iops' / '-i': '{iops}' is not a multiple of 100.") |
| 43 | + |
34 | 44 | try: |
35 | 45 | order = block_manager.order_snapshot_space( |
36 | 46 | volume_id, |
37 | | - capacity=capacity, |
| 47 | + capacity=size, |
38 | 48 | tier=tier, |
39 | | - upgrade=upgrade |
| 49 | + upgrade=upgrade, |
| 50 | + iops=iops |
40 | 51 | ) |
41 | 52 | except ValueError as ex: |
42 | 53 | raise exceptions.ArgumentError(str(ex)) |
|
0 commit comments