Skip to content

Commit 281e038

Browse files
Merge pull request #1858 from edsonarios/issue1856
Updated command slcli block snapshot-order, added flag iops
2 parents 8de063b + 0e9d089 commit 281e038

File tree

15 files changed

+58
-44
lines changed

15 files changed

+58
-44
lines changed

SoftLayer/CLI/block/snapshot/cancel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1313
@click.argument('volume-id')
14-
@click.option('--reason', help="An optional reason for cancellation")
14+
@click.option('--reason', help="An optional reason for cancellation.")
1515
@click.option('--immediate',
1616
is_flag=True,
1717
help="Cancels the snapshot space immediately instead "
18-
"of on the billing anniversary")
18+
"of on the billing anniversary.")
1919
@environment.pass_env
2020
def cli(env, volume_id, reason, immediate):
2121
"""Cancel existing snapshot space for a given volume."""

SoftLayer/CLI/block/snapshot/create.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1010
@click.argument('volume_id')
1111
@click.option('--notes', '-n',
12-
help='Notes to set on the new snapshot')
12+
help='Notes to set on the new snapshot.')
1313
@environment.pass_env
1414
def cli(env, volume_id, notes):
15-
"""Creates a snapshot on a given volume"""
15+
"""Creates a snapshot on a given volume."""
1616
block_manager = SoftLayer.BlockStorageManager(env.client)
1717
snapshot = block_manager.create_snapshot(volume_id, notes=notes)
1818

SoftLayer/CLI/block/snapshot/delete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@click.argument('snapshot_id')
1111
@environment.pass_env
1212
def cli(env, snapshot_id):
13-
"""Deletes a snapshot on a given volume"""
13+
"""Deletes a snapshot on a given volume."""
1414
block_manager = SoftLayer.BlockStorageManager(env.client)
1515
deleted = block_manager.delete_snapshot(snapshot_id)
1616

SoftLayer/CLI/block/snapshot/disable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1111
@click.argument('volume_id')
1212
@click.option('--schedule-type',
13-
help='Snapshot schedule [INTERVAL|HOURLY|DAILY|WEEKLY]',
13+
help='Snapshot schedule [INTERVAL|HOURLY|DAILY|WEEKLY].',
1414
required=True)
1515
@environment.pass_env
1616
def cli(env, volume_id, schedule_type):
17-
"""Disables snapshots on the specified schedule for a given volume"""
17+
"""Disables snapshots on the specified schedule for a given volume."""
1818

1919
if (schedule_type not in ['INTERVAL', 'HOURLY', 'DAILY', 'WEEKLY']):
2020
raise exceptions.CLIAbort(

SoftLayer/CLI/block/snapshot/enable.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@
1010
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1111
@click.argument('volume_id')
1212
@click.option('--schedule-type',
13-
help='Snapshot schedule [INTERVAL|HOURLY|DAILY|WEEKLY]',
13+
help='Snapshot schedule [INTERVAL|HOURLY|DAILY|WEEKLY].',
1414
required=True)
1515
@click.option('--retention-count',
16-
help='Number of snapshots to retain',
16+
help='Number of snapshots to retain.',
1717
required=True)
1818
@click.option('--minute',
19-
help='Minute of the day when snapshots should be taken',
19+
help='Minute of the day when snapshots should be taken.',
2020
default=0)
2121
@click.option('--hour',
22-
help='Hour of the day when snapshots should be taken',
22+
help='Hour of the day when snapshots should be taken.',
2323
default=0)
2424
@click.option('--day-of-week',
25-
help='Day of the week when snapshots should be taken',
25+
help='Day of the week when snapshots should be taken.',
2626
default='SUNDAY')
2727
@environment.pass_env
2828
def cli(env, volume_id, schedule_type, retention_count,
2929
minute, hour, day_of_week):
30-
"""Enables snapshots for a given volume on the specified schedule"""
30+
"""Enables snapshots for a given volume on the specified schedule."""
3131
block_manager = SoftLayer.BlockStorageManager(env.client)
3232

3333
valid_schedule_types = {'INTERVAL', 'HOURLY', 'DAILY', 'WEEKLY'}

SoftLayer/CLI/block/snapshot/get_notify_status.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@click.argument('volume_id')
1111
@environment.pass_env
1212
def cli(env, volume_id):
13-
"""Get snapshots space usage threshold warning flag setting for a given volume"""
13+
"""Get snapshots space usage threshold warning flag setting for a given volume."""
1414
block_manager = SoftLayer.BlockStorageManager(env.client)
1515
enabled = block_manager.get_volume_snapshot_notification_status(volume_id)
1616

SoftLayer/CLI/block/snapshot/list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
3030
@click.argument('volume_id')
31-
@click.option('--sortby', help='Column to sort by',
31+
@click.option('--sortby', help='Column to sort by.',
3232
default='created')
3333
@click.option('--columns',
3434
callback=column_helper.get_formatter(COLUMNS),

SoftLayer/CLI/block/snapshot/order.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,45 @@
99

1010
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1111
@click.argument('volume_id')
12-
@click.option('--capacity',
12+
@click.option('--iops',
1313
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.',
1518
required=True)
1619
@click.option('--tier',
1720
help='Endurance Storage Tier (IOPS per GB) of the block'
1821
' volume for which space is ordered [optional, and only'
19-
' valid for endurance storage volumes]',
22+
' valid for endurance storage volumes].',
2023
type=click.Choice(['0.25', '2', '4', '10']))
2124
@click.option('--upgrade',
2225
type=bool,
23-
help='Flag to indicate that the order is an upgrade',
26+
help='Flag to indicate that the order is an upgrade.',
2427
default=False,
2528
is_flag=True)
2629
@environment.pass_env
27-
def cli(env, volume_id, capacity, tier, upgrade):
30+
def cli(env, volume_id, size, tier, upgrade, iops):
2831
"""Order snapshot space for a block storage volume."""
2932
block_manager = SoftLayer.BlockStorageManager(env.client)
3033

3134
if tier is not None:
3235
tier = float(tier)
3336

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+
3444
try:
3545
order = block_manager.order_snapshot_space(
3646
volume_id,
37-
capacity=capacity,
47+
capacity=size,
3848
tier=tier,
39-
upgrade=upgrade
49+
upgrade=upgrade,
50+
iops=iops
4051
)
4152
except ValueError as ex:
4253
raise exceptions.ArgumentError(str(ex))

SoftLayer/CLI/block/snapshot/restore.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
@click.argument('volume_id')
1111
@click.option('--snapshot-id', '-s',
1212
help='The id of the snapshot which will be used'
13-
' to restore the block volume')
13+
' to restore the block volume.')
1414
@environment.pass_env
1515
def cli(env, volume_id, snapshot_id):
16-
"""Restore block volume using a given snapshot"""
16+
"""Restore block volume using a given snapshot."""
1717
block_manager = SoftLayer.BlockStorageManager(env.client)
1818
success = block_manager.restore_from_snapshot(volume_id, snapshot_id)
1919

SoftLayer/CLI/block/snapshot/schedule_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@click.argument('volume_id')
1212
@environment.pass_env
1313
def cli(env, volume_id):
14-
"""Lists snapshot schedules for a given volume"""
14+
"""Lists snapshot schedules for a given volume."""
1515

1616
block_manager = SoftLayer.BlockStorageManager(env.client)
1717

0 commit comments

Comments
 (0)