Skip to content

Commit 0e43d2b

Browse files
author
David Pickle
committed
Merge 'feature/volume-detail-duplicate-info' into feature/volume-duplicate
2 parents e30f4d3 + 84cea12 commit 0e43d2b

9 files changed

Lines changed: 96 additions & 4 deletions

File tree

SoftLayer/CLI/block/detail.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,13 @@ def cli(env, volume_id):
9999
replicant_list.append(replicant_table)
100100
table.add_row(['Replicant Volumes', replicant_list])
101101

102+
if block_volume.get('originalVolumeSize'):
103+
duplicate_info = formatting.Table(['Original Volume Name',
104+
block_volume['originalVolumeName']])
105+
duplicate_info.add_row(['Original Volume Size',
106+
block_volume['originalVolumeSize']])
107+
duplicate_info.add_row(['Original Snapshot Name',
108+
block_volume['originalSnapshotName']])
109+
table.add_row(['Duplicate Volume Properties', duplicate_info])
110+
102111
env.fout(table)

SoftLayer/CLI/file/detail.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,13 @@ def cli(env, volume_id):
114114
replicant_list.append(replicant_table)
115115
table.add_row(['Replicant Volumes', replicant_list])
116116

117+
if file_volume.get('originalVolumeSize'):
118+
duplicate_info = formatting.Table(['Original Volume Name',
119+
file_volume['originalVolumeName']])
120+
duplicate_info.add_row(['Original Volume Size',
121+
file_volume['originalVolumeSize']])
122+
duplicate_info.add_row(['Original Snapshot Name',
123+
file_volume['originalSnapshotName']])
124+
table.add_row(['Duplicate Volume Properties', duplicate_info])
125+
117126
env.fout(table)

SoftLayer/fixtures/SoftLayer_Network_Storage.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
'snapshotCapacityGb': '10',
5858
'parentVolume': {'snapshotSizeBytes': 1024},
5959
'osType': {'keyName': 'LINUX'},
60+
'originalSnapshotName': 'test-origin-snapshot-name',
61+
'originalVolumeName': 'test-origin-volume-name',
62+
'originalVolumeSize': '20',
6063
'schedules': [{
6164
'id': 978,
6265
'type': {'keyname': 'SNAPSHOT_WEEKLY'},

SoftLayer/managers/block.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ def get_block_volume_details(self, volume_id, **kwargs):
9191
'storageTierLevel',
9292
'iops',
9393
'lunId',
94+
'originalVolumeName',
95+
'originalSnapshotName',
96+
'originalVolumeSize',
9497
'activeTransactionCount',
9598
'activeTransactions.transactionStatus[friendlyName]',
9699
'replicationPartnerCount',

SoftLayer/managers/file.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ def get_file_volume_details(self, volume_id, **kwargs):
8888
'storageTierLevel',
8989
'iops',
9090
'lunId',
91+
'originalVolumeName',
92+
'originalSnapshotName',
93+
'originalVolumeSize',
9194
'activeTransactionCount',
9295
'activeTransactions.transactionStatus[friendlyName]',
9396
'replicationPartnerCount',

tests/CLI/modules/block_tests.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def test_volume_cancel(self):
6767

6868
def test_volume_detail(self):
6969
result = self.run_command(['block', 'volume-detail', '1234'])
70+
7071
self.assert_no_fail(result)
7172
self.assertEqual({
7273
'Username': 'username',
@@ -94,7 +95,13 @@ def test_volume_detail(self):
9495
{'Replicant ID': 'Target IP', '1785': '10.3.177.84'},
9596
{'Replicant ID': 'Data Center', '1785': 'dal01'},
9697
{'Replicant ID': 'Schedule', '1785': 'REPLICATION_DAILY'},
97-
]]
98+
]],
99+
'Duplicate Volume Properties': [
100+
{'Original Volume Name': 'Original Volume Size',
101+
'test-origin-volume-name': '20'},
102+
{'Original Volume Name': 'Original Snapshot Name',
103+
'test-origin-volume-name': 'test-origin-snapshot-name'}
104+
]
98105
}, json.loads(result.output))
99106

100107
def test_volume_list(self):

tests/CLI/modules/file_tests.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,13 @@ def test_volume_detail(self):
145145
{'Replicant ID': 'Target IP', '1785': '10.3.177.84'},
146146
{'Replicant ID': 'Data Center', '1785': 'dal01'},
147147
{'Replicant ID': 'Schedule', '1785': 'REPLICATION_DAILY'},
148-
]]
148+
]],
149+
'Duplicate Volume Properties': [
150+
{'Original Volume Name': 'Original Volume Size',
151+
'test-origin-volume-name': '20'},
152+
{'Original Volume Name': 'Original Snapshot Name',
153+
'test-origin-volume-name': 'test-origin-snapshot-name'}
154+
]
149155
}, json.loads(result.output))
150156

151157
def test_volume_order_performance_iops_not_given(self):

tests/managers/block_tests.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,35 @@ def test_get_block_volume_details(self):
3030

3131
self.assertEqual(fixtures.SoftLayer_Network_Storage.getObject, result)
3232

33+
expected_mask = 'id,'\
34+
'username,'\
35+
'password,'\
36+
'capacityGb,'\
37+
'snapshotCapacityGb,'\
38+
'parentVolume.snapshotSizeBytes,'\
39+
'storageType.keyName,'\
40+
'serviceResource.datacenter[name],'\
41+
'serviceResourceBackendIpAddress,'\
42+
'storageTierLevel,'\
43+
'iops,'\
44+
'lunId,'\
45+
'originalVolumeName,'\
46+
'originalSnapshotName,'\
47+
'originalVolumeSize,'\
48+
'activeTransactionCount,'\
49+
'activeTransactions.transactionStatus[friendlyName],'\
50+
'replicationPartnerCount,'\
51+
'replicationStatus,'\
52+
'replicationPartners[id,username,'\
53+
'serviceResourceBackendIpAddress,'\
54+
'serviceResource[datacenter[name]],'\
55+
'replicationSchedule[type[keyname]]]'
56+
3357
self.assert_called_with(
3458
'SoftLayer_Network_Storage',
3559
'getObject',
36-
identifier=100
60+
identifier=100,
61+
mask='mask[%s]' % expected_mask
3762
)
3863

3964
def test_list_block_volumes(self):

tests/managers/file_tests.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,37 @@ def test_get_file_volume_details(self):
105105

106106
self.assertEqual(fixtures.SoftLayer_Network_Storage.getObject, result)
107107

108+
expected_mask = 'id,'\
109+
'username,'\
110+
'password,'\
111+
'capacityGb,'\
112+
'bytesUsed,'\
113+
'snapshotCapacityGb,'\
114+
'parentVolume.snapshotSizeBytes,'\
115+
'storageType.keyName,'\
116+
'serviceResource.datacenter[name],'\
117+
'serviceResourceBackendIpAddress,'\
118+
'fileNetworkMountAddress,'\
119+
'storageTierLevel,'\
120+
'iops,'\
121+
'lunId,'\
122+
'originalVolumeName,'\
123+
'originalSnapshotName,'\
124+
'originalVolumeSize,'\
125+
'activeTransactionCount,'\
126+
'activeTransactions.transactionStatus[friendlyName],'\
127+
'replicationPartnerCount,'\
128+
'replicationStatus,'\
129+
'replicationPartners[id,username,'\
130+
'serviceResourceBackendIpAddress,'\
131+
'serviceResource[datacenter[name]],'\
132+
'replicationSchedule[type[keyname]]]'
133+
108134
self.assert_called_with(
109135
'SoftLayer_Network_Storage',
110136
'getObject',
111-
identifier=100)
137+
identifier=100,
138+
mask='mask[%s]' % expected_mask)
112139

113140
def test_get_file_volume_snapshot_list(self):
114141
result = self.file.get_file_volume_snapshot_list(100)

0 commit comments

Comments
 (0)