Make Serializer/Conductor able to backlevel objects
This improves handling the situation where nova-api sends newer objects to an older compute node. In this case, the serializer detects the IncompatibleObjectVersion error and asks conductor to backlevel it. This means we call into a new method in conductor with the primitive object that we can't handle, and basically ask it to hydrate it and call obj_make_compatible() on our behalf and pass it back to us. This eliminates the need for API to know whether it's talking to an older compute and allows a newer conductor to assist older compute nodes during upgrades to a significant degree. Related-Bug: #1258256 Change-Id: I4b17c8382619e4f73b83c026bf68549ac67a68a2
This commit is contained in:
@@ -304,6 +304,9 @@ class LocalAPI(object):
|
||||
def compute_unrescue(self, context, instance):
|
||||
return self._manager.compute_unrescue(context, instance)
|
||||
|
||||
def object_backport(self, context, objinst, target_version):
|
||||
return self._manager.object_backport(context, objinst, target_version)
|
||||
|
||||
|
||||
class LocalComputeTaskAPI(object):
|
||||
def __init__(self):
|
||||
|
||||
@@ -76,7 +76,7 @@ class ConductorManager(manager.Manager):
|
||||
namespace. See the ComputeTaskManager class for details.
|
||||
"""
|
||||
|
||||
RPC_API_VERSION = '1.61'
|
||||
RPC_API_VERSION = '1.62'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ConductorManager, self).__init__(service_name='conductor',
|
||||
@@ -616,6 +616,9 @@ class ConductorManager(manager.Manager):
|
||||
def compute_reboot(self, context, instance, reboot_type):
|
||||
self.compute_api.reboot(context, instance, reboot_type)
|
||||
|
||||
def object_backport(self, context, objinst, target_version):
|
||||
return objinst.obj_to_primitive(target_version=target_version)
|
||||
|
||||
|
||||
class ComputeTaskManager(base.Base):
|
||||
"""Namespace for compute methods.
|
||||
|
||||
@@ -120,6 +120,7 @@ class ConductorAPI(rpcclient.RpcProxy):
|
||||
... - Remove security_group_get_by_instance() and
|
||||
security_group_rule_get_by_security_group()
|
||||
1.61 - Return deleted instance from instance_destroy()
|
||||
1.62 - Added object_backport()
|
||||
"""
|
||||
|
||||
BASE_RPC_API_VERSION = '1.0'
|
||||
@@ -473,6 +474,11 @@ class ConductorAPI(rpcclient.RpcProxy):
|
||||
return cctxt.call(context, 'object_action', objinst=objinst,
|
||||
objmethod=objmethod, args=args, kwargs=kwargs)
|
||||
|
||||
def object_backport(self, context, objinst, target_version):
|
||||
cctxt = self.client.prepare(version='1.62')
|
||||
return cctxt.call(context, 'object_backport', objinst=objinst,
|
||||
target_version=target_version)
|
||||
|
||||
|
||||
class ComputeTaskAPI(rpcclient.RpcProxy):
|
||||
"""Client side of the conductor 'compute' namespaced RPC API
|
||||
|
||||
Reference in New Issue
Block a user