mirror of https://github.com/xemu-project/xemu.git
migration: Fix parsing of s390 stream
The parsing for the S390StorageAttributes section is currently leaving
an unconsumed token that is later interpreted by the generic code as
QEMU_VM_EOF, cutting the parsing short.
The migration will issue a STATTR_FLAG_DONE between iterations, which
the script consumes correctly, but there's a final STATTR_FLAG_EOS at
.save_complete that the script is ignoring. Since the EOS flag is a
u64 0x1ULL and the stream is big endian, on little endian hosts a byte
read from it will be 0x0, the same as QEMU_VM_EOF.
Fixes: 81c2c9dd5d
("tests/qtest/migration-test: Fix analyze-migration.py for s390x")
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20250109185249.23952-4-farosas@suse.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit 69d1f784569fdb950f2923c3b6d00d7c1b71acc1)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
abb738ad33
commit
e3839b0c19
|
@ -65,6 +65,9 @@ class MigrationFile(object):
|
||||||
def tell(self):
|
def tell(self):
|
||||||
return self.file.tell()
|
return self.file.tell()
|
||||||
|
|
||||||
|
def seek(self, a, b):
|
||||||
|
return self.file.seek(a, b)
|
||||||
|
|
||||||
# The VMSD description is at the end of the file, after EOF. Look for
|
# The VMSD description is at the end of the file, after EOF. Look for
|
||||||
# the last NULL byte, then for the beginning brace of JSON.
|
# the last NULL byte, then for the beginning brace of JSON.
|
||||||
def read_migration_debug_json(self):
|
def read_migration_debug_json(self):
|
||||||
|
@ -272,11 +275,24 @@ class S390StorageAttributes(object):
|
||||||
self.section_key = section_key
|
self.section_key = section_key
|
||||||
|
|
||||||
def read(self):
|
def read(self):
|
||||||
|
pos = 0
|
||||||
while True:
|
while True:
|
||||||
addr_flags = self.file.read64()
|
addr_flags = self.file.read64()
|
||||||
flags = addr_flags & 0xfff
|
flags = addr_flags & 0xfff
|
||||||
if (flags & (self.STATTR_FLAG_DONE | self.STATTR_FLAG_EOS)):
|
|
||||||
|
if flags & self.STATTR_FLAG_DONE:
|
||||||
|
pos = self.file.tell()
|
||||||
|
continue
|
||||||
|
elif flags & self.STATTR_FLAG_EOS:
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
# No EOS came after DONE, that's OK, but rewind the
|
||||||
|
# stream because this is not our data.
|
||||||
|
if pos:
|
||||||
|
self.file.seek(pos, os.SEEK_SET)
|
||||||
|
return
|
||||||
|
raise Exception("Unknown flags %x", flags)
|
||||||
|
|
||||||
if (flags & self.STATTR_FLAG_ERROR):
|
if (flags & self.STATTR_FLAG_ERROR):
|
||||||
raise Exception("Error in migration stream")
|
raise Exception("Error in migration stream")
|
||||||
count = self.file.read64()
|
count = self.file.read64()
|
||||||
|
|
Loading…
Reference in New Issue