summaryrefslogtreecommitdiff
path: root/nova/network
diff options
context:
space:
mode:
authorDmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>2022-02-04 12:50:28 +0300
committerDmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>2022-02-09 01:23:27 +0300
commitc487c730d010013f8579622337af63d93b733f3b (patch)
treea87b82e51e5d5a4f604ea69943d471c4f08a8620 /nova/network
parentd1e9ecb443dd6bd5dc6456a3f9e33c1551436364 (diff)
downloadnova-c487c730d010013f8579622337af63d93b733f3b.tar.gz
Filter computes without remote-managed ports early
Add a pre-filter for requests that contain VNIC_TYPE_REMOTE_MANAGED ports in them: hosts that do not have either the relevant compute driver capability COMPUTE_REMOTE_MANAGED_PORTS or PCI device pools with "remote_managed" devices are filtered out early. Presence of devices actually available for allocation is checked at a later point by the PciPassthroughFilter. Change-Id: I168d3ccc914f25a3d4255c9b319ee6b91a2f66e2 Implements: blueprint integration-with-off-path-network-backends
Diffstat (limited to 'nova/network')
-rw-r--r--nova/network/model.py6
-rw-r--r--nova/network/neutron.py21
2 files changed, 25 insertions, 2 deletions
diff --git a/nova/network/model.py b/nova/network/model.py
index 64995c9527..5bd70837db 100644
--- a/nova/network/model.py
+++ b/nova/network/model.py
@@ -106,6 +106,7 @@ VNIC_TYPE_VIRTIO_FORWARDER = 'virtio-forwarder'
VNIC_TYPE_VDPA = 'vdpa'
VNIC_TYPE_ACCELERATOR_DIRECT = 'accelerator-direct'
VNIC_TYPE_ACCELERATOR_DIRECT_PHYSICAL = 'accelerator-direct-physical'
+VNIC_TYPE_REMOTE_MANAGED = "remote-managed"
# Define list of ports which needs pci request.
# Note: The macvtap port needs a PCI request as it is a tap interface
@@ -121,14 +122,15 @@ VNIC_TYPE_ACCELERATOR_DIRECT_PHYSICAL = 'accelerator-direct-physical'
# selected compute node.
VNIC_TYPES_SRIOV = (
VNIC_TYPE_DIRECT, VNIC_TYPE_MACVTAP, VNIC_TYPE_DIRECT_PHYSICAL,
- VNIC_TYPE_VIRTIO_FORWARDER, VNIC_TYPE_VDPA)
+ VNIC_TYPE_VIRTIO_FORWARDER, VNIC_TYPE_VDPA, VNIC_TYPE_REMOTE_MANAGED)
# Define list of ports which are passthrough to the guest
# and need a special treatment on snapshot and suspend/resume
VNIC_TYPES_DIRECT_PASSTHROUGH = (VNIC_TYPE_DIRECT,
VNIC_TYPE_DIRECT_PHYSICAL,
VNIC_TYPE_ACCELERATOR_DIRECT,
- VNIC_TYPE_ACCELERATOR_DIRECT_PHYSICAL)
+ VNIC_TYPE_ACCELERATOR_DIRECT_PHYSICAL,
+ VNIC_TYPE_REMOTE_MANAGED)
# Define list of ports which contains devices managed by cyborg.
VNIC_TYPES_ACCELERATOR = (
diff --git a/nova/network/neutron.py b/nova/network/neutron.py
index cd8450ef71..1bdafcfc15 100644
--- a/nova/network/neutron.py
+++ b/nova/network/neutron.py
@@ -2123,6 +2123,27 @@ class API:
# the port binding profile and we can handle it as a boolean.
return strutils.bool_from_string(value)
+ @staticmethod
+ def _is_remote_managed(vnic_type):
+ """Determine if the port is remote_managed or not by VNIC type.
+
+ :param str vnic_type: The VNIC type to assess.
+ :return: A boolean indicator whether the NIC is remote managed or not.
+ :rtype: bool
+ """
+ return vnic_type == network_model.VNIC_TYPE_REMOTE_MANAGED
+
+ def is_remote_managed_port(self, context, port_id):
+ """Determine if a port has a REMOTE_MANAGED VNIC type.
+
+ :param context: The request context
+ :param port_id: The id of the Neutron port
+ """
+ port = self.show_port(context, port_id)['port']
+ return self._is_remote_managed(
+ port.get('binding:vnic_type', network_model.VNIC_TYPE_NORMAL)
+ )
+
# NOTE(sean-k-mooney): we might want to have this return a
# nova.network.model.VIF object instead in the future.
def _get_port_vnic_info(self, context, neutron, port_id):