From: Nikita Lapshin<nikita.laps...@virtuozzo.com>
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.laps...@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)