From f98d372aeff5109d2b5a3b858a51347e0ccd36b1 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Fri, 15 Oct 2021 15:16:44 +0200 Subject: analyze-migration.py: fix a long standing typo 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 Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20211015131645.501281-2-lvivier@redhat.com> Signed-off-by: Laurent Vivier --- scripts/analyze-migration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/analyze-migration.py') diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py index d7177b212c..9d239d309f 100755 --- a/scripts/analyze-migration.py +++ b/scripts/analyze-migration.py @@ -610,4 +610,4 @@ elif args.dump == "desc": 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") -- cgit v1.2.3-55-g7522 From 2c92be50bcfa8b7529a39fc99078ef14dcfc71aa Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Fri, 15 Oct 2021 15:16:45 +0200 Subject: analyze-migration.py: fix extract contents ('-x') errors 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 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 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 Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20211015131645.501281-3-lvivier@redhat.com> Signed-off-by: Laurent Vivier --- scripts/analyze-migration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/analyze-migration.py') diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py index 9d239d309f..b82a1b0c58 100755 --- a/scripts/analyze-migration.py +++ b/scripts/analyze-migration.py @@ -588,7 +588,7 @@ if args.extract: 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 @@ if args.extract: 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() -- cgit v1.2.3-55-g7522