migration: fix analyze-migration.py script
Commit 61964 "Add configuration section" broke the analyze-migration.py script which terminates due to the unrecognised section. Fix the script by parsing the contents of the configuration section directly into a new ConfigurationSection object (although nothing is done with it yet). Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Juan Quintela <quintela@redhat.com>al3 Signed-off-by: Juan Quintela <quintela@redhat.com>al3
This commit is contained in:
		
							parent
							
								
									6ad2a215e7
								
							
						
					
					
						commit
						96e5c9bc77
					
				| 
						 | 
					@ -252,6 +252,15 @@ class HTABSection(object):
 | 
				
			||||||
    def getDict(self):
 | 
					    def getDict(self):
 | 
				
			||||||
        return ""
 | 
					        return ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ConfigurationSection(object):
 | 
				
			||||||
 | 
					    def __init__(self, file):
 | 
				
			||||||
 | 
					        self.file = file
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def read(self):
 | 
				
			||||||
 | 
					        name_len = self.file.read32()
 | 
				
			||||||
 | 
					        name = self.file.readstr(len = name_len)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class VMSDFieldGeneric(object):
 | 
					class VMSDFieldGeneric(object):
 | 
				
			||||||
    def __init__(self, desc, file):
 | 
					    def __init__(self, desc, file):
 | 
				
			||||||
        self.file = file
 | 
					        self.file = file
 | 
				
			||||||
| 
						 | 
					@ -474,6 +483,7 @@ class MigrationDump(object):
 | 
				
			||||||
    QEMU_VM_SECTION_FULL  = 0x04
 | 
					    QEMU_VM_SECTION_FULL  = 0x04
 | 
				
			||||||
    QEMU_VM_SUBSECTION    = 0x05
 | 
					    QEMU_VM_SUBSECTION    = 0x05
 | 
				
			||||||
    QEMU_VM_VMDESCRIPTION = 0x06
 | 
					    QEMU_VM_VMDESCRIPTION = 0x06
 | 
				
			||||||
 | 
					    QEMU_VM_CONFIGURATION = 0x07
 | 
				
			||||||
    QEMU_VM_SECTION_FOOTER= 0x7e
 | 
					    QEMU_VM_SECTION_FOOTER= 0x7e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __init__(self, filename):
 | 
					    def __init__(self, filename):
 | 
				
			||||||
| 
						 | 
					@ -514,6 +524,9 @@ class MigrationDump(object):
 | 
				
			||||||
            section_type = file.read8()
 | 
					            section_type = file.read8()
 | 
				
			||||||
            if section_type == self.QEMU_VM_EOF:
 | 
					            if section_type == self.QEMU_VM_EOF:
 | 
				
			||||||
                break
 | 
					                break
 | 
				
			||||||
 | 
					            elif section_type == self.QEMU_VM_CONFIGURATION:
 | 
				
			||||||
 | 
					                section = ConfigurationSection(file)
 | 
				
			||||||
 | 
					                section.read()
 | 
				
			||||||
            elif section_type == self.QEMU_VM_SECTION_START or section_type == self.QEMU_VM_SECTION_FULL:
 | 
					            elif section_type == self.QEMU_VM_SECTION_START or section_type == self.QEMU_VM_SECTION_FULL:
 | 
				
			||||||
                section_id = file.read32()
 | 
					                section_id = file.read32()
 | 
				
			||||||
                name = file.readstr()
 | 
					                name = file.readstr()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue