Fix object code direct use of other object modules

The object code itself should not explicitly reference its own objects,
as objects could be subclassed.

Also: There were a few objects that had their own __init__()s that
didn't support accepting 'context' or kwargs. At some point here, we
should also require that context is passed when instantiating the
objects. So, I added the (currently optional) context argument on some
object instantiations near the places I was touching.

Partial-Blueprint: object-subclassing

Change-Id: Icf631c770e347b4bb32999c4ba2431d1db49e11c
This commit is contained in:
Chris Behrens
2014-05-17 16:06:33 -07:00
parent 9fcbe711f3
commit f79258b945
4 changed files with 12 additions and 8 deletions

View File

@@ -18,6 +18,7 @@ from nova.cells import opts as cells_opts
from nova.cells import rpcapi as cells_rpcapi
from nova import db
from nova import exception
from nova import objects
from nova.objects import base
from nova.objects import fields
from nova.openstack.common.gettextutils import _LE
@@ -106,5 +107,5 @@ class InstanceFaultList(base.ObjectListBase, base.NovaObject):
db_faultdict = db.instance_fault_get_by_instance_uuids(context,
instance_uuids)
db_faultlist = itertools.chain(*db_faultdict.values())
return base.obj_make_list(context, InstanceFaultList(), InstanceFault,
return base.obj_make_list(context, cls(context), objects.InstanceFault,
db_faultlist)