Fix incompatible version handling in BuildRequest
The BuildRequest object code assumed that IncompatibleObjectVersion exception has a objver field that contains the object version. This assumption is not true. The unit test made another mistake serializing the function object obj_to_primitive instead of serializing the result of the call of obj_to_primitive. This caused a false positive test covering the error in the implementation as well. Closes-Bug: #1812177 Change-Id: I1ef4a23aa2bf5cb46b481045f3d968f62f74606d (cherry picked from commit975f015613) (cherry picked from commit6061186d2d)
This commit is contained in:
committed by
Elod Illes
parent
9cc0a58cf1
commit
7c85ebad0b
@@ -71,7 +71,7 @@ class BuildRequest(base.NovaObject):
|
||||
LOG.debug('Failed to load instance from BuildRequest with uuid '
|
||||
'%s because it is None', self.instance_uuid)
|
||||
raise exception.BuildRequestNotFound(uuid=self.instance_uuid)
|
||||
except ovoo_exc.IncompatibleObjectVersion as exc:
|
||||
except ovoo_exc.IncompatibleObjectVersion:
|
||||
# This should only happen if proper service upgrade strategies are
|
||||
# not followed. Log the exception and raise BuildRequestNotFound.
|
||||
# If the instance can't be loaded this object is useless and may
|
||||
@@ -80,7 +80,8 @@ class BuildRequest(base.NovaObject):
|
||||
'with uuid %(instance_uuid)s. Found version %(version)s '
|
||||
'which is not supported here.',
|
||||
dict(instance_uuid=self.instance_uuid,
|
||||
version=exc.objver))
|
||||
version=jsonutils.loads(
|
||||
db_instance)["nova_object.version"]))
|
||||
LOG.exception('Could not deserialize instance in BuildRequest')
|
||||
raise exception.BuildRequestNotFound(uuid=self.instance_uuid)
|
||||
# NOTE(sbauza): The instance primitive should already have the deleted
|
||||
|
||||
Reference in New Issue
Block a user