nova/nova/scheduler
Adam Spiers b4905467db Add extra spec parameter and image property for memory encryption
Add a new "hw:mem_encryption" extra spec parameter, and a new
"hw_mem_encryption" image property, which indicate that any guest
booted with that extra spec parameter or image property respectively
needs to be booted with its memory hardware-encrypted.

This is achieved by converting the requirement stated in the extra
spec parameter and/or image property into an additional extra spec
parameter which requests resources for one slot of the inventory of
the new MEM_ENCRYPTION_CONTEXT resource class (introduced in
os-resource-classes 0.4.0).  The inventory will be provided by the
follow-up commit I659cb77f12a38a4d2fb118530ebb9de88d2ed30d.

Since future commits adding support for SEV to guest XML config will
also need to know at launch-time whether memory encryption has been
requested, add a reusable mem_encryption_requested() function to the
nova.virt.hardware library for detecting which of the extra spec /
image property (if either) have requested encrypted memory.

If both the extra spec parameter and the image property are explicitly
specified and they contradict each other, or if either request memory
encryption but the image does not have hw_firmware_type set to UEFI,
then log an error and raise a new generic FlavorImageConflict
exception.  This exception can also be useful in the future for
handling other similar conflicts.  In this particular use case,
FlavorImageConflict is raised by mem_encryption_requested(), and then
if caught during API call validation, it's re-raised as
HTTPBadRequest.

In order to test this code, we need to construct various ImageMeta
objects containing fake data and a ImageMetaProps instance for each.
This is a slightly fiddly task which future patches in the SEV series
will also need to perform, so add a helper to nova.tests.unit.image.fake
for this.

blueprint: amd-sev-libvirt-support
Change-Id: I8c63b5cc5ad97ce831adb2eb96a995ebc798ecb7
2019-09-01 15:17:31 +01:00
..
client trivial: Remove unused '_instance_to_allocations_dict' function 2019-08-07 02:11:31 +00:00
filters Merge "Remove 'hardware.host_topology_and_format_from_host'" 2019-08-23 16:23:31 +00:00
weights hacking: Resolve W503 (line break occurred before a binary operator) 2019-06-24 14:24:06 -05:00
__init__.py Improve hacking rule to avoid author markers 2014-05-05 14:35:20 +02:00
driver.py Remove the CachingScheduler 2018-10-18 17:55:36 -04:00
filter_scheduler.py Fix WeighedHost logging regression 2019-03-05 17:16:23 -05:00
host_manager.py Change HostManager to allow scheduling to other cells 2019-08-27 14:26:33 -04:00
manager.py Cache host to cell mapping in HostManager 2019-08-06 16:20:23 -04:00
request_filter.py Add placement request pre-filter compute_status_filter 2019-07-02 16:01:02 -04:00
rpcapi.py Use long_rpc_timeout in select_destinations RPC call 2018-11-20 09:03:53 -05:00
utils.py Add extra spec parameter and image property for memory encryption 2019-09-01 15:17:31 +01:00