nova/nova
Stephen Finucane 452d2fb3a0 libvirt: Move some host arch checks to guest checks
We have a load of tests to enable specific behavior depending on the
guest architecture, but in many cases we're actually testing the host
architecture. This is wrong and breaks our ability to create guests with
non-host architectures plus our ability to rely on mocking of these APIs
by 'FakeLibvirt'. We fix this by switching checks against the CPU
architecture reported by libvirt's host capabilities, to checks against
the guest image metadata (via 'nova.virt.libvirt.utils.get_arch') with a
fallback to the host architecture (via 'os.uname'). This seemingly
simple change subsequently highlights *a lot* of gaps in the mocking
done by 'FakeLibvirtFixture'. Pretty much all of these stem from the
fact that by previously extracting the CPU host architecture from host
capabilities, we were in practice almost always checking against x86-64.
Now that we're doing checks against image metadata with a fallback to
'os.uname()', we suddenly need to be able to provide host and domain
capabilities for other architectures and doing additional mocks for some
of these architecture-specific code paths.

Note that this change effectively removes test coverage for the
'LibvirtDriver._has_uefi_support' helper because we now mock it in the
'FakeLibvirtFixture' to avoid checks in AArch64 tests (AArch64 defaults
to a UEFI bootloader). This is okay since we're going to remove this
helper entirely in a future change.

Also note that this _still_ isn't as complete as I'd like it to be,
owing to time constraints and the sheer depth of the problem here. The
remaining issues will be addressed in follow-ups, potentially alongside
patches to drop support for legacy architectures like MIPS and I686 (the
former has been EOL'd in favour of RISC-V as of March 2021 and both
Intel and AMD stopped manufacturing products using the latter ISA for
anything other than embedded use cases many moons ago).

Change-Id: I158dd70076ecdbef422ef08c11ce6a140c991537
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-03-09 12:37:21 +00:00
..
accelerator Remove six.text_type (1/2) 2020-12-13 11:25:31 +00:00
api Merge "objects: Add 'socket' PCI NUMA affinity" 2021-03-01 10:26:14 +00:00
cmd Merge "Drop support for custom schedulers" 2021-03-07 11:35:48 +00:00
compute rpc: Rework 'get_notifier', 'wrap_exception' 2021-03-01 11:06:48 +00:00
conductor rpc: Rework 'get_notifier', 'wrap_exception' 2021-03-01 11:06:48 +00:00
conf Merge "libvirt: Add support for virtio-based input devices" 2021-03-07 14:24:16 +00:00
console Remove six.text_type (1/2) 2020-12-13 11:25:31 +00:00
db Merge "apidb: Compact Pike database migrations" 2021-03-07 10:15:09 +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 Add net & utils methods for routed nets & segments 2021-02-19 19:23:03 +01:00
notifications libvirt: Add support for virtio-based input devices 2021-03-05 11:00:02 +00:00
objects libvirt: Add support for virtio-based input devices 2021-03-05 11:00:02 +00:00
pci Merge "pci: Improve testing of 'nova.pci.request' module" 2021-02-05 04:14:02 +00:00
policies virt: Remove 'reset_network' API 2020-11-23 15:55:50 +00:00
privsep libvirt: Drop support for Xen 2021-01-22 10:06:40 +00:00
scheduler scheduler: Translate secure boot requests to trait 2021-03-08 16:33:16 +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: Move some host arch checks to guest checks 2021-03-09 12:37:21 +00:00
virt libvirt: Move some host arch checks to guest checks 2021-03-09 12:37:21 +00: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 nova-manage: Add libvirt update_machine_type command 2021-03-03 14:03:49 +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
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 Centralize sqlite FK constraint enforcement 2021-02-12 20:58:08 +00:00
utils.py utils: Remove periods from instance hostnames 2021-01-14 11:04:22 +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