def get_scenario_item_values(board_info, scenario_info): """ Glue code to provide user selectable options to config UI tool. Return a dictionary of key-value pairs containing features and corresponding lists of user selectable values to the config UI tool. :param board_info: file that contains board information """ hv_cfg_lib.ERR_LIST = {} scenario_item_values = {} hw_info = HwInfo(board_info) hv_info = HvInfo(scenario_info) # get vm count common.BOARD_INFO_FILE = board_info common.SCENARIO_INFO_FILE = scenario_info common.get_vm_num(scenario_info) common.get_vm_types() # per scenario guest_flags = copy.deepcopy(common.GUEST_FLAG) guest_flags.remove('0UL') scenario_item_values['vm,vm_type'] = scenario_cfg_lib.LOAD_VM_TYPE scenario_item_values["vm,cpu_affinity"] = hw_info.get_processor_val() scenario_item_values["vm,guest_flags"] = guest_flags scenario_item_values["vm,clos,vcpu_clos"] = hw_info.get_clos_val() scenario_item_values["vm,pci_devs"] = scenario_cfg_lib.avl_pci_devs() scenario_item_values["vm,os_config,kern_type"] = scenario_cfg_lib.KERN_TYPE_LIST scenario_item_values["vm,mmio_resources,p2sb"] = hv_cfg_lib.N_Y scenario_item_values["vm,mmio_resources,TPM2"] = hv_cfg_lib.N_Y scenario_item_values.update(scenario_cfg_lib.avl_vuart_ui_select(scenario_info)) scenario_item_values["vm,console_vuart,base"] = ['INVALID_PCI_BASE', 'PCI_VUART'] scenario_item_values["vm,communication_vuart,base"] = ['INVALID_PCI_BASE', 'PCI_VUART'] # board (scenario_item_values["vm,board_private,rootfs"], num) = board_cfg_lib.get_rootfs(board_info) scenario_item_values["hv,DEBUG_OPTIONS,RELEASE"] = hv_cfg_lib.N_Y scenario_item_values["hv,DEBUG_OPTIONS,NPK_LOGLEVEL"] = hv_cfg_lib.get_select_range("DEBUG_OPTIONS", "LOG_LEVEL") scenario_item_values["hv,DEBUG_OPTIONS,MEM_LOGLEVEL"] = hv_cfg_lib.get_select_range("DEBUG_OPTIONS", "LOG_LEVEL") scenario_item_values["hv,DEBUG_OPTIONS,CONSOLE_LOGLEVEL"] = hv_cfg_lib.get_select_range("DEBUG_OPTIONS", "LOG_LEVEL") scenario_item_values["hv,DEBUG_OPTIONS,SERIAL_CONSOLE"] = board_cfg_lib.get_native_ttys_info(board_info) scenario_item_values["hv,DEBUG_OPTIONS,LOG_DESTINATION"] = hv_cfg_lib.get_select_range("DEBUG_OPTIONS", "LOG_DESTINATION_BITMAP") scenario_item_values["hv,CAPACITIES,MAX_IOAPIC_NUM"] = hv_cfg_lib.get_select_range("CAPACITIES", "IOAPIC_NUM") scenario_item_values["hv,FEATURES,MULTIBOOT2"] = hv_cfg_lib.N_Y scenario_item_values["hv,FEATURES,RDT,RDT_ENABLED"] = board_cfg_lib.get_rdt_select_opt() scenario_item_values["hv,FEATURES,RDT,CDP_ENABLED"] = board_cfg_lib.get_rdt_select_opt() scenario_item_values["hv,FEATURES,SCHEDULER"] = hv_cfg_lib.SCHEDULER_TYPE scenario_item_values["hv,FEATURES,RELOC"] = hv_cfg_lib.N_Y scenario_item_values["hv,FEATURES,HYPERV_ENABLED"] = hv_cfg_lib.N_Y scenario_item_values["hv,FEATURES,ACPI_PARSE_ENABLED"] = hv_cfg_lib.N_Y scenario_item_values["hv,FEATURES,L1D_VMENTRY_ENABLED"] = hv_cfg_lib.N_Y scenario_item_values["hv,FEATURES,MCE_ON_PSC_DISABLED"] = hv_cfg_lib.N_Y scenario_item_values["hv,FEATURES,IOMMU_ENFORCE_SNP"] = hv_cfg_lib.N_Y scenario_item_values["hv,FEATURES,IVSHMEM,IVSHMEM_ENABLED"] = hv_cfg_lib.N_Y scenario_item_values["hv,FEATURES,SSRAM,SSRAM_ENABLED"] = hv_cfg_lib.N_Y scenario_cfg_lib.ERR_LIST.update(hv_cfg_lib.ERR_LIST) return scenario_item_values
def validate_scenario_setting(board_info, scenario_info): """ This is validate the data setting from scenario xml :param board_info: it is a file what contains board information for script to read from :param scenario_info: it is a file what user have already setting to :return: return a dictionary contain errors """ scenario_cfg_lib.ERR_LIST = {} common.BOARD_INFO_FILE = board_info common.SCENARIO_INFO_FILE = scenario_info scenario_info_items = {} vm_info = VmInfo(board_info, scenario_info) vm_info.get_info() vm_info.check_item() hv_info = HvInfo(scenario_info) hv_info.get_info() hv_info.check_item() scenario_info_items['vm'] = vm_info scenario_info_items['hv'] = hv_info scenario_cfg_lib.ERR_LIST.update(hv_cfg_lib.ERR_LIST) return (scenario_cfg_lib.ERR_LIST, scenario_info_items)
def validate_scenario_setting(board_info, scenario_info): """ Validate settings in scenario xml :param board_info: board file :param scenario_info: scenario file :return: return a dictionary that contains errors """ hv_cfg_lib.ERR_LIST = {} scenario_cfg_lib.ERR_LIST = {} common.BOARD_INFO_FILE = board_info common.SCENARIO_INFO_FILE = scenario_info hv_info = HvInfo(scenario_info) hv_info.get_info() hv_info.check_item() scenario_info_items = {} vm_info = VmInfo(board_info, scenario_info) vm_info.get_info() vm_info.set_ivshmem(hv_info.mem.ivshmem_region) vm_info.check_item() scenario_info_items['vm'] = vm_info scenario_info_items['hv'] = hv_info scenario_cfg_lib.ERR_LIST.update(hv_cfg_lib.ERR_LIST) return (scenario_cfg_lib.ERR_LIST, scenario_info_items)
def get_scenario_item_values(board_info, scenario_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 """ scenario_item_values = {} hw_info = HwInfo(board_info) hv_info = HvInfo(scenario_info) # get vm count common.BOARD_INFO_FILE = board_info common.SCENARIO_INFO_FILE = scenario_info common.get_vm_num(scenario_info) common.get_vm_types() # pre scenario guest_flags = copy.deepcopy(common.GUEST_FLAG) guest_flags.remove('0UL') scenario_item_values['vm,vm_type'] = scenario_cfg_lib.LOAD_VM_TYPE scenario_item_values["vm,cpu_affinity"] = hw_info.get_processor_val() scenario_item_values["vm,guest_flags"] = guest_flags scenario_item_values["vm,clos"] = hw_info.get_clos_val() scenario_item_values["vm,pci_devs"] = scenario_cfg_lib.avl_pci_devs() scenario_item_values["vm,os_config,kern_type"] = scenario_cfg_lib.KERN_TYPE_LIST scenario_item_values.update(scenario_cfg_lib.avl_vuart_ui_select(scenario_info)) # pre board_private (scenario_item_values["vm,board_private,rootfs"], num) = board_cfg_lib.get_rootfs(board_info) scenario_item_values["hv,DEBUG_OPTIONS,RELEASE"] = hv_cfg_lib.N_Y scenario_item_values["hv,DEBUG_OPTIONS,NPK_LOGLEVEL"] = hv_cfg_lib.get_select_range("DEBUG_OPTIONS", "LOG_LEVEL") scenario_item_values["hv,DEBUG_OPTIONS,MEM_LOGLEVEL"] = hv_cfg_lib.get_select_range("DEBUG_OPTIONS", "LOG_LEVEL") scenario_item_values["hv,DEBUG_OPTIONS,CONSOLE_LOGLEVEL"] = hv_cfg_lib.get_select_range("DEBUG_OPTIONS", "LOG_LEVEL") scenario_item_values["hv,DEBUG_OPTIONS,SERIAL_CONSOLE"] = board_cfg_lib.get_native_ttys_info(board_info) scenario_item_values["hv,DEBUG_OPTIONS,LOG_DESTINATION"] = hv_cfg_lib.get_select_range("DEBUG_OPTIONS", "LOG_DESTINATION_BITMAP") scenario_item_values["hv,CAPACITIES,MAX_IOAPIC_NUM"] = hv_cfg_lib.get_select_range("CAPACITIES", "IOAPIC_NUM") scenario_item_values["hv,FEATURES,MULTIBOOT2"] = hv_cfg_lib.N_Y scenario_item_values["hv,FEATURES,SCHEDULER"] = hv_cfg_lib.SCHEDULER_TYPE scenario_item_values["hv,FEATURES,RELOC"] = hv_cfg_lib.N_Y scenario_item_values["hv,FEATURES,HYPERV_ENABLED"] = hv_cfg_lib.N_Y scenario_item_values["hv,FEATURES,ACPI_PARSE_ENABLED"] = hv_cfg_lib.N_Y scenario_item_values["hv,FEATURES,L1D_VMENTRY_ENABLED"] = hv_cfg_lib.N_Y scenario_item_values["hv,FEATURES,MCE_ON_PSC_DISABLED"] = hv_cfg_lib.N_Y scenario_item_values["hv,FEATURES,IOMMU_ENFORCE_SNP"] = hv_cfg_lib.N_Y scenario_cfg_lib.ERR_LIST.update(hv_cfg_lib.ERR_LIST) return scenario_item_values