Skip to content

Commit e8f1417

Browse files
Merge pull request #1655 from ko101/master
New command for getting duplicate convert status
2 parents dae2ec7 + f4cc9fa commit e8f1417

File tree

6 files changed

+80
-0
lines changed

6 files changed

+80
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""Get status for split or move completed percentage of a given block duplicate volume."""
2+
# :license: MIT, see LICENSE for more details.
3+
4+
import click
5+
import SoftLayer
6+
from SoftLayer.CLI import environment
7+
from SoftLayer.CLI import formatting
8+
9+
10+
@click.command(cls=SoftLayer.CLI.command.SLCommand,
11+
epilog="""Get status for split or move completed percentage of a given block duplicate volume.""")
12+
@click.argument('volume-id')
13+
@environment.pass_env
14+
def cli(env, volume_id):
15+
"""Get status for split or move completed percentage of a given block duplicate volume."""
16+
table = formatting.Table(['Username', 'Active Conversion Start Timestamp', 'Completed Percentage'])
17+
18+
block_manager = SoftLayer.BlockStorageManager(env.client)
19+
20+
value = block_manager.convert_dupe_status(volume_id)
21+
22+
table.add_row(
23+
[
24+
value['volumeUsername'],
25+
value['activeConversionStartTime'],
26+
value['deDuplicateConversionPercentage']
27+
]
28+
)
29+
30+
env.fout(table)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""Get status for split or move completed percentage of a given file duplicate volume."""
2+
# :license: MIT, see LICENSE for more details.
3+
4+
import click
5+
import SoftLayer
6+
from SoftLayer.CLI import environment
7+
from SoftLayer.CLI import formatting
8+
9+
10+
@click.command(cls=SoftLayer.CLI.command.SLCommand,
11+
epilog="""Get status for split or move completed percentage of a given file duplicate volume.""")
12+
@click.argument('volume-id')
13+
@environment.pass_env
14+
def cli(env, volume_id):
15+
"""Get status for split or move completed percentage of a given file duplicate volume."""
16+
table = formatting.Table(['Username', 'Active Conversion Start Timestamp', 'Completed Percentage'])
17+
18+
file_manager = SoftLayer.FileStorageManager(env.client)
19+
20+
value = file_manager.convert_dupe_status(volume_id)
21+
22+
table.add_row(
23+
[
24+
value['volumeUsername'],
25+
value['activeConversionStartTime'],
26+
value['deDuplicateConversionPercentage']
27+
]
28+
)
29+
30+
env.fout(table)

SoftLayer/CLI/routes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
('block:access-list', 'SoftLayer.CLI.block.access.list:cli'),
9494
('block:access-revoke', 'SoftLayer.CLI.block.access.revoke:cli'),
9595
('block:access-password', 'SoftLayer.CLI.block.access.password:cli'),
96+
('block:duplicate-convert-status', 'SoftLayer.CLI.block.duplicate_convert_status:cli'),
9697
('block:subnets-list', 'SoftLayer.CLI.block.subnets.list:cli'),
9798
('block:subnets-assign', 'SoftLayer.CLI.block.subnets.assign:cli'),
9899
('block:subnets-remove', 'SoftLayer.CLI.block.subnets.remove:cli'),
@@ -142,6 +143,7 @@
142143
('file:access-authorize', 'SoftLayer.CLI.file.access.authorize:cli'),
143144
('file:access-list', 'SoftLayer.CLI.file.access.list:cli'),
144145
('file:access-revoke', 'SoftLayer.CLI.file.access.revoke:cli'),
146+
('file:duplicate-convert-status', 'SoftLayer.CLI.file.duplicate_convert_status:cli'),
145147
('file:replica-failback', 'SoftLayer.CLI.file.replication.failback:cli'),
146148
('file:replica-failover', 'SoftLayer.CLI.file.replication.failover:cli'),
147149
('file:disaster-recovery-failover', 'SoftLayer.CLI.file.replication.disaster_recovery_failover:cli'),

SoftLayer/managers/storage.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,3 +577,12 @@ def convert_dep_dupe(self, volume_id):
577577
return self.client.call('Network_Storage',
578578
'convertCloneDependentToIndependent',
579579
id=volume_id)
580+
581+
def convert_dupe_status(self, volume_id):
582+
"""Get the Clone split/move status completion of a duplicate volume
583+
584+
:param integer volume_id: The id of the volume.
585+
"""
586+
return self.client.call('Network_Storage',
587+
'getDuplicateConversionStatus',
588+
id=volume_id)

docs/cli/block.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,8 @@ Block Commands
155155
.. click:: SoftLayer.CLI.block.snapshot.get_notify_status:cli
156156
:prog: block snapshot-get-notification-status
157157
:show-nested:
158+
159+
.. click:: SoftLayer.CLI.block.duplicate_convert_status:cli
160+
:prog: block duplicate-convert-status
161+
:show-nested:
162+

docs/cli/file.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,7 @@ File Commands
135135
:prog: file snapshot-get-notification-status
136136
:show-nested:
137137

138+
.. click:: SoftLayer.CLI.file.duplicate_convert_status:cli
139+
:prog: file duplicate-convert-status
140+
:show-nested:
141+

0 commit comments

Comments
 (0)