Teach analyze-migration.py about section footers
authorDr. David Alan Gilbert <dgilbert@redhat.com>
Tue, 19 May 2015 11:29:53 +0000 (12:29 +0100)
committerJuan Quintela <quintela@redhat.com>
Fri, 12 Jun 2015 04:54:01 +0000 (06:54 +0200)
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
scripts/analyze-migration.py

index 0c8b22f2aa9ec5240fe7735c37f955df8613e85d..f6894bece9c965d0ed2d5b0d9420c85982da39a0 100755 (executable)
@@ -474,6 +474,7 @@ class MigrationDump(object):
     QEMU_VM_SECTION_FULL  = 0x04
     QEMU_VM_SUBSECTION    = 0x05
     QEMU_VM_VMDESCRIPTION = 0x06
+    QEMU_VM_SECTION_FOOTER= 0x7e
 
     def __init__(self, filename):
         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:
                 section_id = file.read32()
                 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:
                 raise Exception("Unknown section type: %d" % section_type)
         file.close()