1# The backing store supporting the memories in the system has changed 2# in that it is now stored globally per address range. As a result the 3# actual storage is separate from the memory controllers themselves. 4def upgrader(cpt): 5 for sec in cpt.sections(): 6 import re 7 # Search for a physical memory 8 if re.search('.*sys.*\.physmem$', sec): 9 # Add the number of stores attribute to the global physmem 10 cpt.set(sec, 'nbr_of_stores', '1') 11 12 # Get the filename and size as this is moving to the 13 # specific backing store 14 mem_filename = cpt.get(sec, 'filename') 15 mem_size = cpt.get(sec, '_size') 16 cpt.remove_option(sec, 'filename') 17 cpt.remove_option(sec, '_size') 18 19 # Get the name so that we can create the new section 20 system_name = str(sec).split('.')[0] 21 section_name = system_name + '.physmem.store0' 22 cpt.add_section(section_name) 23 cpt.set(section_name, 'store_id', '0') 24 cpt.set(section_name, 'range_size', mem_size) 25 cpt.set(section_name, 'filename', mem_filename) 26 elif re.search('.*sys.*\.\w*mem$', sec): 27 # Due to the lack of information about a start address, 28 # this migration only works if there is a single memory in 29 # the system, thus starting at 0 30 raise ValueError("more than one memory detected (" + sec + ")") 31 32legacy_version = 2 33