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
This commit is contained in:
songwenping 2022-04-24 16:01:35 +08:00
parent 87b1165aa3
commit f64d50e4dd
3 changed files with 32 additions and 0 deletions

View File

@ -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'
]

View File

@ -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)

View File

@ -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.