@@ -31,72 +31,51 @@ def cli(env, volume_id):
3131 table .add_row (['Username' , block_volume ['username' ]])
3232 table .add_row (['Type' , storage_type ])
3333 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' ]])
3535
3636 if block_volume .get ('provisionedIops' ):
37- table .add_row (['IOPs' , float ( block_volume ['provisionedIops' ]) ])
37+ table .add_row (['IOPs' , block_volume ['provisionedIops' ]])
3838
3939 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' ]])
5344
5445 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' ]])
5947 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' ]])
6449
65- table .add_row (['# of Active Transactions' , "%i"
66- % block_volume ['activeTransactionCount' ]])
50+ table .add_row (['# of Active Transactions' , block_volume ['activeTransactionCount' ]])
6751
6852 if block_volume ['activeTransactions' ]:
6953 for trans in block_volume ['activeTransactions' ]:
7054 if 'transactionStatus' in trans and 'friendlyName' in trans ['transactionStatus' ]:
7155 table .add_row (['Ongoing Transaction' , trans ['transactionStatus' ]['friendlyName' ]])
7256
73- table .add_row (['Replicant Count' , "%u" % block_volume .get ('replicationPartnerCount' , 0 )])
57+ table .add_row (['Replicant Count' , block_volume .get ('replicationPartnerCount' , 0 )])
7458
7559 if block_volume ['replicationPartnerCount' ] > 0 :
7660 # This if/else temporarily handles a bug in which the SL API
7761 # returns a string or object for 'replicationStatus'; it seems that
7862 # the type is string for File volumes and object for Block volumes
7963 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' ]])
8265 else :
83- table .add_row (['Replication Status' , "%s"
84- % block_volume ['replicationStatus' ]])
66+ table .add_row (['Replication Status' , block_volume ['replicationStatus' ]])
8567
86- replicant_table = formatting .KeyValueTable (['Name ' , 'Value ' ])
68+ replicant_table = formatting .Table (['Id ' , 'Username' , 'Target' , 'Location' , 'Schedule ' ])
8769 replicant_table .align ['Name' ] = 'r'
8870 replicant_table .align ['Value' ] = 'l'
8971 for replicant in block_volume ['replicationPartners' ]:
9072 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+ ])
10079 table .add_row (['Replicant Volumes' , replicant_table ])
10180
10281 if block_volume .get ('originalVolumeSize' ):
0 commit comments