There's a mix of using the ironic/objects interfaces to retrieve objects and using dbapi to retrieve objects. This should all be fixed to use the objects interfaces where possible. The DBAPI interfaces should really be hidden underneath objects.
The interfaces for using objects needs to be made consistent as well. This means making sure the object stores 'context' when it is instantiated. And removing 'context' from being used on .refresh() and .save() calls.
To fix this all, things need to be done in a certain order:
1) Make sure appropriate methods exist in our objects that match current dbapi behavior.
2) Switch code to use the object interfaces. Pass the context on the calls that instantiate the object.
3) Remove the 'objectify' decorator from DB API methods. Right now, since dbapi is returning objects, the object code is sometimes converting an object to an object (basically a no-op). Since DBAPI methods don't get the 'context', we also can't
reasonably form the object, storing the context, if we're doing it at this layer.
4) Remove 'context' from .refresh() and .save().
Reviewed: https:/ /review. openstack. org/84823 /git.openstack. org/cgit/ openstack/ ironic/ commit/ ?id=7ecca8868a6 3237485e1b0ca25 278d526e1324d2
Committed: https:/
Submitter: Jenkins
Branch: master
commit 7ecca8868a63237 485e1b0ca25278d 526e1324d2
Author: Chris Behrens <email address hidden>
Date: Wed Apr 2 02:56:55 2014 -0700
Add create() and destroy() to Node
What it says. Also make the code use them vs direct calls to dbapi. This
also removes passing context to node.refresh() and node.save() since
context is cached on the Node object on create.
Partial-Bug: 1314732
Change-Id: Id3fafe1eae7095 4095ed94dec86e4 583b23c5af8