]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Add metadata aliases to Volume object
authorMichał Dulko <michal.dulko@intel.com>
Thu, 19 Nov 2015 18:36:27 +0000 (19:36 +0100)
committerMichał Dulko <michal.dulko@intel.com>
Tue, 5 Jan 2016 15:45:02 +0000 (16:45 +0100)
commite31e31689073323ceba2bb4c993af73df8274121
tree4af49f98f73ef31c237e7cad5196906b13260cc3
parent6348aa38ff25fc32ca17846d1f9f73c9c39cd705
Add metadata aliases to Volume object

When writing Volume object we've renamed some fields from SQLAlchemy
model. This included volume_metadata (renamed to metadata) and
volume_admin_metadata (renamed to admin_metadata) and
volume_glance_metadata (recently added as glance_metadata). Some code
were relying on old names. As right now we're in the transitional phase
it's hard to tell if driver method will get versioned object or old
SQLAlchemy object.

To mitigate that and mimic old SQLAlchemy object behavior on versioned
object we should add properties to serve as aliases for older names.

This commit also fixes the tests for EMC VNX that were blocking the
patch. Tests were setting volume_metadata property on volume object,
which actually had no effect without this patch.

Another thing done is moving overriding __contains__ from
CinderObjectDictCompat to CinderObject class to solve MRO issue because
both of these classes were defining __contains__ method.

Change-Id: I79e24c5ad20f17bb6b21b2d47f955afde47d9794
Closes-Bug: 1529877
Related-Bug: 1516903
cinder/objects/base.py
cinder/objects/volume.py
cinder/tests/unit/api/contrib/test_volume_actions.py
cinder/tests/unit/objects/test_volume.py
cinder/tests/unit/test_emc_vnx.py
cinder/tests/unit/test_volume.py