compute: introduce cpu_shared_set option

The CONF.compute.cpu_shared_set option will be used for best-effort
guest vCPU resources.

It's to note that an other effort done by spec cpu-resources will use
that same option to provide isolation between dedicated and shared
instances. But currently outside of the scope of that whole serie.

Change-Id: Ibedd31e284ec9bc70e257e6a88b4d82b021db0fd
Partial-implement: bp/overhead-pin-set
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@redhat.com>
This commit is contained in:
Sahid Orentino Ferdjaoui
2018-04-17 07:04:26 -04:00
parent 50f42333f5
commit 30cda5113c
3 changed files with 41 additions and 0 deletions

View File

@@ -54,6 +54,22 @@ def get_vcpu_pin_set():
return cpuset_ids
def get_cpu_shared_set():
"""Parse cpu_shared_set config.
:returns: a set of pcpu ids can be used for best effort workloads
"""
if not CONF.compute.cpu_shared_set:
return None
shared_ids = parse_cpu_spec(CONF.compute.cpu_shared_set)
if not shared_ids:
raise exception.Invalid(_("No CPUs available after parsing "
"cpu_shared_set config. %r ") %
CONF.compute.cpu_shared_set)
return shared_ids
def parse_cpu_spec(spec):
"""Parse a CPU set specification.