Skip to content

Commit 989bd3d

Browse files
caberoscaberos
authored andcommitted
add the file volume-options command
1 parent 950a54b commit 989bd3d

File tree

5 files changed

+71
-1
lines changed

5 files changed

+71
-1
lines changed

SoftLayer/CLI/file/options.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
"""List all options for ordering a file storage."""
2+
# :license: MIT, see LICENSE for more details.
3+
4+
import click
5+
6+
import SoftLayer
7+
from SoftLayer.CLI.command import SLCommand
8+
from SoftLayer.CLI import environment
9+
from SoftLayer.CLI import formatting
10+
11+
volume_size = ['20', '40', '80', '100', '250', '500', '1000', '2000-3000', '4000-7000', '8000-9000', '10000-12000']
12+
13+
14+
@click.command(cls=SLCommand)
15+
@environment.pass_env
16+
def cli(env):
17+
"""List all options for ordering a file storage"""
18+
19+
network_manager = SoftLayer.NetworkManager(env.client)
20+
datacenters = network_manager.get_datacenter()
21+
22+
table = formatting.Table(['Name', 'Value'], title='Volume table')
23+
24+
table.add_row(['Storage Type', 'performance,endurance'])
25+
table.add_row(['Size (GB)', str(volume_size)])
26+
27+
iops_table = formatting.Table(['Size (GB)', '20', '40', '80', '100', '250', '500', '1000', '2000-3000',
28+
'4000-7000', '8000-9000', '10000-12000'], title='IOPS table')
29+
snapshot_table = formatting.Table(['Storage Size (GB)', 'Available Snapshot Size (GB)'], title="Snapshot table")
30+
31+
datacenter_str = ','.join([str(dc['longName']) for dc in datacenters])
32+
iops_table.add_row(['Size (GB)', *volume_size])
33+
iops_table.add_row(['Min IOPS', '100', '100', '100', '100', '100', '100', '100', '200', '300', '500', '1000'])
34+
iops_table.add_row(['Max IOPS', '1000', '2000', '4000', '6000', '6000', '6000 or 10000', '6000 or 20000',
35+
'6000 or 40000', '6000 or 48000', '6000 or 48000', '6000 or 48000'])
36+
# table.add_row(['iops', iops_table])
37+
table.add_row(['Tier', '0.25,2,4,10'])
38+
table.add_row(['location', datacenter_str])
39+
40+
snapshot_table.add_row(['20', '0,5,10,20'])
41+
snapshot_table.add_row(['40', '0,5,10,20,40'])
42+
snapshot_table.add_row(['80', '0,5,10,20,40,60,80'])
43+
snapshot_table.add_row(['100', '0,5,10,20,40,60,80,100'])
44+
snapshot_table.add_row(['250', '0,5,10,20,40,60,80,100,150,200,250'])
45+
snapshot_table.add_row(['500', '0,5,10,20,40,60,80,100,150,200,250,300,350,400,450,500'])
46+
snapshot_table.add_row(['1000', '0,5,10,20,40,60,80,100,150,200,250,300,350,400,450,500,600,700,1000'])
47+
snapshot_table.add_row(['2000-3000', '0,5,10,20,40,60,80,100,150,200,250,300,350,400,450,500,600,700,1000,2000'])
48+
snapshot_table.add_row(
49+
['4000-7000', '0,5,10,20,40,60,80,100,150,200,250,300,350,400,450,500,600,700,1000,2000,4000'])
50+
snapshot_table.add_row(
51+
['8000-9000', '0,5,10,20,40,60,80,100,150,200,250,300,350,400,450,500,600,700,1000,2000,4000'])
52+
snapshot_table.add_row(
53+
['10000-12000', '0,5,10,20,40,60,80,100,150,200,250,300,350,400,450,500,600,700,1000,2000,4000'])
54+
55+
# table.add_row(['Snapshot Size (GB)', snapshot_table])
56+
table.add_row(['Note:',
57+
'IOPs limit above 6000 available in select data centers, refer to:'
58+
'http://knowledgelayer.softlayer.com/articles/new-ibm-block-and-file-storage-location-and-features'])
59+
env.fout(table)
60+
env.fout(iops_table)
61+
env.fout(snapshot_table)

SoftLayer/CLI/routes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
('file:volume-limits', 'SoftLayer.CLI.file.limit:cli'),
175175
('file:volume-refresh', 'SoftLayer.CLI.file.refresh:cli'),
176176
('file:volume-convert', 'SoftLayer.CLI.file.convert:cli'),
177+
('file:volume-options', 'SoftLayer.CLI.file.options:cli'),
177178
('file:volume-set-note', 'SoftLayer.CLI.file.set_note:cli'),
178179

179180
('firewall', 'SoftLayer.CLI.firewall'),

SoftLayer/fixtures/SoftLayer_Location.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
"longName": "San Jose 1",
1010
"name": "sjc01"
1111
}]
12-
getDatacenters = [{'id': 1854895, 'name': 'dal13', 'regions': [{'keyname': 'DALLAS13'}]}]
12+
getDatacenters = [{'id': 1854895, "longName": "Dallas 13", 'name': 'dal13', 'regions': [{'keyname': 'DALLAS13'}]}]

docs/cli/file.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ File Commands
123123
:prog: file volume-set-note
124124
:show-nested:
125125

126+
.. click:: SoftLayer.CLI.file.options:cli
127+
:prog: file volume-options
128+
:show-nested:
129+
126130
.. click:: SoftLayer.CLI.file.replication.disaster_recovery_failover:cli
127131
:prog: file disaster-recovery-failover
128132
:show-nested:

tests/CLI/modules/file_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,3 +798,7 @@ def test_snapshot_get_notification_status(self, status):
798798
result = self.run_command(['file', 'snapshot-get-notification-status', '999'])
799799
self.assert_no_fail(result)
800800
self.assertIn(expect, result.output)
801+
802+
def test_volume_options(self):
803+
result = self.run_command(['file', 'volume-options'])
804+
self.assert_no_fail(result)

0 commit comments

Comments
 (0)