Skip to content

Commit a1d422f

Browse files
gthiemongeberendt
authored andcommitted
Fix fully-populated API with allowed_cidrs
When creating a LB + a listener with an allowed_cidr with the fully-populated API, an issue happened when Octavia validated that the allowed_cidrs and the VIP ip address have the same IP version. The vip.ip_address value was not updated in the load balancer object, forcing the expiration of the DB object before entering _graph_create fixes this issue. Note: there's no change in the tests, the test function for this feature exists, looks correct, and passes successfully, the bug is only reproducible in octavia-api. Closes-Bug: 2057751 Change-Id: Ia106d81c1b2588e5d938d2238c8a2f6660bf5ef1 (cherry picked from commit 5d9b23c)
1 parent ac5a047 commit a1d422f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

octavia/api/v2/controllers/load_balancer.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,13 @@ def post(self, load_balancer):
552552
subnet_id=add_vip.subnet_id)
553553

554554
if listeners or pools:
555+
# expire_all is required here, it ensures that the loadbalancer
556+
# will be re-fetched with its associated vip in _graph_create.
557+
# without expire_all the vip attributes that have been updated
558+
# just before this call may not be set correctly in the
559+
# loadbalancer object.
560+
lock_session.expire_all()
561+
555562
db_pools, db_lists = self._graph_create(
556563
context.session, lock_session, db_lb, listeners, pools)
557564

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
fixes:
3+
- |
4+
Fixed a bug when creating a load balancer and a listener with
5+
``allowed_cidrs`` with the fully-populated load balancer API, the call was
6+
rejected because Octavia could not validate that the IP addresses of the
7+
``allowed_cidrs`` have the same family as the VIP address.

0 commit comments

Comments
 (0)