Tests deploying an instance mapped to shared PCPUs and dedicated PCPUs on the host [1] New test method deploys an instance using a flavor with a mixed dedicated policy. Currently deploys with a mask that excludes core id 0 of the guest instance from mapping its cores to dedicated PCPUs from the host. [1] https://specs.openstack.org/openstack/nova-specs/specs/victoria/implemented/use-pcpu-vcpu-in-one-instance.html Change-Id: Id9a32f1439ee8b646f35988675f352e789deaf12
42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
# Copyright 2021 Red Hat
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from whitebox_tempest_plugin import hardware
|
|
|
|
|
|
class NUMAHelperMixin(object):
|
|
"""Mixin class containing helpers to obtain NUMA-related information about
|
|
a server from its XML.
|
|
"""
|
|
|
|
def get_pinning_as_set(self, server_id):
|
|
pinset = set()
|
|
root = self.get_server_xml(server_id)
|
|
vcpupins = root.findall('./cputune/vcpupin')
|
|
for pin in vcpupins:
|
|
pinset |= hardware.parse_cpu_spec(pin.get('cpuset'))
|
|
return pinset
|
|
|
|
def get_host_pcpus_for_guest_vcpu(self, server_id, instance_cpu_id):
|
|
"""Search the xml vcpu element of the provided instance for its cpuset.
|
|
Convert cpuset found into a set of integers.
|
|
"""
|
|
|
|
xml_cpu_search = "./cputune/vcpupin[@vcpu='%s']" % instance_cpu_id
|
|
root = self.get_server_xml(server_id)
|
|
cpus = root.find(xml_cpu_search)
|
|
cpuset = cpus.attrib.get('cpuset')
|
|
return hardware.parse_cpu_spec(cpuset)
|