diff options
author | Grzegorz Grasza <grzegorz.grasza@intel.com> | 2015-09-16 15:12:42 +0200 |
---|---|---|
committer | Jim Rollenhagen <jim@jimrollenhagen.com> | 2015-09-24 00:26:33 +0000 |
commit | db9ddd39d3f3d854d38e4b05655ebddd98f1a727 (patch) | |
tree | f5d327f0ffb81126ecf93fc152da5bc6add4dbb6 /ironic/objects/base.py | |
parent | cd32fa542193fc26b4ee77c7d004e056f1ce9bf8 (diff) | |
download | ironic-db9ddd39d3f3d854d38e4b05655ebddd98f1a727.tar.gz |
Implement indirection_api
During a rolling upgrade, ironic conductor and api services are running
with different versions. When an object is received in an incompatible
version, IncompatibleObjectVersion is raised. Implementation of the
indirection API allows the object to be backported to a supported version
by the conductor (conductor has to be the first service to be upgraded).
This change enables backporting of objects from Mitaka. This lays the
foundation to be able to do rolling upgrades from Liberty (or from this
patch onwards) to Mitaka. There may still be other issues that will need
fixing in Mitaka before we will be able to do a full rolling upgrade.
Enabling the indirection_api causes all object methods decorated with
the remotable or remotable_classmethod to do RPC from ironic-api to
ironic-conductor service. To keep the current behavior, I'm removing all
remotable decorators on object methods and thus not enabling object RPC
calls in this patch. These calls caused random timeouts on the CI gates
(probably due to a race in which Nova calls the ironic-api service before
ironic-conductor is up). RPC calls made via the indirection_api should
be enabled one-by-one, when the implications are fully understood.
Change-Id: Ia381348da93f95d764c83f3ec2a2ed5a1db5ad6d
Closes-Bug: 1493816
Depends-On: I81400305f166d62aa4612aab54602abb8178b64c
Diffstat (limited to 'ironic/objects/base.py')
-rw-r--r-- | ironic/objects/base.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ironic/objects/base.py b/ironic/objects/base.py index 14ef1aadf..56bb71ed7 100644 --- a/ironic/objects/base.py +++ b/ironic/objects/base.py @@ -65,6 +65,36 @@ class IronicObject(object_base.VersionedObject): self[field] = loaded_object[field] +class IronicObjectIndirectionAPI(object_base.VersionedObjectIndirectionAPI): + def __init__(self): + super(IronicObjectIndirectionAPI, self).__init__() + # FIXME(xek): importing here due to a cyclical import error + from ironic.conductor import rpcapi as conductor_api + self._conductor = conductor_api.ConductorAPI() + + def object_action(self, context, objinst, objmethod, args, kwargs): + return self._conductor.object_action(context, objinst, objmethod, + args, kwargs) + + def object_class_action(self, context, objname, objmethod, objver, + args, kwargs): + # NOTE(xek): This method is implemented for compatibility with + # oslo.versionedobjects 0.10.0 and older. It will be replaced by + # object_class_action_versions. + versions = object_base.obj_tree_get_versions(objname) + return self.object_class_action_versions( + context, objname, objmethod, versions, args, kwargs) + + def object_class_action_versions(self, context, objname, objmethod, + object_versions, args, kwargs): + return self._conductor.object_class_action_versions( + context, objname, objmethod, object_versions, args, kwargs) + + def object_backport_versions(self, context, objinst, object_versions): + return self._conductor.object_backport_versions(context, objinst, + object_versions) + + class IronicObjectSerializer(object_base.VersionedObjectSerializer): # Base class to use for object hydration OBJ_BASE_CLASS = IronicObject |