cinder-volume with rbd driver should not accept image whose size is 0

Bug #1816344 reported by Yang Youseok
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
New
Undecided
Unassigned

Bug Description

Currently, in cinder/volume/drivers/rbd.py, copy_image_to_volume() function accepts invalid image whose size is 0.

Since there is no validation check logic (Maybe I did not find codebase at least Ocata release), it just occurs exception like below

2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager Traceback (most recent call last):
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager File "/opt/openstack/lib/python2.7/site-packages/taskflow/engines/action_engine/executor.py", line 53, in _execute_task
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager result = task.execute(**arguments)
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager File "/opt/openstack/src/cinder/cinder/volume/flows/manager/create_volume.py", line 956, in execute
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager **volume_spec)
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager File "/opt/openstack/src/cinder/cinder/volume/flows/manager/create_volume.py", line 903, in _create_from_image
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager image_service)
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager File "/opt/openstack/src/cinder/cinder/volume/flows/manager/create_volume.py", line 815, in _create_from_image_cache_or_download
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager image_service
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager File "/opt/openstack/src/cinder/cinder/volume/flows/manager/create_volume.py", line 675, in _create_from_image_download
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager image_service)
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager File "/opt/openstack/src/cinder/cinder/volume/flows/manager/create_volume.py", line 543, in _copy_image_to_volume
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager raise exception.ImageCopyFailure(reason=ex.stderr)
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager ImageCopyFailure: Failed to copy image to volume: rbd: --pool is deprecated for import, use --dest-pool
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager rbd: --order is deprecated, use --object-size
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager rbd: unable to get size of file/block device
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager ^MImporting image: 0% complete...failed.
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager rbd: import failed: (25) Inappropriate ioctl for device
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager
2019-02-18 10:04:19.791 25856 ERROR cinder.volume.manager

I think it should any validation so that image with size 0 should be avoided for users.

Thanks

Revision history for this message
Sean McGinnis (sean-mcginnis) wrote :

Could you provide steps for how you had a 0 size image?

Revision history for this message
Yang Youseok (ileixe) wrote :

@Sean

Um... I think it's not recommended or even restricted though, reproduction is simple.

https://asciinema.org/a/T6eZpeBfz4SnjnGdb1uRyA6sG

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.