Add missing 'obj_make_compatible' in RequestSpec object
RequestSpec is converted to OVO, thus need to add the
'obj_make_compatible' to support backward compatibility.
# License for the specific language governing permissions and limitations
# under the License.
+from oslo_utils import versionutils
from oslo_versionedobjects import fields
from cinder import objects
@@ -88,6 +89,17 @@ class RequestSpec(base.CinderObject, base.CinderObjectDictCompat,
return spec_obj
+ def obj_make_compatible(self, primitive, target_version):
+ """Make an object representation compatible with target version."""
+ super(RequestSpec, self).obj_make_compatible(primitive, target_version)
+ target_version = versionutils.convert_version_to_tuple(target_version)
+ added_fields = (((1, 1), ('group_id', 'group_backend')),
+ ((1, 2), ('resource_backend')))
+ for version, remove_fields in added_fields:
+ if target_version < version:
+ for obj_field in remove_fields:
+ primitive.pop(obj_field, None)
+
@base.CinderObjectRegistry.register
class VolumeProperties(base.CinderObject, base.CinderObjectDictCompat):
