Skip to content

Commit 0ea78de

Browse files
Merge pull request #1832 from ko101/master
update volume-refresh command
2 parents e63d10a + 07b2303 commit 0ea78de

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

SoftLayer/CLI/block/refresh.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1010
@click.argument('volume_id')
1111
@click.argument('snapshot_id')
12+
@click.option('--force-refresh', '-f', is_flag=True, default=False, show_default=True,
13+
help="Cancel current refresh process and initiates the new refresh.")
1214
@environment.pass_env
13-
def cli(env, volume_id, snapshot_id):
15+
def cli(env, volume_id, snapshot_id, force_refresh):
1416
"""Refresh a duplicate volume with a snapshot from its parent."""
1517
block_manager = SoftLayer.BlockStorageManager(env.client)
16-
resp = block_manager.refresh_dupe(volume_id, snapshot_id)
18+
resp = block_manager.refresh_dupe(volume_id, snapshot_id, force_refresh)
1719

1820
click.echo(resp)

SoftLayer/CLI/file/refresh.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1010
@click.argument('volume_id')
1111
@click.argument('snapshot_id')
12+
@click.option('--force-refresh', '-f', is_flag=True, default=False, show_default=True,
13+
help="Cancel current refresh process and initiates the new refresh.")
1214
@environment.pass_env
13-
def cli(env, volume_id, snapshot_id):
15+
def cli(env, volume_id, snapshot_id, force_refresh):
1416
"""Refresh a duplicate volume with a snapshot from its parent."""
1517
file_manager = SoftLayer.FileStorageManager(env.client)
16-
resp = file_manager.refresh_dupe(volume_id, snapshot_id)
18+
resp = file_manager.refresh_dupe(volume_id, snapshot_id, force_refresh)
1719

1820
click.echo(resp)

SoftLayer/managers/storage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,15 +563,17 @@ def cancel_volume(self,
563563
reason,
564564
id=billing_item_id)
565565

566-
def refresh_dupe(self, volume_id, snapshot_id):
566+
def refresh_dupe(self, volume_id, snapshot_id, force_refresh=False):
567567
""""Refresh a duplicate volume with a snapshot from its parent.
568568
569569
:param integer volume_id: The id of the volume
570570
:param integer snapshot_id: The id of the snapshot
571+
:param boolean force_refresh: Force refreshing the volume if True
571572
"""
572573
return self.client.call('Network_Storage',
573574
'refreshDuplicate',
574575
snapshot_id,
576+
force_refresh,
575577
id=volume_id)
576578

577579
def convert_dep_dupe(self, volume_id):

0 commit comments

Comments
 (0)