]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Add validation for volume_type of volume object
authorMitsuhiro Tanino <mitsuhiro.tanino@hds.com>
Mon, 7 Dec 2015 22:05:24 +0000 (17:05 -0500)
committerMitsuhiro Tanino <mitsuhiro.tanino@hds.com>
Wed, 9 Dec 2015 22:39:23 +0000 (17:39 -0500)
commite5df7aba69564be114c3a236bc73a3150555bc49
treee97646b7a9a7303e5d70d449589825a1fb2dfee9
parentef08af911244210b5b7839502302a90199b14263
Add validation for volume_type of volume object

During copy_volume_to_image(), this tries to return
volume['volume_type'] attribute in a volume object, but
if the volume does not have a volume type, this would
trigger a db call which raise an 404 not found error.

Volume object should check volume_type_id at first and
then decide whether returning volume_type or None to
avoid VolumeTypeNotFound exception.

Also this change includes LOG.info messages fix to show
right behavior of copy_volume_to_image().

Change-Id: Id2372621962406282eece2bcbc56c242f9dff8a0
Closes-Bug: #1523362
cinder/objects/volume.py
cinder/tests/unit/api/contrib/test_volume_actions.py
cinder/tests/unit/objects/test_volume.py
cinder/volume/api.py