Augment the LibvirtLiveMigrateData object

Adds the fields to the object so we can use them for passing the values
of the mediated devices betwen the target and the source.

Change-Id: I70d69c2b9c58f34db7e0d57c438db337d52a9a75
Partially-Implements: blueprint libvirt-mdev-live-migrate
This commit is contained in:
Sylvain Bauza
2023-12-19 19:03:23 +01:00
parent a72f7eaac7
commit fbdd68d4de
3 changed files with 25 additions and 3 deletions
+15 -1
View File
@@ -240,7 +240,9 @@ class LibvirtLiveMigrateData(LiveMigrateData):
# Version 1.9: Inherited vifs from LiveMigrateData
# Version 1.10: Added dst_numa_info, src_supports_numa_live_migration, and
# dst_supports_numa_live_migration fields
VERSION = '1.10'
# Version 1.11: Added dst_supports_mdev_live_migration,
# source_mdev_types and target_mdevs fields
VERSION = '1.11'
fields = {
'filename': fields.StringField(),
@@ -270,12 +272,24 @@ class LibvirtLiveMigrateData(LiveMigrateData):
'src_supports_numa_live_migration': fields.BooleanField(),
'dst_supports_numa_live_migration': fields.BooleanField(),
'dst_numa_info': fields.ObjectField('LibvirtLiveMigrateNUMAInfo'),
# TODO(sbauza) dst_supports_mdev_live_migration is only used as
# flag to indicate that the compute host is new enough to perform a
# mediated-device-aware live migration. Remove in version 2.0.
'dst_supports_mdev_live_migration': fields.BooleanField(),
# key is mdev UUID and value is its type.
'source_mdev_types': fields.DictOfStringsField(),
# key is source mdev UUID and value is the destination mdev UUID.
'target_mdevs': fields.DictOfStringsField(),
}
def obj_make_compatible(self, primitive, target_version):
super(LibvirtLiveMigrateData, self).obj_make_compatible(
primitive, target_version)
target_version = versionutils.convert_version_to_tuple(target_version)
if target_version < (1, 11):
primitive.pop('target_mdevs', None)
primitive.pop('source_mdev_types', None)
primitive.pop('dst_supports_mdev_live_migration', None)
if (target_version < (1, 10) and
'src_supports_numa_live_migration' in primitive):
del primitive['src_supports_numa_live_migration']
+9 -1
View File
@@ -96,7 +96,10 @@ class _TestLibvirtLiveMigrateData(object):
file_backed_memory_discard=False,
src_supports_numa_live_migration=True,
dst_supports_numa_live_migration=True,
dst_numa_info=migrate_data.LibvirtLiveMigrateNUMAInfo())
dst_numa_info=migrate_data.LibvirtLiveMigrateNUMAInfo(),
dst_supports_mdev_live_migration=True,
source_mdev_types={},
target_mdevs={})
manifest = ovo_base.obj_tree_get_versions(obj.obj_name())
data = lambda x: x['nova_object.data']
@@ -133,6 +136,11 @@ class _TestLibvirtLiveMigrateData(object):
self.assertNotIn('dst_numa_info', primitive)
self.assertNotIn('src_supports_numa_live_migration', primitive)
self.assertNotIn('dst_supports_numa_live_migration', primitive)
primitive = data(obj.obj_to_primitive(target_version='1.10',
version_manifest=manifest))
self.assertNotIn('dst_supports_mdev_live_migration', primitive)
self.assertNotIn('source_mdev_types', primitive)
self.assertNotIn('target_mdevs', primitive)
def test_bdm_obj_make_compatible(self):
obj = migrate_data.LibvirtLiveMigrateBDMInfo(
+1 -1
View File
@@ -1128,7 +1128,7 @@ object_data = {
'KeyPair': '1.4-1244e8d1b103cc69d038ed78ab3a8cc6',
'KeyPairList': '1.3-94aad3ac5c938eef4b5e83da0212f506',
'LibvirtLiveMigrateBDMInfo': '1.1-5f4a68873560b6f834b74e7861d71aaf',
'LibvirtLiveMigrateData': '1.10-348cf70ea44d3b985f45f64725d6f6a7',
'LibvirtLiveMigrateData': '1.11-c535fa68cab55cc451e49996f1380ccc',
'LibvirtLiveMigrateNUMAInfo': '1.0-0e777677f3459d0ed1634eabbdb6c22f',
'LibvirtVPMEMDevice': '1.0-17ffaf47585199eeb9a2b83d6bde069f',
'MemoryDiagnostics': '1.0-2c995ae0f2223bb0f8e523c5cc0b83da',