diff options
author | Wang Huaqiang <huaqiang.wang@intel.com> | 2020-05-14 15:55:24 +0800 |
---|---|---|
committer | Wang Huaqiang <huaqiang.wang@intel.com> | 2020-07-15 00:39:46 +0800 |
commit | ba3388d666ad344e87de3bbf8f76ab494bb4421f (patch) | |
tree | 618a955a6074ccecca71c4233b34ffa037eecc55 /nova/objects/instance_numa.py | |
parent | d992eb2f5a58e0a589b68384ceb02c880489e135 (diff) | |
download | nova-ba3388d666ad344e87de3bbf8f76ab494bb4421f.tar.gz |
objects: Introduce the 'CPUAllocationPolicy.MIXED' enum
Introduce a 'mixed' instance CPU allocation policy and
will be worked with upcoming patches, for purpose of
creating an instance combined shared CPUs with dedicated
or realtime CPUs.
In an instance mixed with different type of CPUs, the shared CPU
shared CPU time slots with other instances, and also might be a
CPU with less or un-guaranteed hardware resources, which implies
to have no guarantee for the behavior of the workload running on
it. If we call the shared CPU as 'low priority' CPU, then the
realtime or dedicated CPU could be called as 'high priority' CPU,
user could assign more hardware CPU resources or place some
guaranteed resource to it to let the workload to entail high
performance or stable service quality.
Based on https://review.opendev.org/714704
Part of blueprint use-pcpu-and-vcpu-in-one-instance
Change-Id: I99cfee14bb105a8792651129426c0c5a3749796d
Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Diffstat (limited to 'nova/objects/instance_numa.py')
-rw-r--r-- | nova/objects/instance_numa.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/nova/objects/instance_numa.py b/nova/objects/instance_numa.py index 14350a69bf..d067ba87d3 100644 --- a/nova/objects/instance_numa.py +++ b/nova/objects/instance_numa.py @@ -19,6 +19,7 @@ from oslo_utils import versionutils from nova.db import api as db from nova import exception +from nova.i18n import _ from nova.objects import base from nova.objects import fields as obj_fields from nova.virt import hardware @@ -34,12 +35,22 @@ class InstanceNUMACell(base.NovaEphemeralObject, # Version 1.3: Add cpu_policy and cpu_thread_policy fields # Version 1.4: Add cpuset_reserved field # Version 1.5: Add pcpuset field - VERSION = '1.5' + # Version 1.6: Add 'mixed' to cpu_policy field + VERSION = '1.6' def obj_make_compatible(self, primitive, target_version): super(InstanceNUMACell, self).obj_make_compatible(primitive, target_version) target_version = versionutils.convert_version_to_tuple(target_version) + # Instance with a 'mixed' CPU policy could not provide a backward + # compatibility. + if target_version < (1, 6): + if primitive['cpu_policy'] == obj_fields.CPUAllocationPolicy.MIXED: + raise exception.ObjectActionError( + action='obj_make_compatible', + reason=_('mixed instance is not supported in version %s') % + target_version) + # NOTE(huaqiang): Since version 1.5, 'cpuset' is modified to track the # unpinned CPUs only, with pinned CPUs tracked via 'pcpuset' instead. # For a backward compatibility, move the 'dedicated' instance CPU list |