Reimaging a volume from an image that is volume-snapshot backed fails.
Steps to reproduce:
1. Create a bootable volume from image
2. Launch an instance from the image
3. Snapshot the instance - this will create an image reference and a snapshot of bootable volume
4. Reimage the volume using the above snapshot image -- this fails with the following trace
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: DEBUG cinder.image.image_utils [req-4de5958b-7f93-48c1-b744-8ab42e21b40d req-b2a5bb9b-63a1-4192-8f8f-a1f0c5e417b2 admin None] Rejecting image 51acd2ec-74c9-426f-86e6-19dc348f1ab7 due to format mismatch. src_format: 'qcow2', but qemu-img info reports: 'raw' {{(pid=1007452) check_image_format /opt/stack/cinder/cinder/image/image_utils.py:760}}
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils [req-4de5958b-7f93-48c1-b744-8ab42e21b40d req-b2a5bb9b-63a1-4192-8f8f-a1f0c5e417b2 admin None] Failed to copy image 51acd2ec-74c9-426f-86e6-19dc348f1ab7 to volume: e249dbec-2346-41de-8d2c-efe49b7e2ace: cinder.exception.ImageUnacceptable: Image 51acd2ec-74c9-426f-86e6-19dc348f1ab7 is unacceptable: The image format was claimed to be 'qcow2' but the image data appears to be in a different format.
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils Traceback (most recent call last):
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils File "/opt/stack/cinder/cinder/volume/volume_utils.py", line 1211, in copy_image_to_volume
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils driver.copy_image_to_volume(
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils File "/opt/stack/cinder/cinder/volume/drivers/lvm.py", line 531, in copy_image_to_volume
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils image_utils.fetch_to_raw(context,
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils File "/opt/stack/cinder/cinder/image/image_utils.py", line 844, in fetch_to_raw
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils fetch_to_volume_format(context, image_service, image_id, dest, 'raw',
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils File "/opt/stack/cinder/cinder/image/image_utils.py", line 993, in fetch_to_volume_format
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils convert_image(tmp, dest, volume_format,
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils File "/opt/stack/cinder/cinder/image/image_utils.py", line 488, in convert_image
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils check_image_format(source, src_format, image_id, data, run_as_root)
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils File "/opt/stack/cinder/cinder/image/image_utils.py", line 768, in check_image_format
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils raise exception.ImageUnacceptable(
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils cinder.exception.ImageUnacceptable: Image 51acd2ec-74c9-426f-86e6-19dc348f1ab7 is unacceptable: The image format was claimed to be 'qcow2' but the image data appears to be in a different format.
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.volume_utils
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR cinder.volume.manager [req-4de5958b-7f93-48c1-b744-8ab42e21b40d req-b2a5bb9b-63a1-4192-8f8f-a1f0c5e417b2 admin None] Failed to re-image volume e249dbec-2346-41de-8d2c-efe49b7e2ace with image 51acd2ec-74c9-426f-86e6-19dc348f1ab7.: cinder.exception.ImageUnacceptable: Image 51acd2ec-74c9-426f-86e6-19dc348f1ab7 is unacceptable: The image format was claimed to be 'qcow2' but the image data appears to be in a different format.
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server [req-4de5958b-7f93-48c1-b744-8ab42e21b40d req-b2a5bb9b-63a1-4192-8f8f-a1f0c5e417b2 admin None] Exception during message handling: cinder.exception.ImageUnacceptable: Image 51acd2ec-74c9-426f-86e6-19dc348f1ab7 is unacceptable: The image format was claimed to be 'qcow2' but the image data appears to be in a different format.
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server Traceback (most recent call last):
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/data/venv/lib/python3.10/site-packages/oslo_messaging/rpc/server.py", line 165, in _process_incoming
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server res = self.dispatcher.dispatch(message)
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/data/venv/lib/python3.10/site-packages/oslo_messaging/rpc/dispatcher.py", line 309, in dispatch
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server return self._do_dispatch(endpoint, method, ctxt, args)
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/data/venv/lib/python3.10/site-packages/oslo_messaging/rpc/dispatcher.py", line 229, in _do_dispatch
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server result = func(ctxt, **new_args)
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/volume/manager.py", line 5387, in reimage
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server with excutils.save_and_reraise_exception():
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/data/venv/lib/python3.10/site-packages/oslo_utils/excutils.py", line 227, in __exit__
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server self.force_reraise()
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/data/venv/lib/python3.10/site-packages/oslo_utils/excutils.py", line 200, in force_reraise
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server raise self.value
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/volume/manager.py", line 5367, in reimage
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server volume_utils.copy_image_to_volume(self.driver, context, volume,
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/volume/volume_utils.py", line 1222, in copy_image_to_volume
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server with excutils.save_and_reraise_exception():
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/data/venv/lib/python3.10/site-packages/oslo_utils/excutils.py", line 227, in __exit__
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server self.force_reraise()
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/data/venv/lib/python3.10/site-packages/oslo_utils/excutils.py", line 200, in force_reraise
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server raise self.value
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/volume/volume_utils.py", line 1211, in copy_image_to_volume
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server driver.copy_image_to_volume(
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/volume/drivers/lvm.py", line 531, in copy_image_to_volume
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server image_utils.fetch_to_raw(context,
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/image/image_utils.py", line 844, in fetch_to_raw
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server fetch_to_volume_format(context, image_service, image_id, dest, 'raw',
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/image/image_utils.py", line 993, in fetch_to_volume_format
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server convert_image(tmp, dest, volume_format,
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/image/image_utils.py", line 488, in convert_image
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server check_image_format(source, src_format, image_id, data, run_as_root)
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/image/image_utils.py", line 768, in check_image_format
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server raise exception.ImageUnacceptable(
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server cinder.exception.ImageUnacceptable: Image 51acd2ec-74c9-426f-86e6-19dc348f1ab7 is unacceptable: The image format was claimed to be 'qcow2' but the image data appears to be in a different format.
Apr 09 07:20:24 Ubuntu cinder-volume[1007452]: ERROR oslo_messaging.rpc.server