Skip to content

Commit 109ea5a

Browse files
author
Ian Sutton
committed
bring in convert/refresh funcs
1 parent 7a651b0 commit 109ea5a

File tree

8 files changed

+115
-0
lines changed

8 files changed

+115
-0
lines changed

SoftLayer/CLI/block/convert.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""Convert a dependent duplicate volume to an indepdent volume."""
2+
# :license: MIT, see LICENSE for more details.
3+
4+
import click
5+
import SoftLayer
6+
from SoftLayer.CLI import environment
7+
8+
9+
@click.command()
10+
@click.argument('volume_id')
11+
@environment.pass_env
12+
def cli(env, volume_id):
13+
"""Convert a dependent duplicate volume to an indepdent volume."""
14+
block_manager = SoftLayer.BlockStorageManager(env.client)
15+
resp = block_manager.convert_dep_dupe(volume_id)
16+
17+
click.echo(resp)

SoftLayer/CLI/block/refresh.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Refresh a dependent duplicate volume with a snapshot from its parent."""
2+
# :license: MIT, see LICENSE for more details.
3+
4+
import click
5+
import SoftLayer
6+
from SoftLayer.CLI import environment
7+
8+
9+
@click.command()
10+
@click.argument('volume_id')
11+
@click.argument('snapshot_id')
12+
@environment.pass_env
13+
def cli(env, volume_id, snapshot_id):
14+
""""Refresh a dependent duplicate volume with a snapshot from its parent."""
15+
block_manager = SoftLayer.BlockStorageManager(env.client)
16+
resp = block_manager.refresh_dep_dupe(volume_id, snapshot_id)
17+
18+
click.echo(resp)

SoftLayer/CLI/file/convert.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""Convert a dependent duplicate volume to an indepdent volume."""
2+
# :license: MIT, see LICENSE for more details.
3+
4+
import click
5+
import SoftLayer
6+
from SoftLayer.CLI import environment
7+
8+
9+
@click.command()
10+
@click.argument('volume_id')
11+
@environment.pass_env
12+
def cli(env, volume_id):
13+
"""Convert a dependent duplicate volume to an indepdent volume."""
14+
file_manager = SoftLayer.FileStorageManager(env.client)
15+
resp = file_manager.convert_dep_dupe(volume_id)
16+
17+
click.echo(resp)

SoftLayer/CLI/file/refresh.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Refresh a dependent duplicate volume with a snapshot from its parent."""
2+
# :license: MIT, see LICENSE for more details.
3+
4+
import click
5+
import SoftLayer
6+
from SoftLayer.CLI import environment
7+
8+
9+
@click.command()
10+
@click.argument('volume_id')
11+
@click.argument('snapshot_id')
12+
@environment.pass_env
13+
def cli(env, volume_id, snapshot_id):
14+
""""Refresh a dependent duplicate volume with a snapshot from its parent."""
15+
file_manager = SoftLayer.FileStorageManager(env.client)
16+
resp = file_manager.refresh_dep_dupe(volume_id, snapshot_id)
17+
18+
click.echo(resp)

SoftLayer/CLI/routes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@
106106
('block:volume-order', 'SoftLayer.CLI.block.order:cli'),
107107
('block:volume-set-lun-id', 'SoftLayer.CLI.block.lun:cli'),
108108
('block:volume-limits', 'SoftLayer.CLI.block.limit:cli'),
109+
('block:volume-refresh', 'SoftLayer.CLI.block.refresh:cli'),
110+
('block:volume-convert', 'SoftLayer.CLI.block.convert:cli'),
109111

110112
('event-log', 'SoftLayer.CLI.event_log'),
111113
('event-log:get', 'SoftLayer.CLI.event_log.get:cli'),
@@ -137,6 +139,8 @@
137139
('file:volume-modify', 'SoftLayer.CLI.file.modify:cli'),
138140
('file:volume-order', 'SoftLayer.CLI.file.order:cli'),
139141
('file:volume-limits', 'SoftLayer.CLI.file.limit:cli'),
142+
('file:volume-refresh', 'SoftLayer.CLI.file.refresh:cli'),
143+
('file:volume-convert', 'SoftLayer.CLI.file.convert:cli'),
140144

141145
('firewall', 'SoftLayer.CLI.firewall'),
142146
('firewall:add', 'SoftLayer.CLI.firewall.add:cli'),

SoftLayer/managers/block.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,3 +616,20 @@ def create_or_update_lun_id(self, volume_id, lun_id):
616616
"""
617617
return self.client.call('Network_Storage', 'createOrUpdateLunId',
618618
lun_id, id=volume_id)
619+
620+
def refresh_dep_dupe(self, volume_id, snapshot_id):
621+
""""Refresh a dependent duplicate volume with a snapshot from its parent.
622+
623+
:param integer volume_id: The id of the volume
624+
:param integer snapshot_id: The id of the snapshot
625+
"""
626+
return self.client.call('Network_Storage', 'refreshDependentDuplicate',
627+
snapshot_id, id=volume_id)
628+
629+
def convert_dep_dupe(self, volume_id):
630+
"""Convert a dependent duplicate volume to an indepdent volume.
631+
632+
:param integer volume_id: The id of the volume.
633+
"""
634+
return self.client.call('Network_Storage', 'convertCloneDependentToIndependent',
635+
id=volume_id)

SoftLayer/managers/file.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,3 +527,20 @@ def failback_from_replicant(self, volume_id):
527527
"""
528528

529529
return self.client.call('Network_Storage', 'failbackFromReplicant', id=volume_id)
530+
531+
def refresh_dep_dupe(self, volume_id, snapshot_id):
532+
""""Refresh a dependent duplicate volume with a snapshot from its parent.
533+
534+
:param integer volume_id: The id of the volume
535+
:param integer snapshot_id: The id of the snapshot
536+
"""
537+
return self.client.call('Network_Storage', 'refreshDependentDuplicate',
538+
snapshot_id, id=volume_id)
539+
540+
def convert_dep_dupe(self, volume_id):
541+
"""Convert a dependent duplicate volume to an indepdent volume.
542+
543+
:param integer volume_id: The id of the volume.
544+
"""
545+
return self.client.call('Network_Storage', 'convertCloneDependentToIndependent',
546+
id=volume_id)

docs/cli/block.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ Block Commands
111111
:prog: block volume-limits
112112
:show-nested:
113113

114+
.. click:: SoftLayer.CLI.block.refresh:cli
115+
:prog block volume-refresh
116+
:show-nested:
117+
118+
.. click:: SoftLayer.CLI.block.convert:cli
119+
:prog block volume-convert
120+
:show-nested:
114121

115122
.. click:: SoftLayer.CLI.block.subnets.list:cli
116123
:prog: block subnets-list

0 commit comments

Comments
 (0)