nova/nova/tests/unit/virt
Lee Yarwood f99f667a96 libvirt: Simplify device_path check in _detach_encryptor
Introduced by Id670f13a7f197e71c77dc91276fc2fba2fc5f314 to resolve bug
 #1821696 this check was put in place to ensure _detach_encryptor did not
attempt to use the os-brick encryptors with an unsupported volume type
after libvirt secrets had been removed outside the control of Nova.

With the introduction of the [workarounds]disable_native_luksv1 via
Ia500eb614cf575ab846f64f4b69c9068274c8c1f however the use of
_allow_native_luksv1 as part of this check is no longer valid. As this
helper was updated to return False when the workaround is enabled,
regardless of the underlying volume being attached natively or not.

If an admin had enabled the workaround after users had launched
instances with natively attached encrypted volumes *and* the libvirt
secrets had gone missing _detach_encryptor would attempt to use the
os-brick encryptors. This would fail when the underlying volume type is
unsupported, for example rbd. See bug #1917619 for an example.

This change resolves this corner case by dropping the use of
_allow_native_luksv1 from the check and just asserting that a
device_path is present for an encrypted volume before allowing the use
of the os-brick encryptors. As noted this is safe as calls to the
encryptors are idempotent, ignoring failures to detach when the
underlying volume type is supported.

Closes-Bug: #1917619
Change-Id: Iba40c2df72228b461767d5734d5a62403d9f2cfa
(cherry picked from commit 4908daed96)
2021-04-09 10:06:44 +01:00
..
disk Merge "Remove VFSLocalFS" 2021-03-16 17:33:45 +00:00
hyperv hyper-v rbd volume support 2021-03-02 12:58:11 +00:00
image
ironic cmd: Remove 'nova-manage db ironic_flavor_migration' 2021-02-10 15:32:03 +00:00
libvirt libvirt: Simplify device_path check in _detach_encryptor 2021-04-09 10:06:44 +01:00
powervm Remove six.text_type (2/2) 2020-12-13 11:26:35 +00:00
vmwareapi Merge "vmware: Use cookiejar from oslo.vmware client directly" 2021-02-13 16:59:34 +00:00
zvm Remove six.moves 2020-11-07 03:25:02 +00:00
__init__.py
fakelibosinfo.py Stop sending bad values from libosinfo to libvirt 2019-07-04 15:30:51 +01:00
test_block_device.py block_device: Copy original volume_type when missing for snapshot based volumes 2019-11-21 18:13:04 +00:00
test_configdrive.py Skip existing VMs when hosts apply force_config_drive 2019-05-22 21:02:16 +00:00
test_events.py
test_fake.py
test_hardware.py Merge "hardware: Start parsing 'os_secure_boot'" 2021-03-14 08:13:43 +00:00
test_imagecache.py Include removal of ephemeral backing files in the image cache manager 2020-10-09 12:24:06 +01:00
test_images.py Remove six.text_type (2/2) 2020-12-13 11:26:35 +00:00
test_netutils.py Remove unnecessary code 2017-07-28 06:01:21 +00:00
test_osinfo.py Stop sending bad values from libosinfo to libvirt 2019-07-04 15:30:51 +01:00
test_virt.py Remove six.text_type (2/2) 2020-12-13 11:26:35 +00:00
test_virt_drivers.py Remove six.binary_type/integer_types/string_types 2020-12-13 11:25:14 +00:00