nova/nova
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
..
accelerator Remove six.text_type (1/2) 2020-12-13 11:25:31 +00:00
api Merge "docs: Add note about rescuing bfv instances with the 2.87 microversion" 2021-03-24 13:23:49 +00:00
cmd Merge "Drop support for custom schedulers" 2021-03-07 11:35:48 +00:00
compute Fix check_instance_shared_storage() call 2021-03-25 22:39:17 +00:00
conductor rpc: Rework 'get_notifier', 'wrap_exception' 2021-03-01 11:06:48 +00:00
conf libvirt: Deprecate `live_migration_tunnelled` 2021-03-16 16:50:32 +01:00
console Remove six.text_type (1/2) 2020-12-13 11:25:31 +00:00
db Merge "Dynamically archive FK related records in archive_deleted_rows" 2021-03-23 13:19:38 +00:00
hacking Add a hacking rule for assert_has_calls 2020-09-28 23:08:15 +09:00
image glance: Remove [glance]/allowed_direct_url_schemes 2021-01-28 12:46:57 +00:00
keymgr
locale Imported Translations from Zanata 2020-04-26 07:51:21 +00:00
network Merge "libvirt: Add guest generation for vDPA" 2021-03-16 00:03:00 +00:00
notifications libvirt: Add support for virtio-based input devices 2021-03-05 11:00:02 +00:00
objects Bump the Compute RPC API to version 6.0 2021-03-25 11:23:07 +01:00
pci tests: Add functional test for vDPA device 2021-03-16 20:39:27 +00:00
policies virt: Remove 'reset_network' API 2020-11-23 15:55:50 +00:00
privsep Remove VFSLocalFS 2021-03-03 17:55:43 +01:00
scheduler Merge "scheduler: Translate secure boot requests to trait" 2021-03-14 08:14:41 +00:00
servicegroup Remove six.binary_type/integer_types/string_types 2020-12-13 11:25:14 +00:00
storage Merge "rbd: Only log import failures when the RbdDriver is used" 2020-11-09 23:51:46 +00:00
tests libvirt: Simplify device_path check in _detach_encryptor 2021-04-09 10:06:44 +01:00
virt libvirt: Simplify device_path check in _detach_encryptor 2021-04-09 10:06:44 +01:00
volume Remove six.text_type (1/2) 2020-12-13 11:25:31 +00:00
__init__.py
availability_zones.py Remove six.PY2 and six.PY3 2020-08-15 07:45:23 +00:00
baserpc.py
block_device.py virt: Remove 'is_xenapi' helper 2020-09-11 14:09:06 +01:00
cache_utils.py trivial: Remove unused 'cache_utils' APIs 2020-02-05 17:20:28 +00:00
config.py Fix config option default value for sample config file 2020-11-25 00:05:08 +00:00
context.py Remove six.binary_type/integer_types/string_types 2020-12-13 11:25:14 +00:00
crypto.py Replace md5 for fips 2021-02-25 16:01:43 -05:00
debugger.py trivial: Remove remaining '_LW' instances 2020-05-18 17:00:41 +01:00
exception.py api: Block unsupported actions with vDPA 2021-03-16 20:39:27 +00:00
exception_wrapper.py rpc: Rework 'get_notifier', 'wrap_exception' 2021-03-01 11:06:48 +00:00
filters.py trivial: Remove remaining '_LI' instances 2020-05-18 17:00:57 +01:00
i18n.py trivial: Remove remaining '_LI' instances 2020-05-18 17:00:57 +01:00
loadables.py trivial: Remove dead code 2019-12-12 10:55:02 +00:00
manager.py Remove six.add_metaclass 2020-08-15 07:45:39 +00:00
middleware.py Rename 'nova.common.config' module to 'nova.middleware' 2019-08-16 00:53:03 +01:00
monkey_patch.py Correctly disable greendns 2020-09-11 12:42:04 -04:00
policy.py Reuse code from oslo lib for JSON policy migration 2021-01-14 22:41:33 +00:00
profiler.py
quota.py Make quotas respect instance_list_per_project_cells 2020-05-15 17:21:29 -04:00
rpc.py rpc: Rework 'get_notifier', 'wrap_exception' 2021-03-01 11:06:48 +00:00
safe_utils.py
service.py Restore retrying the RPC connection to conductor 2020-11-13 18:02:00 +01:00
service_auth.py
test.py Reset global wsgi app state in unit test 2021-03-24 12:04:51 +01:00
utils.py Merge "Initialize global data separately and run_once in WSGI app init" 2021-03-23 16:55:49 +00:00
version.py Change API unexpected exception message 2021-02-17 21:30:07 +00:00
weights.py Remove six.add_metaclass 2020-08-15 07:45:39 +00:00
wsgi.py trivial: Remove remaining '_LI' instances 2020-05-18 17:00:57 +01:00