[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/38] migration: Add capability parsing to analyze-migration.py
From: |
Juan Quintela |
Subject: |
[PULL 07/38] migration: Add capability parsing to analyze-migration.py |
Date: |
Mon, 16 Oct 2023 12:06:35 +0200 |
From: Fabiano Rosas <farosas@suse.de>
The script is broken when the configuration/capabilities section is
present. Add support for parsing the capabilities so we can fix it in
the next patch.
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231009184326.15777-4-farosas@suse.de>
---
scripts/analyze-migration.py | 38 ++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
index 24687db497..c700fed64d 100755
--- a/scripts/analyze-migration.py
+++ b/scripts/analyze-migration.py
@@ -264,6 +264,24 @@ class ConfigurationSection(object):
def __init__(self, file, desc):
self.file = file
self.desc = desc
+ self.caps = []
+
+ def parse_capabilities(self, vmsd_caps):
+ if not vmsd_caps:
+ return
+
+ ncaps = vmsd_caps.data['caps_count'].data
+ self.caps = vmsd_caps.data['capabilities']
+
+ if type(self.caps) != list:
+ self.caps = [self.caps]
+
+ if len(self.caps) != ncaps:
+ raise Exception("Number of capabilities doesn't match "
+ "caps_count field")
+
+ def has_capability(self, cap):
+ return any([str(c) == cap for c in self.caps])
def read(self):
if self.desc:
@@ -271,6 +289,8 @@ def read(self):
section = VMSDSection(self.file, version_id, self.desc,
'configuration')
section.read()
+ self.parse_capabilities(
+ section.data.get("configuration/capabilities"))
else:
# backward compatibility for older streams that don't have
# the configuration section in the json
@@ -297,6 +317,23 @@ def read(self):
self.data = self.file.readvar(size)
return self.data
+class VMSDFieldCap(object):
+ def __init__(self, desc, file):
+ self.file = file
+ self.desc = desc
+ self.data = ""
+
+ def __repr__(self):
+ return self.data
+
+ def __str__(self):
+ return self.data
+
+ def read(self):
+ len = self.file.read8()
+ self.data = self.file.readstr(len)
+
+
class VMSDFieldInt(VMSDFieldGeneric):
def __init__(self, desc, file):
super(VMSDFieldInt, self).__init__(desc, file)
@@ -471,6 +508,7 @@ def getDict(self):
"unused_buffer" : VMSDFieldGeneric,
"bitmap" : VMSDFieldGeneric,
"struct" : VMSDFieldStruct,
+ "capability": VMSDFieldCap,
"unknown" : VMSDFieldGeneric,
}
--
2.41.0
- [PULL 00/38] Migration 20231016 patches, Juan Quintela, 2023/10/16
- [PULL 01/38] migration: refactor migration_completion, Juan Quintela, 2023/10/16
- [PULL 02/38] migration: Use g_autofree to simplify ram_dirty_bitmap_reload(), Juan Quintela, 2023/10/16
- [PULL 04/38] migration: fix RAMBlock add NULL check, Juan Quintela, 2023/10/16
- [PULL 03/38] migration: Allow user to specify available switchover bandwidth, Juan Quintela, 2023/10/16
- [PULL 06/38] migration: Fix analyze-migration.py 'configuration' parsing, Juan Quintela, 2023/10/16
- [PULL 07/38] migration: Add capability parsing to analyze-migration.py,
Juan Quintela <=
- [PULL 05/38] migration: Add the configuration vmstate to the json writer, Juan Quintela, 2023/10/16
- [PULL 09/38] migration: Fix analyze-migration read operation signedness, Juan Quintela, 2023/10/16
- [PULL 12/38] migration: hold the BQL during setup, Juan Quintela, 2023/10/16
- [PULL 08/38] migration: Fix analyze-migration.py when ignore-shared is used, Juan Quintela, 2023/10/16
- [PULL 10/38] tests/qtest/migration: Add a test for the analyze-migration script, Juan Quintela, 2023/10/16
- [PULL 14/38] migration: Create migrate_rdma(), Juan Quintela, 2023/10/16
- [PULL 13/38] migration: Non multifd migration don't care about multifd flushes, Juan Quintela, 2023/10/16
- [PULL 15/38] migration/rdma: Unfold ram_control_before_iterate(), Juan Quintela, 2023/10/16
- [PULL 16/38] migration/rdma: Unfold ram_control_after_iterate(), Juan Quintela, 2023/10/16
- [PULL 11/38] tests/qtest: migration-test: Add tests for file-based migration, Juan Quintela, 2023/10/16