Augment the LiveMigrateData object
Adds the field ``pci_dev_map_src_dst`` to ``LiveMigrateData`` object to include the PCI device mapping between the source and destination device addresses. The target goal of these series of patch is to enable VFIO devices migration with kernel variant drivers. Partially-Implements: blueprint migrate-vfio-devices-using-kernel-variant-drivers Depends-On: https://review.opendev.org/c/openstack/nova/+/938405 Change-Id: I1c8e5709640abedb332d96c2c1f5268fa239d9a1
This commit is contained in:
@@ -153,7 +153,8 @@ class LiveMigrateData(obj_base.NovaObject):
|
||||
# Version 1.1: Added old_vol_attachment_ids field.
|
||||
# Version 1.2: Added wait_for_vif_plugged
|
||||
# Version 1.3: Added vifs field.
|
||||
VERSION = '1.3'
|
||||
# Version 1.4: Added pci_dev_map_src_dst field.
|
||||
VERSION = '1.4'
|
||||
|
||||
fields = {
|
||||
'is_volume_backed': fields.BooleanField(),
|
||||
@@ -170,6 +171,7 @@ class LiveMigrateData(obj_base.NovaObject):
|
||||
# default for the config option may change in the future
|
||||
'wait_for_vif_plugged': fields.BooleanField(),
|
||||
'vifs': fields.ListOfObjectsField('VIFMigrateData'),
|
||||
'pci_dev_map_src_dst': fields.DictOfStringsField(),
|
||||
}
|
||||
|
||||
|
||||
@@ -243,7 +245,8 @@ class LibvirtLiveMigrateData(LiveMigrateData):
|
||||
# Version 1.11: Added dst_supports_mdev_live_migration,
|
||||
# source_mdev_types and target_mdevs fields
|
||||
# Version 1.12: Added dst_cpu_shared_set_info
|
||||
VERSION = '1.12'
|
||||
# Version 1.13: Inherited pci_dev_map_src_dst from LiveMigrateData
|
||||
VERSION = '1.13'
|
||||
|
||||
fields = {
|
||||
'filename': fields.StringField(),
|
||||
@@ -288,6 +291,8 @@ class LibvirtLiveMigrateData(LiveMigrateData):
|
||||
super(LibvirtLiveMigrateData, self).obj_make_compatible(
|
||||
primitive, target_version)
|
||||
target_version = versionutils.convert_version_to_tuple(target_version)
|
||||
if (target_version < (1, 13)):
|
||||
primitive.pop('pci_dev_map_src_dst', None)
|
||||
if (target_version < (1, 12)):
|
||||
primitive.pop('dst_cpu_shared_set_info', None)
|
||||
if target_version < (1, 11):
|
||||
@@ -341,7 +346,8 @@ class HyperVLiveMigrateData(LiveMigrateData):
|
||||
# Version 1.2: Added old_vol_attachment_ids
|
||||
# Version 1.3: Added wait_for_vif_plugged
|
||||
# Version 1.4: Inherited vifs from LiveMigrateData
|
||||
VERSION = '1.4'
|
||||
# Version 1.5: Inherited pci_dev_map_src_dst from LiveMigrateData
|
||||
VERSION = '1.5'
|
||||
|
||||
fields = {'is_shared_instance_path': fields.BooleanField()}
|
||||
|
||||
@@ -349,6 +355,8 @@ class HyperVLiveMigrateData(LiveMigrateData):
|
||||
super(HyperVLiveMigrateData, self).obj_make_compatible(
|
||||
primitive, target_version)
|
||||
target_version = versionutils.convert_version_to_tuple(target_version)
|
||||
if (target_version < (1, 5)):
|
||||
primitive.pop('pci_dev_map_src_dst', None)
|
||||
if target_version < (1, 4) and 'vifs' in primitive:
|
||||
del primitive['vifs']
|
||||
if target_version < (1, 3) and 'wait_for_vif_plugged' in primitive:
|
||||
@@ -363,9 +371,18 @@ class HyperVLiveMigrateData(LiveMigrateData):
|
||||
|
||||
@obj_base.NovaObjectRegistry.register
|
||||
class VMwareLiveMigrateData(LiveMigrateData):
|
||||
VERSION = '1.0'
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: Inherited pci_dev_map_src_dst from LiveMigrateData
|
||||
VERSION = '1.1'
|
||||
|
||||
fields = {
|
||||
'cluster_name': fields.StringField(nullable=False),
|
||||
'datastore_regex': fields.StringField(nullable=False),
|
||||
}
|
||||
|
||||
def obj_make_compatible(self, primitive, target_version):
|
||||
super(VMwareLiveMigrateData, self).obj_make_compatible(
|
||||
primitive, target_version)
|
||||
target_version = versionutils.convert_version_to_tuple(target_version)
|
||||
if (target_version < (1, 1)):
|
||||
primitive.pop('pci_dev_map_src_dst', None)
|
||||
|
||||
@@ -100,7 +100,8 @@ class _TestLibvirtLiveMigrateData(object):
|
||||
dst_supports_mdev_live_migration=True,
|
||||
source_mdev_types={},
|
||||
target_mdevs={},
|
||||
dst_cpu_shared_set_info=set())
|
||||
dst_cpu_shared_set_info=set(),
|
||||
pci_dev_map_src_dst={})
|
||||
manifest = ovo_base.obj_tree_get_versions(obj.obj_name())
|
||||
|
||||
data = lambda x: x['nova_object.data']
|
||||
@@ -145,6 +146,9 @@ class _TestLibvirtLiveMigrateData(object):
|
||||
primitive = data(obj.obj_to_primitive(target_version='1.11',
|
||||
version_manifest=manifest))
|
||||
self.assertNotIn('dst_cpu_shared_set_info', primitive)
|
||||
primitive = data(obj.obj_to_primitive(target_version='1.12',
|
||||
version_manifest=manifest))
|
||||
self.assertNotIn('pci_dev_map_src_dst', primitive)
|
||||
|
||||
def test_bdm_obj_make_compatible(self):
|
||||
obj = migrate_data.LibvirtLiveMigrateBDMInfo(
|
||||
@@ -207,7 +211,8 @@ class _TestHyperVLiveMigrateData(object):
|
||||
obj = migrate_data.HyperVLiveMigrateData(
|
||||
is_shared_instance_path=True,
|
||||
old_vol_attachment_ids={'yes': 'no'},
|
||||
wait_for_vif_plugged=True)
|
||||
wait_for_vif_plugged=True,
|
||||
pci_dev_map_src_dst={})
|
||||
|
||||
data = lambda x: x['nova_object.data']
|
||||
|
||||
@@ -219,6 +224,8 @@ class _TestHyperVLiveMigrateData(object):
|
||||
self.assertNotIn('old_vol_attachment_ids', primitive)
|
||||
primitive = data(obj.obj_to_primitive(target_version='1.2'))
|
||||
self.assertNotIn('wait_for_vif_plugged', primitive)
|
||||
primitive = data(obj.obj_to_primitive(target_version='1.4'))
|
||||
self.assertNotIn('pci_dev_map_src_dst', primitive)
|
||||
|
||||
|
||||
class TestHyperVLiveMigrateData(test_objects._LocalTest,
|
||||
@@ -231,6 +238,29 @@ class TestRemoteHyperVLiveMigrateData(test_objects._RemoteTest,
|
||||
pass
|
||||
|
||||
|
||||
class _TestVMwareLiveMigrateData(object):
|
||||
def test_obj_make_compatible(self):
|
||||
obj = migrate_data.VMwareLiveMigrateData(
|
||||
pci_dev_map_src_dst={})
|
||||
|
||||
data = lambda x: x['nova_object.data']
|
||||
|
||||
primitive = data(obj.obj_to_primitive())
|
||||
self.assertIn('pci_dev_map_src_dst', primitive)
|
||||
primitive = data(obj.obj_to_primitive(target_version='1.0'))
|
||||
self.assertNotIn('pci_dev_map_src_dst', primitive)
|
||||
|
||||
|
||||
class TestVMwareLiveMigrateData(test_objects._LocalTest,
|
||||
_TestVMwareLiveMigrateData):
|
||||
pass
|
||||
|
||||
|
||||
class TestRemoteVMwareLiveMigrateData(test_objects._RemoteTest,
|
||||
_TestVMwareLiveMigrateData):
|
||||
pass
|
||||
|
||||
|
||||
class TestVIFMigrateData(test.NoDBTestCase):
|
||||
|
||||
def test_get_dest_vif_source_vif_not_set(self):
|
||||
|
||||
@@ -1102,7 +1102,7 @@ object_data = {
|
||||
'HostMapping': '1.0-1a3390a696792a552ab7bd31a77ba9ac',
|
||||
'HostMappingList': '1.1-18ac2bfb8c1eb5545bed856da58a79bc',
|
||||
'HVSpec': '1.2-de06bcec472a2f04966b855a49c46b41',
|
||||
'HyperVLiveMigrateData': '1.4-e265780e6acfa631476c8170e8d6fce0',
|
||||
'HyperVLiveMigrateData': '1.5-b424b27305f259fb3c15d720856585c7',
|
||||
'IDEDeviceBus': '1.0-29d4c9f27ac44197f01b6ac1b7e16502',
|
||||
'ImageMeta': '1.8-642d1b2eb3e880a367f37d72dd76162d',
|
||||
'ImageMetaProps': '1.39-b0fb2690fa477480e42a1469769cb9fc',
|
||||
@@ -1128,7 +1128,7 @@ object_data = {
|
||||
'KeyPair': '1.4-1244e8d1b103cc69d038ed78ab3a8cc6',
|
||||
'KeyPairList': '1.3-94aad3ac5c938eef4b5e83da0212f506',
|
||||
'LibvirtLiveMigrateBDMInfo': '1.1-5f4a68873560b6f834b74e7861d71aaf',
|
||||
'LibvirtLiveMigrateData': '1.12-7cd9cbf1c0b3999be34137880bbcfbe5',
|
||||
'LibvirtLiveMigrateData': '1.13-c92e9c98bfccafe84e52c08efbec41d8',
|
||||
'LibvirtLiveMigrateNUMAInfo': '1.0-0e777677f3459d0ed1634eabbdb6c22f',
|
||||
'LibvirtVPMEMDevice': '1.0-17ffaf47585199eeb9a2b83d6bde069f',
|
||||
'MemoryDiagnostics': '1.0-2c995ae0f2223bb0f8e523c5cc0b83da',
|
||||
@@ -1183,7 +1183,7 @@ object_data = {
|
||||
'VirtCPUTopology': '1.0-fc694de72e20298f7c6bab1083fd4563',
|
||||
'VirtualInterface': '1.3-efd3ca8ebcc5ce65fff5a25f31754c54',
|
||||
'VirtualInterfaceList': '1.0-9750e2074437b3077e46359102779fc6',
|
||||
'VMwareLiveMigrateData': '1.0-a3cc858a2bf1d3806d6f57cfaa1fb98a',
|
||||
'VMwareLiveMigrateData': '1.1-14a63b00f1b8880453df6d19a883bc73',
|
||||
'VolumeUsage': '1.0-6c8190c46ce1469bb3286a1f21c2e475',
|
||||
'XenDeviceBus': '1.0-272a4f899b24e31e42b2b9a7ed7e9194',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user