Fetch all db resources in one query
Fetch all db resources in one query

Instead of calling resource_get_by_name_and_stack once for every
resource in the stack, db_api.resource_get_all_by_stack is called
only once for all resources.

This reduces the number of sql queries during a describe_stack_resource
call to 3:
1. load the stack
2. load the template
3. load the resources

This is a big improvement over the start of this patch series, which
is 2 queries plus:
* 1 per resource in the stack
* 1 per access to a resource metadata attribute
* 1 per access to a resource data value

There is probably still potential to reduce queries from 3, but this
may well be a fix for
Partial-Bug: 1306743

Change-Id: I80be5d3de8744813d974f2e9860c148ad258f385

gonzolino/heat,miguelgrinberg/heat,rdo-management/heat,dragorosson/heat,steveb/heat,pshchelo/heat,cryptickp/heat,cwolferh/heat-scratch,steveb/heat,gonzolino/heat,takeshineshiro/heat,cryptickp/heat,pshchelo/heat,maestro-hybrid-cloud/heat,rh-s/heat,redhat-openstack/heat,dims/heat,redhat-openstack/heat,pratikmallya/heat,noironetworks/heat,srznew/heat,dims/heat,cwolferh/heat-scratch,openstack/heat,openstack/heat,rdo-management/heat,pratikmallya/heat,noironetworks/heat,takeshineshiro/heat,miguelgrinberg/heat,rh-s/heat,maestro-hybrid-cloud/heat,srznew/heat,jasondunsmore/heat,dragorosson/heat,jasondunsmore/heat