nova/nova/tests/unit/virt
Lee Yarwood ec43a1348d libvirt: Avoid using os-brick encryptors when device_path isn't provided
When disconnecting an encrypted volume the Libvirt driver uses the
presence of a Libvirt secret associated with the volume to determine if
the new style native QEMU LUKS decryption or original decryption method
using os-brick encrytors is used.

While this works well in most deployments some issues have been observed
in Kolla based environments where the Libvirt secrets are not fully
persisted between host reboots or container upgrades. This can lead to
_detach_encryptor attempting to build an encryptor which will fail if
the associated connection_info for the volume does not contain a
device_path, such as in the case for encrypted rbd volumes.

This change adds a simple conditional to _detach_encryptor to ensure we
return when device_path is not present in connection_info and native
QEMU LUKS decryption is available. This handles the specific use
case where we are certain that the encrypted volume was never decrypted
using the os-brick encryptors, as these require a local block device on
the compute host and have thus never supported rbd.

It is still safe to build an encryptor and call detach_volume when a
device_path is present however as change I9f52f89b8466d036 made such
calls idempotent within os-brick.

Change-Id: Id670f13a7f197e71c77dc91276fc2fba2fc5f314
Closes-bug: #1821696
(cherry picked from commit 56ca4d32dd)
(cherry picked from commit c6432ac021)
(cherry picked from commit 2c6e59e835)
2019-04-30 09:27:57 +01:00
..
disk Merge "Don't launch guestfs in a thread pool if guestfs.debug is enabled" 2018-01-31 13:30:44 +00:00
hyperv hyper-v: Logs tips on PortBindingFailed 2018-03-07 17:00:02 +00:00
image Use assert(Not)Equal instead of assertTrue(A == X) 2016-06-03 16:53:15 +01:00
ironic Merge "ironic: stop lying to the RT when ironic is down" into stable/queens 2018-06-26 14:56:24 +00:00
libvirt libvirt: Avoid using os-brick encryptors when device_path isn't provided 2019-04-30 09:27:57 +01:00
powervm Use correct arguments in task inits 2018-02-13 17:05:21 -05:00
vmwareapi VMware: fix TypeError while get console log 2018-08-13 11:54:42 +00:00
xenapi xenapi: handle InstanceNotFound in detach_interface() 2018-04-26 11:18:20 +00:00
__init__.py
fakelibosinfo.py Fix misuse of assertTrue in console and virt tests 2016-02-22 16:09:21 +09:00
test_block_device.py block_device: Rollback volumes to in-use on DeviceDetachFailed 2018-08-10 16:38:18 +01:00
test_configdrive.py
test_driver.py Remove usage of parameter enforce_type 2017-04-17 20:23:19 +08:00
test_events.py
test_fake.py
test_firewall.py remove get_nw_info_for_instance from compute.utils 2017-06-13 13:30:06 +02:00
test_hardware.py [Stable Only] hardware: Handle races during pinning 2019-03-27 12:29:05 +00:00
test_imagecache.py Remove mox from tests/unit/virt/test_imagecache.py 2016-06-16 23:40:01 +00:00
test_images.py mock utils.execute() in qemu-img unit test 2018-06-11 13:31:44 +00:00
test_netutils.py Remove unnecessary code 2017-07-28 06:01:21 +00:00
test_osinfo.py Do not attempt to load osinfo if we do not have os_distro 2017-03-23 22:07:03 -04:00
test_virt.py Rename block_device_info_get_root 2018-01-11 20:46:13 +00:00
test_virt_drivers.py Revert "libvirt: slow live-migration to ensure network is ready" 2018-08-14 08:27:20 -07:00