diff --git a/neutron_lib/plugins/ml2/api.py b/neutron_lib/plugins/ml2/api.py index dfb267d7c..b838a7dfa 100644 --- a/neutron_lib/plugins/ml2/api.py +++ b/neutron_lib/plugins/ml2/api.py @@ -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): diff --git a/releasenotes/notes/responsible_for_ports_allocation-5599dc59b3c98db2.yaml b/releasenotes/notes/responsible_for_ports_allocation-5599dc59b3c98db2.yaml new file mode 100644 index 000000000..814295e9f --- /dev/null +++ b/releasenotes/notes/responsible_for_ports_allocation-5599dc59b3c98db2.yaml @@ -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.