nova/nova/tests/unit/virt
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
..
disk tests: Poison os.uname 2021-02-20 15:32:15 +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: Move some host arch checks to guest checks 2021-03-09 12:37:21 +00: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 hardware: Start parsing 'os_secure_boot' 2021-03-08 16:33:15 +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