@@ -48,23 +48,27 @@ def _get_pooled_bandwidth(env, start, end):
4848 label = 'Calculating for bandwidth pools' ,
4949 file = sys .stderr ) as pools :
5050 for pool in pools :
51+ metric_tracking_id = pool .get ('metricTrackingObjectId' )
52+
53+ if metric_tracking_id is None :
54+ continue
55+
5156 pool_detail = {
5257 'id' : pool .get ('id' ),
5358 'type' : 'pool' ,
5459 'name' : pool .get ('name' ),
5560 'data' : []
5661 }
57- if pool .get ('metricTrackingObjectId' ):
58- bw_data = env .client .call (
59- 'Metric_Tracking_Object' ,
60- 'getSummaryData' ,
61- start .strftime ('%Y-%m-%d %H:%M:%S %Z' ),
62- end .strftime ('%Y-%m-%d %H:%M:%S %Z' ),
63- types ,
64- 300 ,
65- id = pool .get ('metricTrackingObjectId' ),
66- )
67- pool_detail ['data' ] = bw_data
62+ bw_data = env .client .call (
63+ 'Metric_Tracking_Object' ,
64+ 'getSummaryData' ,
65+ start .strftime ('%Y-%m-%d %H:%M:%S %Z' ),
66+ end .strftime ('%Y-%m-%d %H:%M:%S %Z' ),
67+ types ,
68+ 300 ,
69+ id = metric_tracking_id ,
70+ )
71+ pool_detail ['data' ] = bw_data
6872
6973 yield pool_detail
7074
@@ -74,7 +78,7 @@ def _get_hardware_bandwidth(env, start, end):
7478 'Account' , 'getHardware' ,
7579 iter = True ,
7680 mask = 'id,hostname,metricTrackingObject.id,'
77- 'virtualRack[id,bandwidthAllotmentTypeId]' )
81+ 'virtualRack[id,bandwidthAllotmentTypeId,name ]' )
7882 types = [
7983 {'keyName' : 'PUBLICIN' ,
8084 'name' : 'publicIn' ,
@@ -125,7 +129,7 @@ def _get_virtual_bandwidth(env, start, end):
125129 'Account' , 'getVirtualGuests' ,
126130 iter = True ,
127131 mask = 'id,hostname,metricTrackingObjectId,'
128- 'virtualRack[id,bandwidthAllotmentTypeId]' )
132+ 'virtualRack[id,bandwidthAllotmentTypeId,name ]' )
129133 types = [
130134 {'keyName' : 'PUBLICIN_NET_OCTET' ,
131135 'name' : 'publicIn_net_octet' ,
@@ -155,7 +159,7 @@ def _get_virtual_bandwidth(env, start, end):
155159 if utils .lookup (instance ,
156160 'virtualRack' ,
157161 'bandwidthAllotmentTypeId' ) == 2 :
158- pool_name = utils .lookup (instance , 'virtualRack' , 'id ' )
162+ pool_name = utils .lookup (instance , 'virtualRack' , 'name ' )
159163
160164 yield {
161165 'id' : instance ['id' ],
0 commit comments