mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-10 05:09:01 +00:00
misc: move the RDT interface to common library
The current RDT class and interface was define by the clos.py which is mix get and merge RDT policy, create clos nodes. Now we need call these interface to check the CLOS IDs number after merged RDT policy, so this patch abstract the RDT interface to common and add an assert to check the CLOS IDs number. Tracked-On: #6690 Signed-off-by: Chenli Wei <chenli.wei@intel.com> Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
from decimal import Decimal
|
||||
from copy import copy
|
||||
import operator
|
||||
import rdt
|
||||
import elementpath
|
||||
|
||||
BaseParser = elementpath.XPath2Parser
|
||||
@@ -20,6 +21,8 @@ class CustomParser(BaseParser):
|
||||
|
||||
'has',
|
||||
'duplicate-values',
|
||||
|
||||
'number-of-clos-id-needed',
|
||||
}
|
||||
|
||||
method = CustomParser.method
|
||||
@@ -84,6 +87,14 @@ def select_duplicate_values_function(self, context=None):
|
||||
|
||||
yield from duplicate_values()
|
||||
|
||||
@method(function('number-of-clos-id-needed', nargs=1))
|
||||
def evaluate_number_of_clos_id_needed(self, context=None):
|
||||
op = self.get_argument(context, index=0)
|
||||
try:
|
||||
return len(rdt.get_policy_list(op.elem)) if op else 0
|
||||
except AttributeError as err:
|
||||
raise self.error('XPTY0004', err)
|
||||
|
||||
###
|
||||
# Collection of counter examples
|
||||
|
||||
|
Reference in New Issue
Block a user