diff --git a/misc/config_tools/scenario_config/config_summary.py b/misc/config_tools/scenario_config/config_summary.py index 1a36ba49a..689b98a60 100644 --- a/misc/config_tools/scenario_config/config_summary.py +++ b/misc/config_tools/scenario_config/config_summary.py @@ -91,13 +91,6 @@ class Doc: class GenerateRst: - io_port = {} - io_description = [] - pci_vuart = {} - pci_ivshmem = {} - amount_l3_cache = {} - service_vm_used_pcpu_list = [] - # Class initialization def __init__(self, board_file_name, scenario_file_name, rst_file_name) -> None: self.board_etree = parse(board_file_name) @@ -105,6 +98,14 @@ class GenerateRst: self.file = open(rst_file_name, 'w') self.doc = Doc(self.file) + # Initialize instance variables to avoid data persistence across instances + self.io_port = {} + self.io_description = [] + self.pci_vuart = {} + self.pci_ivshmem = {} + self.amount_l3_cache = {} + self.service_vm_used_pcpu_list = [] + # The rst content is written in three parts according to the first level title # 1. Hardware Resource Allocation 2. Inter-VM Connections 3. VM info def write_configuration_rst(self): @@ -448,7 +449,8 @@ class GenerateRst: # Close the Rst file after all information is written. def close_file(self): - self.file.close() + if self.file: + self.file.close() def main(board_xml, scenario_xml, config_summary):