[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 07/17] migration: analyze-migration script changed
From: |
nikita . lapshin |
Subject: |
[PATCH v3 07/17] migration: analyze-migration script changed |
Date: |
Thu, 16 Jun 2022 13:28:01 +0300 |
From: Nikita Lapshin <nikita.lapshin@openvz.org>
This script is used for RAM capabilities test. But it cannot work
in case of no vm description in migration stream.
So new flag is added to allow work this script with ram-only
migration stream.
Signed-off-by: Nikita Lapshin <nikita.lapshin@openvz.org>
---
scripts/analyze-migration.py | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
index b82a1b0c58..80077a09bc 100755
--- a/scripts/analyze-migration.py
+++ b/scripts/analyze-migration.py
@@ -495,7 +495,7 @@ def __init__(self, filename):
self.filename = filename
self.vmsd_desc = None
- def read(self, desc_only = False, dump_memory = False, write_memory =
False):
+ def read(self, ram_only, desc_only = False, dump_memory = False,
write_memory = False):
# Read in the whole file
file = MigrationFile(self.filename)
@@ -509,7 +509,8 @@ def read(self, desc_only = False, dump_memory = False,
write_memory = False):
if data != self.QEMU_VM_FILE_VERSION:
raise Exception("Invalid version number %d" % data)
- self.load_vmsd_json(file)
+ if not ram_only:
+ self.load_vmsd_json(file)
# Read sections
self.sections = collections.OrderedDict()
@@ -518,7 +519,10 @@ def read(self, desc_only = False, dump_memory = False,
write_memory = False):
return
ramargs = {}
- ramargs['page_size'] = self.vmsd_desc['page_size']
+ if ram_only:
+ ramargs['page_size'] = 4096
+ else:
+ ramargs['page_size'] = self.vmsd_desc['page_size']
ramargs['dump_memory'] = dump_memory
ramargs['write_memory'] = write_memory
self.section_classes[('ram',0)][1] = ramargs
@@ -579,6 +583,7 @@ def default(self, o):
parser.add_argument("-m", "--memory", help='dump RAM contents as well',
action='store_true')
parser.add_argument("-d", "--dump", help='what to dump ("state" or "desc")',
default='state')
parser.add_argument("-x", "--extract", help='extract contents into individual
files', action='store_true')
+parser.add_argument("--ram-only", help='parse migration dump containing only
RAM', action='store_true')
args = parser.parse_args()
jsonenc = JSONEncoder(indent=4, separators=(',', ': '))
@@ -586,14 +591,14 @@ def default(self, o):
if args.extract:
dump = MigrationDump(args.file)
- dump.read(desc_only = True)
+ dump.read(desc_only = True, ram_only = args.ram_only)
print("desc.json")
f = open("desc.json", "w")
f.truncate()
f.write(jsonenc.encode(dump.vmsd_desc))
f.close()
- dump.read(write_memory = True)
+ dump.read(write_memory = True, ram_only = args.ram_only)
dict = dump.getDict()
print("state.json")
f = open("state.json", "w")
@@ -602,12 +607,12 @@ def default(self, o):
f.close()
elif args.dump == "state":
dump = MigrationDump(args.file)
- dump.read(dump_memory = args.memory)
+ dump.read(dump_memory = args.memory, ram_only = args.ram_only)
dict = dump.getDict()
print(jsonenc.encode(dict))
elif args.dump == "desc":
dump = MigrationDump(args.file)
- dump.read(desc_only = True)
+ dump.read(desc_only = True, ram_only = args.ram_only)
print(jsonenc.encode(dump.vmsd_desc))
else:
raise Exception("Please specify either -x, -d state or -d desc")
--
2.31.1
- [PATCH v3 00/17] migration/snapshot: External snapshot utility, nikita . lapshin, 2022/06/16
- [PATCH v3 01/17] migration: Implemented new parameter stream_content, nikita . lapshin, 2022/06/16
- [PATCH v3 02/17] migration: should_skip() implemented, nikita . lapshin, 2022/06/16
- [PATCH v3 03/17] migration: Add vmstate part of migration stream, nikita . lapshin, 2022/06/16
- [PATCH v3 05/17] migration: Add block part of migration stream, nikita . lapshin, 2022/06/16
- [PATCH v3 06/17] migration: Add RAM part of migration stream, nikita . lapshin, 2022/06/16
- [PATCH v3 07/17] migration: analyze-migration script changed,
nikita . lapshin <=
- [PATCH v3 08/17] migration: Test for RAM and vmstate parts, nikita . lapshin, 2022/06/16
- [PATCH v3 11/17] migration/qemu-file: Fix qemu_ftell() for non-writable file, nikita . lapshin, 2022/06/16
- [PATCH v3 13/17] migration/snapshot: Block layer support in qemu-snapshot, nikita . lapshin, 2022/06/16
- [PATCH v3 14/17] migration/snpashot: Implement API for RAMBlock, nikita . lapshin, 2022/06/16
- [PATCH v3 04/17] migration: Add dirty-bitmaps part of migration stream, nikita . lapshin, 2022/06/16
- [PATCH v3 09/17] migration/snapshot: Introduce qemu-snapshot tool, nikita . lapshin, 2022/06/16
- [PATCH v3 10/17] migration/snapshot: Build changes for qemu-snapshot-tool, nikita . lapshin, 2022/06/16
- [PATCH v3 12/17] migration/snapshot: Move RAM_SAVE_FLAG_xxx defines to migration/ram.h, nikita . lapshin, 2022/06/16