Skip to content

Commit

Permalink
migration: Fix analyze-migration read operation signedness
Browse files Browse the repository at this point in the history
The migration code uses unsigned values for 16, 32 and 64-bit
operations. Fix the script to do the same.

This was causing an issue when parsing the migration stream generated
on the ppc64 target because one of instance_ids was larger than the
32bit signed maximum:

Traceback (most recent call last):
  File "/home/fabiano/kvm/qemu/build/scripts/analyze-migration.py", line 658, in <module>
    dump.read(dump_memory = args.memory)
  File "/home/fabiano/kvm/qemu/build/scripts/analyze-migration.py", line 592, in read
    classdesc = self.section_classes[section_key]
KeyError: ('spapr_iommu', -2147483648)

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231009184326.15777-6-farosas@suse.de>
(cherry picked from commit caea032)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
Fabiano Rosas authored and Michael Tokarev committed Oct 19, 2023
1 parent af566cc commit 9285589
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/analyze-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ def __init__(self, filename):
self.file = open(self.filename, "rb")

def read64(self):
return int.from_bytes(self.file.read(8), byteorder='big', signed=True)
return int.from_bytes(self.file.read(8), byteorder='big', signed=False)

def read32(self):
return int.from_bytes(self.file.read(4), byteorder='big', signed=True)
return int.from_bytes(self.file.read(4), byteorder='big', signed=False)

def read16(self):
return int.from_bytes(self.file.read(2), byteorder='big', signed=True)
return int.from_bytes(self.file.read(2), byteorder='big', signed=False)

def read8(self):
return int.from_bytes(self.file.read(1), byteorder='big', signed=True)
Expand Down

0 comments on commit 9285589

Please sign in to comment.