summaryrefslogtreecommitdiff
path: root/nova/scheduler
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/scheduler
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/scheduler')
-rw-r--r--nova/scheduler/request_filter.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/nova/scheduler/request_filter.py b/nova/scheduler/request_filter.py
index f837efe653..be1455df88 100644
--- a/nova/scheduler/request_filter.py
+++ b/nova/scheduler/request_filter.py
@@ -365,6 +365,33 @@ def routed_networks_filter(
return True
+@trace_request_filter
+def remote_managed_ports_filter(
+ context: nova_context.RequestContext,
+ request_spec: 'objects.RequestSpec',
+) -> bool:
+ """Filter out hosts without remote managed port support (driver or hw).
+
+ If a request spec contains VNIC_TYPE_REMOTE_MANAGED ports then a
+ remote-managed port trait (COMPUTE_REMOTE_MANAGED_PORTS) is added to
+ the request in order to pre-filter hosts that do not use compute
+ drivers supporting remote managed ports and the ones that do not have
+ the device pools providing remote-managed ports (actual device
+ availability besides a pool presence check is done at the time of
+ PciPassthroughFilter execution).
+ """
+ if request_spec.requested_networks:
+ network_api = neutron.API()
+ for request_net in request_spec.requested_networks:
+ if request_net.port_id and network_api.is_remote_managed_port(
+ context, request_net.port_id):
+ request_spec.root_required.add(
+ os_traits.COMPUTE_REMOTE_MANAGED_PORTS)
+ LOG.debug('remote_managed_ports_filter request filter added '
+ f'trait {os_traits.COMPUTE_REMOTE_MANAGED_PORTS}')
+ return True
+
+
ALL_REQUEST_FILTERS = [
require_tenant_aggregate,
map_az_to_placement_aggregate,
@@ -374,6 +401,7 @@ ALL_REQUEST_FILTERS = [
transform_image_metadata,
accelerators_filter,
routed_networks_filter,
+ remote_managed_ports_filter,
]