ManageIQ/manageiq — pull request #509 by blomquisg (2014-09-05 13:47:27+00:00)
Title: Process derived storage cap&u fields

Derived storage metrics were not being calculated because the `Metric::Finders.find_all_by_range` method had a bug preventing the method from finding metrics records for different resource types in the same query.

It appears that this type of functionality was only used when processing derived storage metrics. All other callers of this method appear to pass in only a single resource type at a time.

The erroneous part was that the query builder attempted to use the SQL `AND` operator to join `resource_type` conditions in the where clause. The problem is that no single metrics record be of more than one resource type. So, querying for rows where the the resource type is `"VmOrTemplate" AND "Storage"` will always fail. Now, the query attempts to find rows where resource type is `"VmOrTemplate" OR "Storage"`.

https://bugzilla.redhat.com/show_bug.cgi?id=1138442