From f64d50e4dd2f21558fb73dd4b59cd1d4b121b707 Mon Sep 17 00:00:00 2001 From: songwenping Date: Sun, 24 Apr 2022 16:01:35 +0800 Subject: [PATCH] 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 --- os_traits/owner/__init__.py | 20 +++++++++++++++++++ os_traits/tests/test_os_traits.py | 6 ++++++ .../add-owner-trait-f33e0e038961cbbd.yaml | 6 ++++++ 3 files changed, 32 insertions(+) create mode 100644 os_traits/owner/__init__.py create mode 100644 releasenotes/notes/add-owner-trait-f33e0e038961cbbd.yaml diff --git a/os_traits/owner/__init__.py b/os_traits/owner/__init__.py new file mode 100644 index 0000000..b36bc7d --- /dev/null +++ b/os_traits/owner/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- + +# 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. + +TRAITS = [ + # The resource provider owner is Cyborg. + 'CYBORG', + # The resource provider owner is Nova. + 'NOVA' +] diff --git a/os_traits/tests/test_os_traits.py b/os_traits/tests/test_os_traits.py index da12dc5..a8b4400 100644 --- a/os_traits/tests/test_os_traits.py +++ b/os_traits/tests/test_os_traits.py @@ -124,3 +124,9 @@ class TestSymbols(base.TestCase): for test_value, expected in values: result = ot.normalize_name(test_value) self.assertEqual(expected, result) + + +def test_owner_trait(self): + # Test for owner prefix traits. + traits = ot.get_traits('OWNER') + self.assertEqual(["OWNER_CYBORG", "OWNER_NOVA"], traits) diff --git a/releasenotes/notes/add-owner-trait-f33e0e038961cbbd.yaml b/releasenotes/notes/add-owner-trait-f33e0e038961cbbd.yaml new file mode 100644 index 0000000..71b5580 --- /dev/null +++ b/releasenotes/notes/add-owner-trait-f33e0e038961cbbd.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Add owner trait of ``OWNER_NOVA`` and ``OWNER_CYBORG`` for resource + providers in order to solve the shared resource class(such as ``VGPU``) + problem by each service recording that they created.