Greetings,
Description
===========
I'm trying to attach an encrypted volume to a nova instance. Still, I'm facing "libvirt.libvirtError: internal error: unable to execute QEMU command 'blockdev-add': Image is not in qcow2 format" error.
I'm using generic-NFS with luksv1 encryption as a cinder backend (please
check the environment section).
Steps to reproduce
==================
1. Create a NFS encrypted volume
$ cinder list
++--------------------------------------+-----------+-------------------+------+-------------+----------+-------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+-------------------+------+-------------+----------+-------------+
| 1a1dc33c-5b99-47b3-9619-4542f6ed5ce0 | available | encrypted-volume5 | 1 | LUKS | false | |
+--------------------------------------+-----------+-------------------+------+-------------+----------+-------------+
2. Attach the volume to the instance
$ nova volume-attach 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb 1a1dc33c-5b99-47b3-9619-4542f6ed5ce0
Expected result
===============
Volume attached successfully.
Actual result
=============
n-cpu log
=======
Traceback (most recent call last):
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/opt/stack/nova/nova/compute/manager.py", line 7151, in _attach_volume
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] bdm.attach(context, instance, self.volume_api, self.driver,
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/opt/stack/nova/nova/virt/block_device.py", line 46, in wrapped
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] ret_val = method(obj, context, *args, **kwargs)
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/opt/stack/nova/nova/virt/block_device.py", line 669, in attach
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] self._do_attach(context, instance, volume, volume_api,
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/opt/stack/nova/nova/virt/block_device.py", line 654, in _do_attach
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] self._volume_attach(context, volume, connector, instance,
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/opt/stack/nova/nova/virt/block_device.py", line 603, in _volume_attach
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] volume_api.attachment_delete(context,
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/usr/local/lib/python3.8/dist-packages/oslo_utils/excutils.py", line 227, in __exit__
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] self.force_reraise()
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/usr/local/lib/python3.8/dist-packages/oslo_utils/excutils.py", line 200, in force_reraise
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] raise self.value
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/opt/stack/nova/nova/virt/block_device.py", line 592, in _volume_attach
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] virt_driver.attach_volume(
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 2188, in attach_volume
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] self._disconnect_volume(context, connection_info, instance,
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/usr/local/lib/python3.8/dist-packages/oslo_utils/excutils.py", line 227, in __exit__
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] self.force_reraise()
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/usr/local/lib/python3.8/dist-packages/oslo_utils/excutils.py", line 200, in force_reraise
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] raise self.value
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 2172, in attach_volume
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] guest.attach_device(conf, persistent=True, live=live)
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/opt/stack/nova/nova/virt/libvirt/guest.py", line 321, in attach_device
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] self._domain.attachDeviceFlags(device_xml, flags=flags)
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/usr/local/lib/python3.8/dist-packages/eventlet/tpool.py", line 193, in doit
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] result = proxy_call(self._autowrap, f, *args, **kwargs)
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/usr/local/lib/python3.8/dist-packages/eventlet/tpool.py", line 151, in proxy_call
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] rv = execute(f, *args, **kwargs)
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/usr/local/lib/python3.8/dist-packages/eventlet/tpool.py", line 132, in execute
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] six.reraise(c, e, tb)
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/usr/local/lib/python3.8/dist-packages/six.py", line 719, in reraise
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] raise value
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] File "/usr/local/lib/python3.8/dist-packages/eventlet/tpool.py", line 86, in tworker
stance: 9b595d6f-484c-4b38-9a8e-4d2fafe7bceb] rv = meth(*args, **kwargs)
File "/usr/lib/python3/dist-packages/libvirt.py", line 630, in attachDeviceFlags
if ret == -1: raise libvirtError ('virDomainAttachDeviceFlags() failed', dom=self) libvirt.libvirtError: internal error: unable to execute QEMU command 'blockdev-add': Image is not in qcow2 format
Environment
===========
I'm working on NFS encrypted volume support. The main patch is I896f70d204ad103e968ab242ba9045ca984827c4 [1] and it's merged but it's having some bugs so I'm manually using Ic9dae03272cb8401b3bd2be0a817cf2c54457118 on my Devstack (master branch) as well.
[1] https://review.opendev.org/c/openstack/cinder/+/597148
[2] https://review.opendev.org/c/openstack/cinder/+/749155
Fix proposed to branch: master /review. opendev. org/c/openstack /nova/+ /854030
Review: https:/