qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] migration: Make analyze-migration script target


From: Peter Xu
Subject: Re: [Qemu-devel] [PATCH] migration: Make analyze-migration script target-page-size aware
Date: Tue, 18 Jul 2017 20:02:50 +0800
User-agent: Mutt/1.5.24 (2015-08-30)

On Fri, Jul 07, 2017 at 02:14:43PM +0200, Alexander Graf wrote:
> The configuration section has a new subsection to transmit the target page
> size along with the migration stream. The analyze migration script needs
> to learn about that to read configuration streams that were triggering
> this subsection to get transmitted.
> 
> With this patch applied, I can successfully analyze migration streams
> on AArch64 again.
> 
> Signed-off-by: Alexander Graf <address@hidden>
> ---
>  scripts/analyze-migration.py | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
> index 1455387..02784f2 100755
> --- a/scripts/analyze-migration.py
> +++ b/scripts/analyze-migration.py
> @@ -254,12 +254,25 @@ class HTABSection(object):
>  
>  
>  class ConfigurationSection(object):
> +    QEMU_VM_SUBSECTION    = 0x05
> +
>      def __init__(self, file):
>          self.file = file
>  
>      def read(self):
>          name_len = self.file.read32()
>          name = self.file.readstr(len = name_len)
> +        oldpos = self.file.tell()
> +        if self.file.read8() == self.QEMU_VM_SUBSECTION:

Here name_len missing?

               name_len = self.file.read8()

(though all of them are going to be threw away...)

> +            name = self.file.readstr()
> +            version_id = self.file.read32()
> +            if name == "configuration/target-page-bits":
> +                target_page_size = self.file.read32()
> +            else:
> +                raise Exception("Unknown config subsection: %s" % name)
> +        else:
> +            # No subsection following, forget that we ever read anything
> +            self.file.seek(oldpos)

I guess we need self.file.file.seek(oldpos) here? Since otherwise on
x86 we'll get:

Traceback (most recent call last):
  File "./analyze-migration.py", line 615, in <module>
    dump.read(dump_memory = args.memory)
  File "./analyze-migration.py", line 542, in read
    section.read()
  File "./analyze-migration.py", line 275, in read
    self.file.seek(oldpos)
AttributeError: 'MigrationFile' object has no attribute 'seek'

Thanks,

-- 
Peter Xu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]