diff --git a/doc/source/user/vif-types.rst b/doc/source/user/vif-types.rst index 43ca9587..54908f33 100644 --- a/doc/source/user/vif-types.rst +++ b/doc/source/user/vif-types.rst @@ -75,6 +75,16 @@ VIFHostDevice This class provides a way to pass a physical device to the guest. Either an entire physical device, or an SR-IOV PCI device virtual function, are permitted. +.. _vif-nesteddpdk: + +VIFNestedDPDK +------------- + +This class provides a configuration, where kuryr-kuberentes is used to provide +accelerated DPDK datapath for nested Kubernetes pods running inside the VM. +Port is first attached to the virtual machine, bound to the userspace driver +(e.g. uio_pci_generic, igb_uio or vfio-pci) and then consumed by Kubernetes +pod via kuryr-kubernetes CNI plugin. VIF port profile objects ======================== @@ -129,6 +139,11 @@ VIFPortProfileFPTap This profile provides the metadata required to associate a fast path vhost-user VIF with a Calico port. +VIFPortProfileK8sDPDK +--------------------- + +This profile provides the metadata required to associate nested DPDK VIF with +a Kubernetes pod. VIF network objects =================== diff --git a/os_vif/objects/vif.py b/os_vif/objects/vif.py index 086f4704..05bed93d 100644 --- a/os_vif/objects/vif.py +++ b/os_vif/objects/vif.py @@ -161,6 +161,22 @@ class VIFHostDevice(VIFBase): } +@base.VersionedObjectRegistry.register +class VIFNestedDPDK(VIFBase): + # For kuryr-kubernetes nested DPDK interfaces + + VERSION = '1.0' + + fields = { + # PCI address of the device. + 'pci_address': fields.StringField(), + + # Name of the driver the device was previously bound to; it makes + # the controller driver agnostic (virtio, sr-iov, etc.) + 'dev_driver': fields.StringField(), + } + + @base.VersionedObjectRegistry.register class VIFPortProfileBase(osv_base.VersionedObject, base.ComparableVersionedObject): @@ -282,3 +298,22 @@ class VIFPortProfile8021Qbh(VIFPortProfileBase): fields = { 'profile_id': fields.StringField() } + + +@base.VersionedObjectRegistry.register +class VIFPortProfileK8sDPDK(VIFPortProfileBase): + # Port profile info for Kuryr-Kubernetes DPDK ports + + VERSION = '1.0' + + fields = { + # Specify whether this vif requires L3 setup. + 'l3_setup': fields.BooleanField(), + + # String containing URL representing object in Kubernetes API. + 'selflink': fields.StringField(), + + # String used in Kubernetes v1 API to identifies + # the server's internal version of this object. + 'resourceversion': fields.StringField() + } diff --git a/os_vif/tests/unit/test_objects.py b/os_vif/tests/unit/test_objects.py index 6465cc75..12c3e7ca 100644 --- a/os_vif/tests/unit/test_objects.py +++ b/os_vif/tests/unit/test_objects.py @@ -46,6 +46,8 @@ object_data = { 'VIFPortProfileFPTap': '1.0-11670d8dbabd772ff0da26961adadc5a', 'VIFVHostUser': '1.1-1f95b43be1f884f090ca1f4d79adfd35', 'VIFPortProfileOVSRepresentor': '1.1-30e555981003a109b133da5b43ded5df', + 'VIFNestedDPDK': '1.0-fdbaf6b20afd116529929b21aa7158dc', + 'VIFPortProfileK8sDPDK': '1.0-f1e0daa66b041ded4e6dbc053b4a66d5', } diff --git a/os_vif/tests/unit/test_vif.py b/os_vif/tests/unit/test_vif.py index 83195d01..46dba29f 100644 --- a/os_vif/tests/unit/test_vif.py +++ b/os_vif/tests/unit/test_vif.py @@ -193,3 +193,14 @@ class TestVIFS(base.TestCase): self._test_vif(objects.vif.VIFHostDevice, dev_address="0002:24:12.3", port_profile=prof) + + def test_vif_nested_dpdk_k8s(self): + prof = objects.vif.VIFPortProfileK8sDPDK( + l3_setup=False, + selflink="/some/url", + resourceversion="1") + self._test_vif( + objects.vif.VIFNestedDPDK, + pci_adress="0002:24:12.3", + dev_driver="virtio_pci", + port_profile=prof)