Remove use of ORM in resource_provider.py

Registered by Jay Pipes

The nova/objects/resource_provider.py module contains an inconsistent mix of ORM queries, such as:

 context.session.query(api_models.Traits).filter(...).one()

and non-ORM queries that look like this:

 rp = sa.alias(_RP_TBL, name="rp")
 sel = sa.select([rp.c.id])
 sel = sel.where(rp.c.name == rp_name)
 return ctx.session.execute(sel).fetchone()

The former query style tends to generate overly-verbose and sometimes inefficient SQL, especially when used with joined_load and other SQLAlchemy ORM tooling.

Make the resource_provider.py module consistently use the latter style for queries.

Blueprint information

Status:
Complete
Approver:
Matt Riedemann
Priority:
Low
Drafter:
Jay Pipes
Direction:
Approved
Assignee:
Jay Pipes
Definition:
Approved
Series goal:
Accepted for queens
Implementation:
Implemented
Milestone target:
milestone icon queens-1
Started by
Matt Riedemann
Completed by
Matt Riedemann

Related branches

Sprints

Whiteboard

Approved as a specless cleanup blueprint.

Gerrit topic: https://review.openstack.org/#q,topic:bp/de-orm-resource-providers,n,z

Addressed by: https://review.openstack.org/509025
    rp: de-ORM ResourceProvider.get_by_uuid()

Addressed by: https://review.openstack.org/509026
    rp: Move RP._get|set_aggregates() to module scope

Addressed by: https://review.openstack.org/509027
    rp: Remove RP.get_traits() method

Addressed by: https://review.openstack.org/509028
    rp: move RP._set_traits() to module scope

Addressed by: https://review.openstack.org/509029
    rp: remove CRUD operations on Inventory class

Addressed by: https://review.openstack.org/509030
    rp: streamline InventoryList.get_all_by_rp_uuid()

Addressed by: https://review.openstack.org/509031
    rp: remove dead code in Allocation._create_in_db()

Addressed by: https://review.openstack.org/509032
    rp: remove ability to delete 1 allocation record

Addressed by: https://review.openstack.org/509033
    rp: fix up AllocList.get_by_resource_provider_uuid

Addressed by: https://review.openstack.org/509035
    rp: rework AllocList.get_all_by_consumer_id()

Addressed by: https://review.openstack.org/509036
    rp: remove _HasAResourceProvider mixin

Addressed by: https://review.openstack.org/509908
    rp: break functions out of _set_traits()

Gerrit topic: https://review.openstack.org/#q,topic:bp/nested-resource-providers,n,z

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.