acrn-config: add attributes for scenario and launch setting

There are no board/scenario/uos_launcher attributes for created
scenario and launch settings, which causes xml mismatch error
when generating configuration files or launch scripts.
This patch is to add the attributes for scearnio and launch
settings.

Tracked-On: #4641

Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Acked-by: Terry Zou <terry.zou@intel.com>
This commit is contained in:
Shuang Zheng 2020-04-21 10:05:19 +08:00 committed by wenlingz
parent 3799b95be5
commit bcfbc13fb0

View File

@ -204,7 +204,7 @@ def save_scenario():
break break
for vm in generic_scenario_config_root.getchildren(): for vm in generic_scenario_config_root.getchildren():
if vm.tag == 'vm': if vm.tag == 'vm':
for i in range(0, 7): for i in range(0, 8):
if str(i) not in vm_list: if str(i) not in vm_list:
break break
vm.attrib['id'] = str(i) vm.attrib['id'] = str(i)
@ -216,6 +216,9 @@ def save_scenario():
remove_vm_id = generator.split(':')[1] remove_vm_id = generator.split(':')[1]
scenario_config.delete_curr_key('vm:id='+remove_vm_id.strip()) scenario_config.delete_curr_key('vm:id='+remove_vm_id.strip())
scenario_config.set_curr_attr('board', board_type)
scenario_config.set_curr_attr('scenario', scenario_config_data['new_scenario_name'])
tmp_scenario_file = os.path.join(scenario_path, 'user_defined', tmp_scenario_file = os.path.join(scenario_path, 'user_defined',
'tmp_'+scenario_config_data['new_scenario_name']+'.xml') 'tmp_'+scenario_config_data['new_scenario_name']+'.xml')
# if os.path.isfile(tmp_scenario_file): # if os.path.isfile(tmp_scenario_file):
@ -305,12 +308,7 @@ def save_launch():
break break
vm.attrib['id'] = str(i) vm.attrib['id'] = str(i)
vm_to_add.append(vm) vm_to_add.append(vm)
# print('-'*100)
# print(generator)
# print(vm_list)
# print(curr_vm_id)
# print(curr_vm_index)
# print(i)
for vm in vm_to_add: for vm in vm_to_add:
launch_config.insert_curr_elem(curr_vm_index, vm) launch_config.insert_curr_elem(curr_vm_index, vm)
elif generator.startswith('remove_vm:'): elif generator.startswith('remove_vm:'):
@ -322,6 +320,9 @@ def save_launch():
current_app.config.get('BOARD_TYPE'), current_app.config.get('BOARD_TYPE'),
'user_defined', scenario_name + '.xml') 'user_defined', scenario_name + '.xml')
launch_config.set_curr_attr('scenario', scenario_name) launch_config.set_curr_attr('scenario', scenario_name)
launch_config.set_curr_attr('board', current_app.config.get('BOARD_TYPE'))
launch_config.set_curr_attr('uos_launcher', str(len(launch_config.get_curr_root().getchildren())))
tmp_launch_file = os.path.join(current_app.config.get('CONFIG_PATH'), xml_configs[1], tmp_launch_file = os.path.join(current_app.config.get('CONFIG_PATH'), xml_configs[1],
'user_defined', 'user_defined',