mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-05 07:35:31 +00:00
misc: rename common.py to avoid private library conflict
The offline tool use a utility libary and use "common" to named it, this name conflict with some customer's local library, so we rename it to a better and clear name. Tracked-On: #6690 Signed-off-by: Chenli Wei <chenli.wei@intel.com>
This commit is contained in:
@@ -7,13 +7,14 @@
|
||||
|
||||
import sys, os
|
||||
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'library'))
|
||||
import common, board_cfg_lib
|
||||
import acrn_config_utilities, board_cfg_lib
|
||||
from acrn_config_utilities import get_node
|
||||
|
||||
def sos_cpu_affinity(etree):
|
||||
if common.get_node("//vm[load_order = 'SERVICE_VM']", etree) is None:
|
||||
if get_node("//vm[load_order = 'SERVICE_VM']", etree) is None:
|
||||
return None
|
||||
|
||||
if common.get_node("//vm[load_order = 'SERVICE_VM' and count(cpu_affinity//pcpu_id)]", etree) is not None:
|
||||
if get_node("//vm[load_order = 'SERVICE_VM' and count(cpu_affinity//pcpu_id)]", etree) is not None:
|
||||
return None
|
||||
|
||||
sos_extend_all_cpus = board_cfg_lib.get_processor_info()
|
||||
@@ -25,12 +26,12 @@ def sos_cpu_affinity(etree):
|
||||
def fn(board_etree, scenario_etree, allocation_etree):
|
||||
cpus_for_sos = sos_cpu_affinity(scenario_etree)
|
||||
if cpus_for_sos:
|
||||
if common.get_node("//vm[load_order = 'SERVICE_VM']", scenario_etree) is not None:
|
||||
vm_id = common.get_node("//vm[load_order = 'SERVICE_VM']/@id", scenario_etree)
|
||||
allocation_sos_vm_node = common.get_node(f"/acrn-config/vm[@id='{vm_id}']", allocation_etree)
|
||||
if allocation_sos_vm_node is None:
|
||||
allocation_sos_vm_node = common.append_node("/acrn-config/vm", None, allocation_etree, id = vm_id)
|
||||
if common.get_node("./load_order", allocation_sos_vm_node) is None:
|
||||
common.append_node("./load_order", "SERVICE_VM", allocation_sos_vm_node)
|
||||
if get_node("//vm[load_order = 'SERVICE_VM']", scenario_etree) is not None:
|
||||
vm_id = get_node("//vm[load_order = 'SERVICE_VM']/@id", scenario_etree)
|
||||
allocation_service_vm_node = get_node(f"/acrn-config/vm[@id='{vm_id}']", allocation_etree)
|
||||
if allocation_service_vm_node is None:
|
||||
allocation_service_vm_node = acrn_config_utilities.append_node("/acrn-config/vm", None, allocation_etree, id = vm_id)
|
||||
if get_node("./load_order", allocation_service_vm_node) is None:
|
||||
acrn_config_utilities.append_node("./load_order", "SERVICE_VM", allocation_service_vm_node)
|
||||
for pcpu_id in sorted([int(x) for x in cpus_for_sos]):
|
||||
common.append_node("./cpu_affinity/pcpu_id", str(pcpu_id), allocation_sos_vm_node)
|
||||
acrn_config_utilities.append_node("./cpu_affinity/pcpu_id", str(pcpu_id), allocation_service_vm_node)
|
||||
|
||||
Reference in New Issue
Block a user