From e00321286bf328470279604b94de3dcb38687c88 Mon Sep 17 00:00:00 2001 From: Kailun Qin Date: Sat, 22 Dec 2018 03:20:18 +0800 Subject: [PATCH] Extend methods for network segment range support This patch extends the ML2 type driver abstract methods ``reserve_provider_segment`` and ``allocate_tenant_segment`` with ``filters`` used as search criteria for the segment allocation support when network-segment-range extension is loaded. Co-authored-by: Allain Legacy Partially-implements: blueprint network-segment-range-management Change-Id: I249f2b306b0157b1e5f2acaaa947f8977def17fe --- neutron_lib/plugins/ml2/api.py | 12 ++++++++---- ...egment-methods-with-filters-6e74953ae2d3b828.yaml | 7 +++++++ 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/extend-segment-methods-with-filters-6e74953ae2d3b828.yaml diff --git a/neutron_lib/plugins/ml2/api.py b/neutron_lib/plugins/ml2/api.py index 2aa1492d9..84ce9dae8 100644 --- a/neutron_lib/plugins/ml2/api.py +++ b/neutron_lib/plugins/ml2/api.py @@ -534,11 +534,12 @@ class TypeDriver(_TypeDriverBase): """ @abc.abstractmethod - def reserve_provider_segment(self, session, segment): + def reserve_provider_segment(self, session, segment, filters=None): """Reserve resource associated with a provider network segment. :param session: database session :param segment: segment dictionary + :param filters: a dictionary that is used as search criteria :returns: segment dictionary Called inside transaction context on session to reserve the @@ -549,10 +550,11 @@ class TypeDriver(_TypeDriverBase): pass @abc.abstractmethod - def allocate_tenant_segment(self, session): + def allocate_tenant_segment(self, session, filters=None): """Allocate resource for a new tenant network segment. :param session: database session + :param filters: a dictionary that is used as search criteria :returns: segment dictionary using keys defined above Called inside transaction context on session to allocate a new @@ -604,11 +606,12 @@ class ML2TypeDriver(_TypeDriverBase): """ @abc.abstractmethod - def reserve_provider_segment(self, context, segment): + def reserve_provider_segment(self, context, segment, filters=None): """Reserve resource associated with a provider network segment. :param context: instance of neutron context with DB session :param segment: segment dictionary + :param filters: a dictionary that is used as search criteria :returns: segment dictionary Called inside transaction context on session to reserve the @@ -619,10 +622,11 @@ class ML2TypeDriver(_TypeDriverBase): pass @abc.abstractmethod - def allocate_tenant_segment(self, context): + def allocate_tenant_segment(self, context, filters=None): """Allocate resource for a new tenant network segment. :param context: instance of neutron context with DB session + :param filters: a dictionary that is used as search criteria :returns: segment dictionary using keys defined above Called inside transaction context on session to allocate a new diff --git a/releasenotes/notes/extend-segment-methods-with-filters-6e74953ae2d3b828.yaml b/releasenotes/notes/extend-segment-methods-with-filters-6e74953ae2d3b828.yaml new file mode 100644 index 000000000..e0e2a17b8 --- /dev/null +++ b/releasenotes/notes/extend-segment-methods-with-filters-6e74953ae2d3b828.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Extend the ML2 type driver abstract methods ``reserve_provider_segment`` + and ``allocate_tenant_segment`` with ``filters`` that is used as search + criteria for the segment allocation support when network-segment-range + extension is loaded.