Teach analyze-migration.py about section footers

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
Dr. David Alan Gilbert 2015-05-19 12:29:53 +01:00 committed by Juan Quintela
parent f68945d42b
commit 73d9a7961a

View File

@ -474,6 +474,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_SECTION_FOOTER= 0x7e
def __init__(self, filename): def __init__(self, filename):
self.section_classes = { ( 'ram', 0 ) : [ RamSection, None ], self.section_classes = { ( 'ram', 0 ) : [ RamSection, None ],
@ -526,6 +527,10 @@ class MigrationDump(object):
elif section_type == self.QEMU_VM_SECTION_PART or section_type == self.QEMU_VM_SECTION_END: elif section_type == self.QEMU_VM_SECTION_PART or section_type == self.QEMU_VM_SECTION_END:
section_id = file.read32() section_id = file.read32()
self.sections[section_id].read() self.sections[section_id].read()
elif section_type == self.QEMU_VM_SECTION_FOOTER:
read_section_id = file.read32()
if read_section_id != section_id:
raise Exception("Mismatched section footer: %x vs %x" % (read_section_id, section_id))
else: else:
raise Exception("Unknown section type: %d" % section_type) raise Exception("Unknown section type: %d" % section_type)
file.close() file.close()