mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-20 20:53:46 +00:00
acrn-config: add vm type sanity check
Refinement for VM type sanity check relays on VM UUID number. Tracked-On: #4641 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com> Acked-by: Terry Zou <terry.zou@intel.com>
This commit is contained in:
parent
119598296a
commit
16e33b30d1
@ -21,6 +21,7 @@ def get_launch_item_values(board_info):
|
||||
Get items which capable multi select for user
|
||||
:param board_info: it is a file what contains board information for script to read from
|
||||
"""
|
||||
common.BOARD_INFO_FILE = board_info
|
||||
launch_item_values = {}
|
||||
|
||||
# passthrough devices
|
||||
|
@ -203,20 +203,23 @@ def is_config_file_match():
|
||||
return (err_dic, match)
|
||||
|
||||
|
||||
def get_vm_uuid_idx(vm_type, uosid):
|
||||
|
||||
i_cnt = 0
|
||||
for vm_i,vm_t in common.VM_TYPES.items():
|
||||
if vm_t == vm_type and vm_i <= uosid:
|
||||
i_cnt += 1
|
||||
if i_cnt > 0:
|
||||
i_cnt -= 1
|
||||
|
||||
return i_cnt
|
||||
|
||||
|
||||
def get_scenario_uuid(uosid):
|
||||
# {id_num:uuid} (id_num:0~max)
|
||||
scenario_uuid = ''
|
||||
if common.VM_TYPES[uosid] == "KATA_VM" or common.VM_TYPES[uosid] == "POST_RT_VM":
|
||||
return scenario_cfg_lib.VM_DB[common.VM_TYPES[uosid]]['uuid']
|
||||
|
||||
i_cnt = 0
|
||||
for vm_i,vm_type in common.VM_TYPES.items():
|
||||
if vm_type == "POST_STD_VM" and vm_i <= uosid:
|
||||
i_cnt += 1
|
||||
if i_cnt > 0:
|
||||
i_cnt = 0
|
||||
|
||||
scenario_uuid = scenario_cfg_lib.VM_DB["POST_STD_VM"]['uuid'][i_cnt]
|
||||
i_cnt = get_vm_uuid_idx(common.VM_TYPES[uosid], uosid)
|
||||
scenario_uuid = scenario_cfg_lib.VM_DB[common.VM_TYPES[uosid]]['uuid'][i_cnt]
|
||||
return scenario_uuid
|
||||
|
||||
|
||||
|
@ -38,13 +38,13 @@ PT_SUB_PCI['ethernet'] = ['Ethernet controller', 'Network controller', '802.1a c
|
||||
PT_SUB_PCI['sata'] = ['SATA controller']
|
||||
PT_SUB_PCI['nvme'] = ['Non-Volatile memory controller']
|
||||
UUID_DB = {
|
||||
'SOS_VM':'dbbbd434-7a57-4216-a12c-2201f1ab0240',
|
||||
'SAFETY_VM':'fc836901-8685-4bc0-8b71-6e31dc36fa47',
|
||||
'SOS_VM':['dbbbd434-7a57-4216-a12c-2201f1ab0240'],
|
||||
'SAFETY_VM':['fc836901-8685-4bc0-8b71-6e31dc36fa47'],
|
||||
'PRE_STD_VM':['26c5e0d8-8f8a-47d8-8109-f201ebd61a5e', 'dd87ce08-66f9-473d-bc58-7605837f935e'],
|
||||
'POST_STD_VM':['d2795438-25d6-11e8-864e-cb7a18b34643', '615db82a-e189-4b4f-8dbb-d321343e4ab3',
|
||||
'38158821-5208-4005-b72a-8a609e4190d0', 'a6750180-f87a-48d2-91d9-4e7f62b6519e', 'd1816e4a-a9bb-4cb4-a066-3f1a8a5ce73f'],
|
||||
'POST_RT_VM':'495ae2e5-2603-4d64-af76-d4bc5a8ec0e5',
|
||||
'KATA_VM':'a7ada506-1ab0-4b6b-a0da-e513ca9b8c2f',
|
||||
'POST_RT_VM':['495ae2e5-2603-4d64-af76-d4bc5a8ec0e5'],
|
||||
'KATA_VM':['a7ada506-1ab0-4b6b-a0da-e513ca9b8c2f'],
|
||||
}
|
||||
|
||||
VM_DB = {
|
||||
@ -156,19 +156,29 @@ def load_vm_check(load_vms, item):
|
||||
if "POST_RT_VM" == load_str:
|
||||
rt_vm_ids.append(order_i)
|
||||
|
||||
if len(kata_vm_ids) >=2:
|
||||
if len(kata_vm_ids) > len(UUID_DB["KATA_VM"]):
|
||||
key = "vm:id={},{}".format(kata_vm_ids[0], item)
|
||||
ERR_LIST[key] = "KATA VM number should not be greater than 1"
|
||||
ERR_LIST[key] = "KATA VM number should not be greater than {}".format(len(UUID_DB["KATA_VM"]))
|
||||
return
|
||||
|
||||
if len(rt_vm_ids) >= 2:
|
||||
if len(rt_vm_ids) > len(UUID_DB["POST_RT_VM"]):
|
||||
key = "vm:id={},{}".format(rt_vm_ids[0], item)
|
||||
ERR_LIST[key] = "POST RT VM number should not be greater than 1"
|
||||
ERR_LIST[key] = "POST RT VM number should not be greater than {}".format(len(UUID_DB["POST_RT_VM"]))
|
||||
return
|
||||
|
||||
if len(sos_vm_ids) >= 2:
|
||||
if len(sos_vm_ids) > 1:
|
||||
key = "vm:id={},{}".format(sos_vm_ids[0], item)
|
||||
ERR_LIST[key] = "SOS vm number should not be greater than 1"
|
||||
ERR_LIST[key] = "SOS VM number should not be greater than 1"
|
||||
return
|
||||
|
||||
if len(post_vm_ids) > len(UUID_DB["POST_STD_VM"]):
|
||||
key = "vm:id={},{}".format(post_vm_ids[0], item)
|
||||
ERR_LIST[key] = "POST Standard vm number should not be greater than {}".format(len(UUID_DB["POST_STD_VM"]))
|
||||
return
|
||||
|
||||
if len(pre_vm_ids) > len(UUID_DB["PRE_STD_VM"]):
|
||||
key = "vm:id={},{}".format(pre_vm_ids[0], item)
|
||||
ERR_LIST[key] = "PRE Standard vm number should not be greater than {}".format(len(UUID_DB["PRE_STD_VM"]))
|
||||
return
|
||||
|
||||
if post_vm_ids and sos_vm_ids:
|
||||
|
Loading…
Reference in New Issue
Block a user