From cd72755e1526c4b512ea1a0f1e27121063a24373 Mon Sep 17 00:00:00 2001 From: panhengchang Date: Wed, 4 Jun 2025 11:18:27 +0800 Subject: [PATCH] add virtcca resource class (cherry picked from commit 1f5b1050cf5bcff336ecb5f4f4180510ddaeefa9) --- 0001-add-virtcca-resource-class.patch | 69 +++++++++++++++++++++++++++ python-os-resource-classes.spec | 8 +++- 2 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 0001-add-virtcca-resource-class.patch diff --git a/0001-add-virtcca-resource-class.patch b/0001-add-virtcca-resource-class.patch new file mode 100644 index 0000000..3991d97 --- /dev/null +++ b/0001-add-virtcca-resource-class.patch @@ -0,0 +1,69 @@ +From 0f17ecb8d1e4094d89a8e364ed9a0f5fb9759aa6 Mon Sep 17 00:00:00 2001 +From: liuhao365 +Date: Tue, 20 May 2025 17:18:39 +0800 +Subject: [PATCH] add virtcca resource class + +Add new resource classes to support virtcca in openstack: +SECURE_MEM_CONTEXT: secure memory for virtcca +VIRTCCA_KAE_VF: Kunpeng Accelerator Engine virt function for virtcca +VIRTCCA_HUGEPAGE: Kunpeng hugepage function for virtcca +SECURE_NUMA_0-SECURE_NUMA_7: secure numa for virtcca +VIRTCCA_VM, VIRTCCA_VCPU: base spec for virtcca +SECURE_NUMA_1G_PAGE_0-SECURE_NUMA_1G_PAGE_7: virtcca buddy info + +Signed-off-by: liuhao +--- + os_resource_classes/__init__.py | 21 ++++++++++++++++ + os_resource_classes/tests/test_os_resource_classes.py | 4 ++-- + 2 files changed, 23 insertions(+), 2 deletions(-) + +diff --git a/os_resource_classes/__init__.py b/os_resource_classes/__init__.py +index 31de1b2..e9545fe 100644 +--- a/os_resource_classes/__init__.py ++++ b/os_resource_classes/__init__.py +@@ -72,6 +72,27 @@ STANDARDS = [ + 'FPGA', + # A physical GPU for compute offload. + 'PGPU', ++ 'SECURE_MEM_CONTEXT', ++ 'VIRTCCA_KAE_VF', ++ 'VIRTCCA_HUGEPAGE', ++ 'SECURE_NUMA_0', ++ 'SECURE_NUMA_1', ++ 'SECURE_NUMA_2', ++ 'SECURE_NUMA_3', ++ 'SECURE_NUMA_4', ++ 'SECURE_NUMA_5', ++ 'SECURE_NUMA_6', ++ 'SECURE_NUMA_7', ++ 'VIRTCCA_VM', ++ 'VIRTCCA_VCPU', ++ 'SECURE_NUMA_1G_PAGE_0', ++ 'SECURE_NUMA_1G_PAGE_1', ++ 'SECURE_NUMA_1G_PAGE_2', ++ 'SECURE_NUMA_1G_PAGE_3', ++ 'SECURE_NUMA_1G_PAGE_4', ++ 'SECURE_NUMA_1G_PAGE_5', ++ 'SECURE_NUMA_1G_PAGE_6', ++ 'SECURE_NUMA_1G_PAGE_7', + ] + + # Namespace used for custom resource classes +diff --git a/os_resource_classes/tests/test_os_resource_classes.py b/os_resource_classes/tests/test_os_resource_classes.py +index 05b90f3..43a9d7b 100644 +--- a/os_resource_classes/tests/test_os_resource_classes.py ++++ b/os_resource_classes/tests/test_os_resource_classes.py +@@ -44,8 +44,8 @@ class TestOs_resource_classes(base.TestCase): + of the STANDARDS list, otherwise database ids will get confused + in the placement service. + """ +- expected_last_class = rc.PGPU +- expected_length = 18 ++ expected_last_class = rc.SECURE_NUMA_1G_PAGE_7 ++ expected_length = 39 + self.assertEqual(expected_last_class, rc.STANDARDS[-1]) + self.assertEqual(expected_length, len(rc.STANDARDS)) + +-- + + diff --git a/python-os-resource-classes.spec b/python-os-resource-classes.spec index 476638a..a27c112 100644 --- a/python-os-resource-classes.spec +++ b/python-os-resource-classes.spec @@ -4,11 +4,12 @@ Name: python-os-resource-classes Version: 1.0.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A library containing standardized resource class names in the Placement service. License: Apache-2.0 URL: https://opendev.org/openstack/os-resource-classes Source0: http://tarballs.openstack.org/os-resource-classes/os-resource-classes-1.0.0.tar.gz +Patch0: 0001-add-virtcca-resource-class.patch BuildArch: noarch BuildRequires: git @@ -63,7 +64,7 @@ Documentation for os-resource-classes %endif %prep -%autosetup -n os-resource-classes-1.0.0 -S git +%autosetup -n os-resource-classes-1.0.0 -S git -p1 rm -rf os_resource_classes.egg-info %py_req_cleanup @@ -93,6 +94,9 @@ rm -rf doc/build/html/.{doctrees,buildinfo} %changelog +* Thu May 8 2025 liuhao365 - 1.0.0-3 +- add virtcca resource class + * Wed Apr 17 2024 OpenStack_SIG - 1.0.0-2 - Use the %{python3_version} macro instead of '?.?' to adapt to Python3.11 -- Gitee