From d4fdf206310bf5ec2691ff1311d9f38567ace3db Mon Sep 17 00:00:00 2001 From: Kailun Qin Date: Fri, 15 Feb 2019 08:22:00 +0800 Subject: [PATCH] Add exception to prevent overlapped segment ranges A check is introduced to ensure the network segment range to create is not overlapping with any existing range of the same type. Co-authored-by: Allain Legacy Partially-implements: blueprint network-segment-range-management Change-Id: I6b011687320382f4523f074c08c24cd2e02f5718 --- neutron_lib/exceptions/network_segment_range.py | 5 +++++ ...ork-segment-range-overlap-exception-e8b4b2b425c51c80.yaml | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 releasenotes/notes/add-network-segment-range-overlap-exception-e8b4b2b425c51c80.yaml diff --git a/neutron_lib/exceptions/network_segment_range.py b/neutron_lib/exceptions/network_segment_range.py index d722739d9..456ade9d0 100644 --- a/neutron_lib/exceptions/network_segment_range.py +++ b/neutron_lib/exceptions/network_segment_range.py @@ -33,3 +33,8 @@ class NetworkSegmentRangeReferencedByProject(exceptions.NeutronException): class NetworkSegmentRangeDefaultReadOnly(exceptions.NeutronException): message = _("Network Segment Range %(range_id)s is a " "default segment range which could not be updated or deleted.") + + +class NetworkSegmentRangeOverlaps(exceptions.Conflict): + message = _("Network segment range overlaps with range(s) " + "with id %(range_id)s") diff --git a/releasenotes/notes/add-network-segment-range-overlap-exception-e8b4b2b425c51c80.yaml b/releasenotes/notes/add-network-segment-range-overlap-exception-e8b4b2b425c51c80.yaml new file mode 100644 index 000000000..6cc5de843 --- /dev/null +++ b/releasenotes/notes/add-network-segment-range-overlap-exception-e8b4b2b425c51c80.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Add ``NetworkSegmentRangeOverlaps`` exception to prevent overlapping + network segment ranges on creation.