@@ -31,72 +31,51 @@ def cli(env, volume_id):
31
31
table .add_row (['Username' , block_volume ['username' ]])
32
32
table .add_row (['Type' , storage_type ])
33
33
table .add_row (['Capacity (GB)' , capacity ])
34
- table .add_row (['LUN Id' , "%s" % block_volume ['lunId' ]])
34
+ table .add_row (['LUN Id' , block_volume ['lunId' ]])
35
35
36
36
if block_volume .get ('provisionedIops' ):
37
- table .add_row (['IOPs' , float ( block_volume ['provisionedIops' ]) ])
37
+ table .add_row (['IOPs' , block_volume ['provisionedIops' ]])
38
38
39
39
if block_volume .get ('storageTierLevel' ):
40
- table .add_row ([
41
- 'Endurance Tier' ,
42
- block_volume ['storageTierLevel' ],
43
- ])
44
-
45
- table .add_row ([
46
- 'Data Center' ,
47
- block_volume ['serviceResource' ]['datacenter' ]['name' ],
48
- ])
49
- table .add_row ([
50
- 'Target IP' ,
51
- block_volume ['serviceResourceBackendIpAddress' ],
52
- ])
40
+ table .add_row (['Endurance Tier' , block_volume ['storageTierLevel' ]])
41
+
42
+ table .add_row (['Data Center' , block_volume ['serviceResource' ]['datacenter' ]['name' ]])
43
+ table .add_row (['Target IP' , block_volume ['serviceResourceBackendIpAddress' ]])
53
44
54
45
if block_volume ['snapshotCapacityGb' ]:
55
- table .add_row ([
56
- 'Snapshot Capacity (GB)' ,
57
- block_volume ['snapshotCapacityGb' ],
58
- ])
46
+ table .add_row (['Snapshot Capacity (GB)' , block_volume ['snapshotCapacityGb' ]])
59
47
if 'snapshotSizeBytes' in block_volume ['parentVolume' ]:
60
- table .add_row ([
61
- 'Snapshot Used (Bytes)' ,
62
- block_volume ['parentVolume' ]['snapshotSizeBytes' ],
63
- ])
48
+ table .add_row (['Snapshot Used (Bytes)' , block_volume ['parentVolume' ]['snapshotSizeBytes' ]])
64
49
65
- table .add_row (['# of Active Transactions' , "%i"
66
- % block_volume ['activeTransactionCount' ]])
50
+ table .add_row (['# of Active Transactions' , block_volume ['activeTransactionCount' ]])
67
51
68
52
if block_volume ['activeTransactions' ]:
69
53
for trans in block_volume ['activeTransactions' ]:
70
54
if 'transactionStatus' in trans and 'friendlyName' in trans ['transactionStatus' ]:
71
55
table .add_row (['Ongoing Transaction' , trans ['transactionStatus' ]['friendlyName' ]])
72
56
73
- table .add_row (['Replicant Count' , "%u" % block_volume .get ('replicationPartnerCount' , 0 )])
57
+ table .add_row (['Replicant Count' , block_volume .get ('replicationPartnerCount' , 0 )])
74
58
75
59
if block_volume ['replicationPartnerCount' ] > 0 :
76
60
# This if/else temporarily handles a bug in which the SL API
77
61
# returns a string or object for 'replicationStatus'; it seems that
78
62
# the type is string for File volumes and object for Block volumes
79
63
if 'message' in block_volume ['replicationStatus' ]:
80
- table .add_row (['Replication Status' , "%s"
81
- % block_volume ['replicationStatus' ]['message' ]])
64
+ table .add_row (['Replication Status' , block_volume ['replicationStatus' ]['message' ]])
82
65
else :
83
- table .add_row (['Replication Status' , "%s"
84
- % block_volume ['replicationStatus' ]])
66
+ table .add_row (['Replication Status' , block_volume ['replicationStatus' ]])
85
67
86
- replicant_table = formatting .KeyValueTable (['Name ' , 'Value ' ])
68
+ replicant_table = formatting .Table (['Id ' , 'Username' , 'Target' , 'Location' , 'Schedule ' ])
87
69
replicant_table .align ['Name' ] = 'r'
88
70
replicant_table .align ['Value' ] = 'l'
89
71
for replicant in block_volume ['replicationPartners' ]:
90
72
replicant_table .add_row ([
91
- 'Replicant Id' , replicant ['id' ]])
92
- replicant_table .add_row ([
93
- 'Volume Name' , utils .lookup (replicant , 'username' )])
94
- replicant_table .add_row ([
95
- 'Target IP' , utils .lookup (replicant , 'serviceResourceBackendIpAddress' )])
96
- replicant_table .add_row ([
97
- 'Data Center' , utils .lookup (replicant , 'serviceResource' , 'datacenter' , 'name' )])
98
- replicant_table .add_row ([
99
- 'Schedule' , utils .lookup (replicant , 'replicationSchedule' , 'type' , 'keyname' )])
73
+ replicant .get ('id' ),
74
+ utils .lookup (replicant , 'username' ),
75
+ utils .lookup (replicant , 'serviceResourceBackendIpAddress' ),
76
+ utils .lookup (replicant , 'serviceResource' , 'datacenter' , 'name' ),
77
+ utils .lookup (replicant , 'replicationSchedule' , 'type' , 'keyname' )
78
+ ])
100
79
table .add_row (['Replicant Volumes' , replicant_table ])
101
80
102
81
if block_volume .get ('originalVolumeSize' ):
0 commit comments