Remove redundant meter (name,type,unit) tuples from Resource model

Fixes bug 1267162

Previously, a list of meter (name,type,unit) tuples with per-sample
cardinality was added to the Resource model by the storage driver
get_resource method.

However this potential huge and highly repetitive list was then
promptly discarded by the API layer, as the meter links in the API
Resource representation are populated via subsequent calls into
the storage driver get_meters method.

Now, we avoid the scaling issue by suppressing the creation of
this unused meter list.

Change-Id: I18dee7552836c724798ea1340e2e933c09d8a294
This commit is contained in:
Eoghan Glynn
2014-01-09 11:11:43 +00:00
parent 25e7dafec0
commit 7c4c0e8fc0
6 changed files with 5 additions and 68 deletions

View File

@@ -467,14 +467,6 @@ class Connection(base.Connection):
source=meter.sources[0].id,
user_id=meter.user_id,
metadata=meter.resource_metadata,
meter=[
api_models.ResourceMeter(
counter_name=m.counter_name,
counter_type=m.counter_type,
counter_unit=m.counter_unit,
)
for m in meter.resource.meters
],
)
@staticmethod