diff options
author | Stephen Finucane <stephenfin@redhat.com> | 2021-05-20 12:56:34 +0100 |
---|---|---|
committer | Stephen Finucane <stephenfin@redhat.com> | 2022-02-01 17:57:27 +0000 |
commit | eacecc2433562aeca1f95366200ca1679c3679a1 (patch) | |
tree | 01b8ef2f8e26fb1441f91362cf3a14a65cce6834 /nova/compute/api.py | |
parent | f42fb1241bb70b03b0715412b99257339e6bdc8d (diff) | |
download | nova-eacecc2433562aeca1f95366200ca1679c3679a1.tar.gz |
Move 'hw:pmu', 'hw_pmu' parsing to nova.virt.hardware
Virtually all of the code for parsing 'hw:'-prefixed extra specs and
'hw_'-prefix image metadata properties lives in the 'nova.virt.hardware'
module. It makes sense for these to be included there. Do that.
Change-Id: I1fabdf1827af597f9e5fdb40d5aef244024dd015
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Diffstat (limited to 'nova/compute/api.py')
-rw-r--r-- | nova/compute/api.py | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 28368d910f..90314bb4bc 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -838,17 +838,10 @@ class API: """ image_meta = _get_image_meta_obj(image) - API._validate_flavor_image_mem_encryption(flavor, image_meta) - - # validate PMU extra spec and image metadata - flavor_pmu = flavor.extra_specs.get('hw:pmu') - image_pmu = image_meta.properties.get('hw_pmu') - if (flavor_pmu is not None and image_pmu is not None and - image_pmu != strutils.bool_from_string(flavor_pmu)): - raise exception.ImagePMUConflict() - # Only validate values of flavor/image so the return results of # following 'get' functions are not used. + hardware.get_mem_encryption_constraint(flavor, image_meta) + hardware.get_pmu_constraint(flavor, image_meta) hardware.get_number_of_serial_ports(flavor, image_meta) hardware.get_realtime_cpu_constraint(flavor, image_meta) hardware.get_cpu_topology_constraints(flavor, image_meta) @@ -858,19 +851,6 @@ class API: if validate_pci: pci_request.get_pci_requests_from_flavor(flavor) - @staticmethod - def _validate_flavor_image_mem_encryption(flavor, image): - """Validate that the flavor and image don't make contradictory - requests regarding memory encryption. - - :param flavor: Flavor object - :param image: an ImageMeta object - :raises: nova.exception.FlavorImageConflict - """ - # This library function will raise the exception for us if - # necessary; if not, we can ignore the result returned. - hardware.get_mem_encryption_constraint(flavor, image) - def _get_image_defined_bdms(self, flavor, image_meta, root_device_name): image_properties = image_meta.get('properties', {}) |