misc: fail to save config_summary.rst while changing board.xml

This patch is to fix the bug which will report while changing board.xml.

The issue was that all data structures were class variables,
Data will be accumulated when calling
main(board_xml, scenario_xml, config_summary).

This patch moved all shared data to instance variables in __init__().
self.io_port = {}
self.io_description = []
self.pci_vuart = {}
self.pci_ivshmem = {}
self.amount_l3_cache = {}
self.service_vm_used_pcpu_list = []

Tracked-On: #8718
Signed-off-by: dongpingx <dongpingx.wu@intel.com>
Signed-off-by: Zhangwei6 <wei6.zhang@intel.com>
This commit is contained in:
dongpingx
2024-08-30 14:21:34 +08:00
committed by Sun, Victor
parent 6f96614e6f
commit e87ec5ac82

View File

@@ -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):