Commit Graph

22 Commits

Author SHA1 Message Date
songwenping f64d50e4dd Add nova and cyborg owner traits for resources
Resources such as vGPU can be managed either by nova
by cyborg. In order to distinguish the manage-owner, use owner (nova, cyborg)
trait in Placement when the inventory is reported.

When resource is requested, flavor based VGPU resource should be allocated
from the nova managed RP, while device profile based VGPU resource should be
allocated from the cyborg managed RP.

Change-Id: Ia50e9a1acdcfb821e2d40774c3dca191e172ca68
2022-04-27 20:20:36 +08:00
Zuul 333d1109d9 Merge "normalize_name helper" 2018-06-29 14:39:56 +00:00
Eric Fried 65a8daf8ff normalize_name helper
Names of traits in placement are restricted to certain characters and
lengths.  Consumers (e.g. Nova virt driver implementations of
update_provider_tree) may wish to generate such names dynamically based
on inputs that don't necessarily know or follow those rules.  Such
consumers could use a convenient way to sanitize generated names such
that they conform to what placement expects.

This change set introduces a normalize_name method into the base
os_traits namespace.  It is functionally identical to
ResourceClass.normalize_name: it converts and squashes any sequences of
non-alphanumeric characters to an underscore, upcases, and prepends
CUSTOM_.

Change-Id: I0d83cb39abb417b337a3429d374e88942561d254
Related-Blueprint: update-provider-tree
2018-06-13 08:18:25 -05:00
dineshbhor 46ed096e9a Adds HW_CPU_HYPERTHREADING standard trait
This patch adds a new standard trait: HW_CPU_HYPERTHREADING.

The resource provider decorated with this trait indicates that
the hyperthreading is enabled on the provider.

Partially Implements: blueprint cpu-resources

Change-Id: I762a7f11bd10f93855850d09751415d35e5b38e1
2018-06-12 00:10:34 -07:00
Jay Pipes 56531c2a81 Add compute capabilities traits
The virt driver API in nova has a capabilities dict that lists the
capabilities of the virt driver.

Based on the patch at https://review.openstack.org/#/c/538498/6, let's
try to standardize the relevant capabilities into a new
os_traits.compute module.

Change-Id: I77f2c4c696010dfe25d3282374dac702b08abaa6
2018-04-24 13:37:31 -04:00
Rodolfo Alonso Hernandez ce9bef1c5b Add a new parameter ``suffix`` to function ``get_traits``
Added a new optional parameter ``suffix`` to function ``get_traits``. This
new parameter allows filtering the list of traits returned by the ending
of the name.

Change-Id: Ifadb72a1b8b64971c0377eaef89522fe979c0c87
2017-07-20 16:31:51 +01:00
Rodolfo Alonso Hernandez 43ee0a5d68 Add filtering option in "check_traits"
Added "prefix" parameter to "check_traits" function. Now it's
possible to check a list of strings with a subset of defined
traits.

Change-Id: Ie2e7a5a7a264f887673bd3855efde44da1324701
2017-06-28 12:17:47 +01:00
jianghua wang 71e35dee0a GPU: add os traits for GPU - resolution
Different GPUs (or vGPUs) may support different resolutions.
This commit is to define traits for differentiate the resolution
for GPUs (or vGPUs).

Change-Id: I41c0bf6e17c2a2b832f251b95b5f2be7b3d5e8e9
2017-06-26 15:19:36 +01:00
jianghua wang 1db10152fb GPU: add os traits for GPU - API
Some GPUs (and vGPUs on them) support different APIs or features.
This commit is to define os traits for APIs so that the resource
providers for GPUs or vGPUs can be characterised and can be
scheduled basing on different API traits.

Change-Id: I27b80ad3fba04ef02ce9619111353702de450600
2017-06-26 11:40:32 +01:00
Jay Pipes b169eb4a8e Adds a validation test for trait names
Standard trait names should follow the regex "^[A-Z][A-Z0-9]*$". One of the
traits (HW_CPU_X86_AES-NI) erroneously contained a hyphen, so we correct that
and add a test to ensure no future traits wander from the standard trait name
regex.

Luckily, nothing yet is consuming os-traits and so the AES-NI slipup is yet to
have any impact.

Change-Id: I0603bcb4a1038289d2a3b6ce18aa823c7fac0829
2017-05-04 19:47:04 -04:00
Jay Pipes 8503afd938 Remove 'CUSTOM_NAMESPACE'/'os_traits' from traits
The get_traits() function was erroneously including 'CUSTOM_NAMESPACE' and
'os_traits' in the list of returned traits because the matching expression in
the list comprehension wasn't filtering out these two module-level string
attributes.

Also removes the name.upper() in symbolize() because that's actually dangerous
-- it may make a symbol in os_traits that doesn't actually match the trait name
defined in the submodule. For instance, if someone creates an
os_traits/foo/bar.py module with::

TRAITS = [
    'baz',
]

the name.upper() would make a symbol os_traits.foo.bar.BAZ and
os_traits.FOO_BAR_baz

Change-Id: I8633cb29649ad0ca67f7669fd2b405b55e16258e
2017-05-04 19:47:04 -04:00
Jay Pipes 5a704fd08d remove redundant get_symbol_names() func
The os_traits.get_symbol_names() function implementation was identical to the
os_traits.get_traits() function. Remove it.

Change-Id: I8656d98e51258b641190cfca1da71348ca7b6752
2017-05-04 19:47:02 -04:00
Jay Pipes 1441f4f62d Adds MISC_SHARES_VIA_AGGREGATE standard trait
As discussed in Atlanta's PTG meetings, we will use the newly-added traits
functionality to mark a resource provider as providing shared resources to a
set of other resource providers. We need a new standard trait to represent this
shared provider characteristic, and this patch adds it
MISC_SHARES_VIA_AGGREGATE along with a fairly lengthy explanation of the
trait's meaning.

Change-Id: I4e9d8389c9b93ffee20adb53d864d55d335a27fd
blueprint: shared-resources-pike
2017-04-28 09:49:32 -04:00
Jay Pipes 842a43b515 Add NIC namespace and features
Adds a set of traits representing features that hardware networking interface
controllers expose. A number of source documents were used to come up with
these traits:

https://review.openstack.org/#/c/341341/4/specs/newton/approved/standardize-network-capabilities.rst
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Guide/network-nic-offloads.html
https://www.kernel.org/doc/Documentation/networking/scaling.txt
https://www.kernel.org/doc/Documentation/networking/multiqueue.txt

Change-Id: If8a9f08b8b45ebcac53ea9a406c210605b163516
2017-04-24 11:53:21 -04:00
Jay Pipes 23d81d4451 organize os_traits for the future
Sean Mooney had a good idea that for future-proofing the os-traits library and
ensuring that we don't have to deal with one giant const.py file, that we break
the library into various modules corresponding to the higher-level namespaces.

This patch adds some symbol-registration foo into a utils module and allows the
os_traits module and "leaf modules" to be called in the following way:

 import os_traits
 from os_traits.hw.cpu import x86

 assert os_traits.HW_CPU_X86_SSE42 == x86.SSE42
 assert x86.SSE42 == 'HW_CPU_X86_SSE42'

Change-Id: I0e8f50822ab67cb3be85ed3b935dd6cdb4436dbf
2017-04-05 16:01:33 +00:00
Jay Pipes 536c9c712a Add storage and disk namespaces and features
Adds a STORAGE_ and STORAGE_DISK_ namespace to os-traits and two traits
for hard-disk drive and solid-state drives.

Change-Id: I180cee25e6a8971149e2f072b78060596eda2c22
2017-03-03 15:22:06 +00:00
Jay Pipes 2855c25eb3 Add custom namespace
Adds the CUSTOM_ trait namespace prefix, matching the CUSTOM_ prefix
from the resource classes in the placement API. Also adds a simple
is_custom() method to the library for testing whether a trait is
custom or not.

Change-Id: I37cd61516eb68c9bf07778fe6ad42bb34c19d4da
2017-03-03 14:38:26 +00:00
Jay Pipes 9452af54b1 normalize constants to align with resource classes
Changes the lowercased constants to uppercase and replaces the : with a
_ character. This aligns with the naming convention for resource classes
in the placement API.

Change-Id: Ic8e87ff8db5b1893d2060af01bf48adda712a27c
2017-03-03 12:20:38 +00:00
Yingxin f04ae239f4 Add check_traits function
The added function check_traits accepts an iteration of string and group
them as standard traits set and other traits set.
2016-10-08 08:16:03 +00:00
Yingxin 87c5fa8601 Add tests for os_traits
Added 4 basic tests for os_traits.
2016-10-08 08:12:37 +00:00
Yingxin d56ac9facb Rename the rest capabilities to traits 2016-09-20 05:40:55 +00:00
Jay Pipes d5ab376e0a Rename capabilities to traits 2016-09-19 11:00:31 -04:00