File 0001-Only-if-loadbalancer-s-status-is-normal-then-create-.patch of Package openstack-neutron-lbaas
From 1af1b1df6a650b7a1ecbaa44d9e6676b77a9a239 Mon Sep 17 00:00:00 2001
From: Lizhixin <lizhixin@awcloud.com>
Date: Sat, 14 Jan 2017 15:12:16 +0800
Subject: [PATCH] Only if loadbalancer's status is normal then create pool in
db
When a loadbalancer is in PENDING_UPDATE state, creating a pool with
this lb will return http 409 error with "Invalid state PENDING_UPDATE
of loadbalancer resource LB_ID". But the pool already exists in the
database although the api return this error.
So we shall create a pool in db only if the loadbalancer's state is
normal, wich is consistent with creating listners.
Change-Id: Idb35d4e6ecdc46ff3748768774737b3b01d515f6
Closes-Bug: #1650170
(cherry picked from commit 85f08fcfed0c7d43f38b6387b301012f7c9afdcc)
---
neutron_lbaas/services/loadbalancer/plugin.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/neutron_lbaas/services/loadbalancer/plugin.py b/neutron_lbaas/services/loadbalancer/plugin.py
index dc1131bc8..ab3bb2e08 100644
--- a/neutron_lbaas/services/loadbalancer/plugin.py
+++ b/neutron_lbaas/services/loadbalancer/plugin.py
@@ -665,10 +665,9 @@ class LoadBalancerPluginv2(loadbalancerv2.LoadBalancerPluginBaseV2):
# blank out the listeners at this point.
del pool['listener_id']
pool['listeners'] = []
- db_pool = self.db.create_pool(context, pool)
self.db.test_and_set_status(context, models.LoadBalancer,
- db_pool.loadbalancer_id,
- constants.PENDING_UPDATE)
+ lb_id, constants.PENDING_UPDATE)
+ db_pool = self.db.create_pool(context, pool)
for db_l in db_listeners:
try:
self.db.update_listener(context, db_l.id,
--
2.14.1