libvirt: Add vIOMMU device to guest
Implementation for BP/libvirt-viommu-device. With provide `hw:viommu_model` property to extra_specs or `hw_viommu_model` to image property. will enable viommu to libvirt guest. [1] https://www.berrange.com/posts/2017/02/16/setting-up-a-nested-kvm-guest-for-developing-testing-pci-device-assignment-with-numa/ [2] https://review.opendev.org/c/openstack/nova-specs/+/840310 Implements: blueprint libvirt-viommu-device Change-Id: Ief9c550292788160433a28a7a1c36ba38a6bc849 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:

committed by
ricolin

parent
733a87e612
commit
14e3b352c2
@@ -616,6 +616,16 @@ class VIFModel(BaseNovaEnum):
|
||||
return super(VIFModel, self).coerce(obj, attr, value)
|
||||
|
||||
|
||||
class VIOMMUModel(BaseNovaEnum):
|
||||
|
||||
INTEL = 'intel'
|
||||
SMMUV3 = 'smmuv3'
|
||||
VIRTIO = 'virtio'
|
||||
AUTO = 'auto'
|
||||
|
||||
ALL = (INTEL, SMMUV3, VIRTIO, AUTO)
|
||||
|
||||
|
||||
class VMMode(BaseNovaEnum):
|
||||
"""Represents possible vm modes for instances.
|
||||
|
||||
@@ -1301,6 +1311,10 @@ class VIFModelField(BaseEnumField):
|
||||
AUTO_TYPE = VIFModel()
|
||||
|
||||
|
||||
class VIOMMUModelField(BaseEnumField):
|
||||
AUTO_TYPE = VIOMMUModel()
|
||||
|
||||
|
||||
class VMModeField(BaseEnumField):
|
||||
AUTO_TYPE = VMMode()
|
||||
|
||||
|
@@ -191,14 +191,17 @@ class ImageMetaProps(base.NovaObject):
|
||||
# Version 1.32: Added 'hw_ephemeral_encryption' and
|
||||
# 'hw_ephemeral_encryption_format' fields
|
||||
# Version 1.33: Added 'hw_locked_memory' field
|
||||
# Version 1.34: Added 'hw_viommu_model' field
|
||||
# NOTE(efried): When bumping this version, the version of
|
||||
# ImageMetaPropsPayload must also be bumped. See its docstring for details.
|
||||
VERSION = '1.33'
|
||||
VERSION = '1.34'
|
||||
|
||||
def obj_make_compatible(self, primitive, target_version):
|
||||
super(ImageMetaProps, self).obj_make_compatible(primitive,
|
||||
target_version)
|
||||
target_version = versionutils.convert_version_to_tuple(target_version)
|
||||
if target_version < (1, 34):
|
||||
primitive.pop('hw_viommu_model', None)
|
||||
if target_version < (1, 33):
|
||||
primitive.pop('hw_locked_memory', None)
|
||||
if target_version < (1, 32):
|
||||
@@ -446,6 +449,9 @@ class ImageMetaProps(base.NovaObject):
|
||||
# name of a NIC device model eg virtio, e1000, rtl8139
|
||||
'hw_vif_model': fields.VIFModelField(),
|
||||
|
||||
# name of IOMMU device model eg virtio, intel, smmuv3, or auto
|
||||
'hw_viommu_model': fields.VIOMMUModelField(),
|
||||
|
||||
# "xen" vs "hvm"
|
||||
'hw_vm_mode': fields.VMModeField(),
|
||||
|
||||
|
Reference in New Issue
Block a user