Bases: object
Format a libvirt CPU range specification.
Parameters: | cpuset – set (or list) of CPU indexes |
---|
Format a set/list of CPU indexes as a libvirt CPU range specification. It allow_ranges is true, it will try to detect continuous ranges of CPUs, otherwise it will just list each CPU index explicitly.
Returns: | a formatted CPU range string |
---|
Get best CPU topology according to settings
Parameters: |
|
---|
Look at the properties set in the flavor extra specs and the image metadata and build up a list of all possible valid CPU topologies that can be used in the guest. Then return the best topology to use
Returns: | a nova.objects.VirtCPUTopology instance for best topology |
---|
Calculate new ‘numa_usage’ of ‘host’ from ‘instance’ NUMA usage
This is a convenience method to help us handle the fact that we use several different types throughout the code (ComputeNode and Instance objects, dicts, scheduler HostState) which may have both json and deserialized versions of objects.numa classes.
Handles all the complexity without polluting the class method with it.
Parameters: |
|
---|---|
Returns: | numa_usage in the format it was on the host or objects.NUMATopology instance if never_serialize_result was True |
Get the number of serial consoles from the flavor or image
Parameters: |
|
---|
If flavor extra specs is not set, then any image meta value is permitted. If flavor extra specs is set, then this provides the default serial port count. The image meta is permitted to override the extra specs, but only with a lower value. ie
Returns: | number of serial ports |
---|
Parsing vcpu_pin_set config.
Returns a set of pcpu ids can be used by instances.
Convenience method for getting the numa_topology out of hosts
Since we may get a host as either a dict, a db object, or an actual ComputeNode object, or an instance of HostState class, this makes sure we get beck either None, or an instance of objects.NUMATopology class.
Returns: | A two-tuple, first element is the topology itself or None, second is a boolean set to True if topology was in JSON format. |
---|
Convenience method for getting the numa_topology out of instances
Since we may get an Instance as either a dict, a db object, or an actual Instance object, this makes sure we get beck either None, or an instance of objects.InstanceNUMATopology class.
Fit the instance topology onto the host topology given the limits
Parameters: |
|
---|
Given a host and instance topology and optionally limits - this method will attempt to fit instance cells onto all permutations of host cells by calling the _numa_fit_instance_cell method, and return a new InstanceNUMATopology with it’s cell ids set to host cell id’s of the first successful permutation, or None.
Return topology related to input request
Parameters: |
|
---|
May raise exception.ImageNUMATopologyIncomplete() if the image properties are not correctly specified, or exception.ImageNUMATopologyForbidden if an attempt is made to override flavor settings with image properties.
Returns: | InstanceNUMATopology or None |
---|
Get host topology usage
Parameters: |
|
---|
Sum the usage from all @instances to report the overall host topology usage
Returns: | objects.NUMATopology including usage information |
---|
Parse a CPU set specification.
Parameters: | spec – cpu set string eg “1-4,^3,6” |
---|
Each element in the list is either a single CPU number, a range of CPU numbers, or a caret followed by a CPU number to be excluded from a previous range.
Returns: | a set of CPU indexes |
---|
Partitions vcpus used for realtime and ‘normal’ vcpus.
According to a mask specified from flavor or image, returns set of vcpus configured for realtime scheduler and set running as a ‘normal’ vcpus.