* [PATCH 0/2] analyze-migration.py: trivial fixes @ 2021-10-15 13:16 Laurent Vivier 2021-10-15 13:16 ` [PATCH 1/2] analyze-migration.py: fix a long standing typo Laurent Vivier ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Laurent Vivier @ 2021-10-15 13:16 UTC (permalink / raw) To: qemu-devel Cc: Laurent Vivier, Eduardo Habkost, qemu-trivial, Michael Tokarev, Laurent Vivier, Cleber Rosa This script is not used a lot but it helps to debug migration, so it's annoying when we need it and it doesn't work... The first patch fix an error message that is erroneous and thus doesn't help at all. The second fixes a problem introduced by python3 and preventing to run the extract mode. Laurent Vivier (2): analyze-migration.py: fix a long standing typo analyze-migration.py: fix extract contents ('-x') errors scripts/analyze-migration.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.31.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] analyze-migration.py: fix a long standing typo 2021-10-15 13:16 [PATCH 0/2] analyze-migration.py: trivial fixes Laurent Vivier @ 2021-10-15 13:16 ` Laurent Vivier 2021-10-15 13:24 ` Philippe Mathieu-Daudé 2021-10-15 13:16 ` [PATCH 2/2] analyze-migration.py: fix extract contents ('-x') errors Laurent Vivier 2021-10-19 7:56 ` [PATCH 0/2] analyze-migration.py: trivial fixes Laurent Vivier 2 siblings, 1 reply; 6+ messages in thread From: Laurent Vivier @ 2021-10-15 13:16 UTC (permalink / raw) To: qemu-devel Cc: Laurent Vivier, Eduardo Habkost, qemu-trivial, Michael Tokarev, Laurent Vivier, Cleber Rosa The parameters of '-d' can be either 'state' or 'desc', not 'dump' as it is reported in the error message. Fixes: b17425701d66 ("Add migration stream analyzation script") Signed-off-by: Laurent Vivier <lvivier@redhat.com> --- scripts/analyze-migration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py index d7177b212c86..9d239d309f33 100755 --- a/scripts/analyze-migration.py +++ b/scripts/analyze-migration.py @@ -610,4 +610,4 @@ def default(self, o): dump.read(desc_only = True) print(jsonenc.encode(dump.vmsd_desc)) else: - raise Exception("Please specify either -x, -d state or -d dump") + raise Exception("Please specify either -x, -d state or -d desc") -- 2.31.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] analyze-migration.py: fix a long standing typo 2021-10-15 13:16 ` [PATCH 1/2] analyze-migration.py: fix a long standing typo Laurent Vivier @ 2021-10-15 13:24 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 6+ messages in thread From: Philippe Mathieu-Daudé @ 2021-10-15 13:24 UTC (permalink / raw) To: Laurent Vivier, qemu-devel Cc: qemu-trivial, Cleber Rosa, Michael Tokarev, Eduardo Habkost, Laurent Vivier On 10/15/21 15:16, Laurent Vivier wrote: > The parameters of '-d' can be either 'state' or 'desc', not 'dump' > as it is reported in the error message. > > Fixes: b17425701d66 ("Add migration stream analyzation script") > Signed-off-by: Laurent Vivier <lvivier@redhat.com> > --- > scripts/analyze-migration.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] analyze-migration.py: fix extract contents ('-x') errors 2021-10-15 13:16 [PATCH 0/2] analyze-migration.py: trivial fixes Laurent Vivier 2021-10-15 13:16 ` [PATCH 1/2] analyze-migration.py: fix a long standing typo Laurent Vivier @ 2021-10-15 13:16 ` Laurent Vivier 2021-10-15 14:21 ` Philippe Mathieu-Daudé 2021-10-19 7:56 ` [PATCH 0/2] analyze-migration.py: trivial fixes Laurent Vivier 2 siblings, 1 reply; 6+ messages in thread From: Laurent Vivier @ 2021-10-15 13:16 UTC (permalink / raw) To: qemu-devel Cc: Laurent Vivier, Eduardo Habkost, qemu-trivial, Michael Tokarev, Laurent Vivier, Cleber Rosa When we try to use 'analyze-migration.py -x' with python3, we have the following errors: Traceback (most recent call last): File "scripts/analyze-migration.py", line 593, in <module> f.write(jsonenc.encode(dump.vmsd_desc)) TypeError: a bytes-like object is required, not 'str' Traceback (most recent call last): File "scripts/analyze-migration.py", line 601, in <module> f.write(jsonenc.encode(dict)) TypeError: a bytes-like object is required, not 'str' This happens because the file 'f' is open in binary mode while jsonenc.encode() returns a string. The results are human-readable files, 'desc.json' and 'state.json', so there is no reason to use the binary mode. Signed-off-by: Laurent Vivier <lvivier@redhat.com> --- scripts/analyze-migration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py index 9d239d309f33..b82a1b0c58c4 100755 --- a/scripts/analyze-migration.py +++ b/scripts/analyze-migration.py @@ -588,7 +588,7 @@ def default(self, o): dump.read(desc_only = True) print("desc.json") - f = open("desc.json", "wb") + f = open("desc.json", "w") f.truncate() f.write(jsonenc.encode(dump.vmsd_desc)) f.close() @@ -596,7 +596,7 @@ def default(self, o): dump.read(write_memory = True) dict = dump.getDict() print("state.json") - f = open("state.json", "wb") + f = open("state.json", "w") f.truncate() f.write(jsonenc.encode(dict)) f.close() -- 2.31.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] analyze-migration.py: fix extract contents ('-x') errors 2021-10-15 13:16 ` [PATCH 2/2] analyze-migration.py: fix extract contents ('-x') errors Laurent Vivier @ 2021-10-15 14:21 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 6+ messages in thread From: Philippe Mathieu-Daudé @ 2021-10-15 14:21 UTC (permalink / raw) To: Laurent Vivier, qemu-devel Cc: qemu-trivial, Cleber Rosa, Michael Tokarev, Eduardo Habkost, Laurent Vivier On 10/15/21 15:16, Laurent Vivier wrote: > When we try to use 'analyze-migration.py -x' with python3, > we have the following errors: > > Traceback (most recent call last): > File "scripts/analyze-migration.py", line 593, in <module> > f.write(jsonenc.encode(dump.vmsd_desc)) > TypeError: a bytes-like object is required, not 'str' > > Traceback (most recent call last): > File "scripts/analyze-migration.py", line 601, in <module> > f.write(jsonenc.encode(dict)) > TypeError: a bytes-like object is required, not 'str' > > This happens because the file 'f' is open in binary mode while > jsonenc.encode() returns a string. > > The results are human-readable files, 'desc.json' and 'state.json', > so there is no reason to use the binary mode. > > Signed-off-by: Laurent Vivier <lvivier@redhat.com> > --- > scripts/analyze-migration.py | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] analyze-migration.py: trivial fixes 2021-10-15 13:16 [PATCH 0/2] analyze-migration.py: trivial fixes Laurent Vivier 2021-10-15 13:16 ` [PATCH 1/2] analyze-migration.py: fix a long standing typo Laurent Vivier 2021-10-15 13:16 ` [PATCH 2/2] analyze-migration.py: fix extract contents ('-x') errors Laurent Vivier @ 2021-10-19 7:56 ` Laurent Vivier 2 siblings, 0 replies; 6+ messages in thread From: Laurent Vivier @ 2021-10-19 7:56 UTC (permalink / raw) To: Laurent Vivier, qemu-devel Cc: qemu-trivial, Michael Tokarev, Eduardo Habkost, Cleber Rosa Le 15/10/2021 à 15:16, Laurent Vivier a écrit : > This script is not used a lot but it helps to debug migration, > so it's annoying when we need it and it doesn't work... > > The first patch fix an error message that is erroneous and thus > doesn't help at all. > > The second fixes a problem introduced by python3 and preventing > to run the extract mode. > > Laurent Vivier (2): > analyze-migration.py: fix a long standing typo > analyze-migration.py: fix extract contents ('-x') errors > > scripts/analyze-migration.py | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > Applied to my trivial-patches branch. Thanks, Laurent ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-10-19 7:59 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-10-15 13:16 [PATCH 0/2] analyze-migration.py: trivial fixes Laurent Vivier 2021-10-15 13:16 ` [PATCH 1/2] analyze-migration.py: fix a long standing typo Laurent Vivier 2021-10-15 13:24 ` Philippe Mathieu-Daudé 2021-10-15 13:16 ` [PATCH 2/2] analyze-migration.py: fix extract contents ('-x') errors Laurent Vivier 2021-10-15 14:21 ` Philippe Mathieu-Daudé 2021-10-19 7:56 ` [PATCH 0/2] analyze-migration.py: trivial fixes Laurent Vivier
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).