|
14 | 14 |
|
15 | 15 | @click.command(cls=SoftLayer.CLI.command.SLCommand, context_settings=CONTEXT_SETTINGS) |
16 | 16 | @click.argument('volume_id') |
17 | | -@click.option('--snapshot-schedule', '-s', |
18 | | - help='Snapshot schedule to use for replication, ' |
19 | | - '(HOURLY | DAILY | WEEKLY)', |
20 | | - required=True, |
21 | | - type=click.Choice(['HOURLY', 'DAILY', 'WEEKLY'])) |
22 | | -@click.option('--location', '-l', |
23 | | - help='Short name of the data center for the replicant ' |
24 | | - '(e.g.: dal09)', |
| 17 | +@click.option('--datacenter', '-d', |
| 18 | + help='Short name of the datacenter for the replica (e.g.: dal09)', |
25 | 19 | required=True) |
26 | | -@click.option('--tier', |
27 | | - help='Endurance Storage Tier (IOPS per GB) of the primary' |
28 | | - ' volume for which a replicant is ordered [optional]', |
29 | | - type=click.Choice(['0.25', '2', '4', '10'])) |
30 | | -@click.option('--os-type', |
31 | | - help='Operating System Type (e.g.: LINUX) of the primary' |
32 | | - ' volume for which a replica is ordered [optional]', |
| 20 | +@click.option('--iops', '-i', |
| 21 | + help='Performance Storage IOPs, between 100 and 6000 in multiples of 100. If no IOPS value is specified,' |
| 22 | + ' the IOPS value of the original volume will be used.', |
| 23 | + type=int) |
| 24 | +@click.option('--os-type', '-o', |
| 25 | + help='Operating System Type (eg. LINUX) of the primary volume for ' |
| 26 | + 'which a replica is ordered [optional].', |
33 | 27 | type=click.Choice([ |
34 | 28 | 'HYPER_V', |
35 | 29 | 'LINUX', |
|
38 | 32 | 'WINDOWS_GPT', |
39 | 33 | 'WINDOWS', |
40 | 34 | 'XEN'])) |
| 35 | +@click.option('--snapshot-schedule', '-s', |
| 36 | + help='Snapshot schedule to use for replication. Options are: ' |
| 37 | + 'HOURLY, DAILY, WEEKLY', |
| 38 | + required=True, |
| 39 | + type=click.Choice(['HOURLY', 'DAILY', 'WEEKLY'])) |
| 40 | +@click.option('--tier', '-t', |
| 41 | + help='Endurance Storage Tier (IOPS per GB) of the primary volume for which a replica is ordered ' |
| 42 | + '[optional]. If no tier is specified, the tier of the original volume will be used', |
| 43 | + type=click.Choice(['0.25', '2', '4', '10'])) |
41 | 44 | @environment.pass_env |
42 | | -def cli(env, volume_id, snapshot_schedule, location, tier, os_type): |
| 45 | +def cli(env, volume_id, snapshot_schedule, datacenter, tier, os_type, iops): |
43 | 46 | """Order a block storage replica volume.""" |
44 | 47 | block_manager = SoftLayer.BlockStorageManager(env.client) |
45 | 48 | block_volume_id = helpers.resolve_id(block_manager.resolve_ids, volume_id, 'Block Volume') |
46 | 49 |
|
47 | 50 | if tier is not None: |
48 | 51 | tier = float(tier) |
49 | 52 |
|
| 53 | + if iops is not None: |
| 54 | + if iops < 100 or iops > 6000: |
| 55 | + raise exceptions.ArgumentError(f"Invalid value for '--iops' / '-i': '{iops}' is not one " |
| 56 | + "of between 100 and 6000.") |
| 57 | + if iops % 100 != 0: |
| 58 | + raise exceptions.ArgumentError(f"Invalid value for '--iops' / '-i': '{iops}' is not a multiple of 100.") |
| 59 | + |
50 | 60 | try: |
51 | 61 | order = block_manager.order_replicant_volume( |
52 | 62 | block_volume_id, |
53 | 63 | snapshot_schedule=snapshot_schedule, |
54 | | - location=location, |
| 64 | + location=datacenter, |
55 | 65 | tier=tier, |
56 | 66 | os_type=os_type, |
| 67 | + iops=iops |
57 | 68 | ) |
58 | 69 | except ValueError as ex: |
59 | 70 | raise exceptions.ArgumentError(str(ex)) |
|
0 commit comments