Mechanism driver API: responsible_for_rsc_provider

Allow mechanism manager to query drivers if they are responsible for a
resource provider or not.

Change-Id: Iea76d85c532b6bded2654062997738295ffc2f5b
Needed-By: https://review.openstack.org/574783
Partial-Bug: #1578989
See-Also: https://review.openstack.org/502306 (nova spec)
See-Also: https://review.openstack.org/508149 (neutron spec)
This commit is contained in:
Bence Romsics 2018-06-12 16:40:30 +02:00
parent abc287647b
commit 679481f374
2 changed files with 31 additions and 0 deletions

View File

@ -413,6 +413,27 @@ class MechanismDriver(object):
"""
return candidate_hosts
def responsible_for_ports_allocation(self, context):
"""Is responsible for a port's resource provider?
:param context: PortContext instance describing the port
:returns: True for responsible, False for not responsible
For ports having an allocation in Placement (as expressed
in the port's binding:profile.allocation) decide while
binding if this mechanism driver is responsible for the
physical network interface represented by the resource
provider in Placement. Find the resource provider UUID in
context.current['binding:profile']['allocation'].
Drivers wanting to support resource allocations for ports in
Placement (eg. wanting to guarantee some minimum bandwidth)
must implement this method.
Default implementation returns False (backward compatibility).
"""
return False
@six.add_metaclass(abc.ABCMeta)
class _TypeDriverBase(object):

View File

@ -0,0 +1,10 @@
---
features:
- |
New MechanismDriver API method: ``responsible_for_ports_allocation``.
Mechanism drivers wanting to support resource allocations for ports in
Placement (eg. wanting to guarantee some minimum bandwidth allocated
on the resource provider in the port's ``binding:profile.allocation``)
must implement this method. The default implementation reports not
being responsible for any resource providers, therefore unaffected
drivers need not be changed.