summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <ralonsoh@redhat.com>2018-10-11 12:04:39 +0100
committerRodolfo Alonso Hernandez <ralonsoh@redhat.com>2018-10-12 16:12:46 +0100
commitc672b0d5675e3723df76f4943d9f3e5e7d63fb88 (patch)
treed2a870b810af2ff64924c055d00bbf2f15bc505a
parent111d0b285200961fa796532688ae65d4ca801ce8 (diff)
Updated "create_pool" method in plugin
Once the pool object is created in the DB and the listeners are updated with the pool information, the updated listeners are retrieved and populated into the pool object. The DB method to create the pool now flushes the context to retrieve an updated pool DB object at the end of the method, instead of retrieving again the same object from the DB. This is needed to make solve the Queens backport of I32328c5206b9cd6fb8d8764c079f22b6ea8bfa9e. Story: 2001962 Change-Id: Icf43952f6e5c5004a5c4d8d541b6efcb5d3ec50c
Notes
Notes (review): Code-Review+2: Carlos Goncalves <cgoncalves@redhat.com> Code-Review+2: Nir Magnezi <nmagnezi@redhat.com> Workflow+1: Nir Magnezi <nmagnezi@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Sun, 14 Oct 2018 14:21:15 +0000 Reviewed-on: https://review.openstack.org/610082 Project: openstack/neutron-lbaas Branch: refs/heads/master
-rw-r--r--neutron_lbaas/db/loadbalancer/loadbalancer_dbv2.py4
-rw-r--r--neutron_lbaas/services/loadbalancer/plugin.py6
2 files changed, 5 insertions, 5 deletions
diff --git a/neutron_lbaas/db/loadbalancer/loadbalancer_dbv2.py b/neutron_lbaas/db/loadbalancer/loadbalancer_dbv2.py
index c53025c..244af4f 100644
--- a/neutron_lbaas/db/loadbalancer/loadbalancer_dbv2.py
+++ b/neutron_lbaas/db/loadbalancer/loadbalancer_dbv2.py
@@ -664,8 +664,8 @@ class LoadBalancerPluginDbv2(base_db.CommonDbMixin,
664 pool_db.session_persistence = s_p 664 pool_db.session_persistence = s_p
665 665
666 context.session.add(pool_db) 666 context.session.add(pool_db)
667 context.session.refresh(pool_db.loadbalancer) 667 context.session.flush()
668 return self.get_pool(context, pool_db.id) 668 return data_models.Pool.from_sqlalchemy_model(pool_db)
669 669
670 def update_pool(self, context, id, pool): 670 def update_pool(self, context, id, pool):
671 with context.session.begin(subtransactions=True): 671 with context.session.begin(subtransactions=True):
diff --git a/neutron_lbaas/services/loadbalancer/plugin.py b/neutron_lbaas/services/loadbalancer/plugin.py
index 4f0e071..b6c2b81 100644
--- a/neutron_lbaas/services/loadbalancer/plugin.py
+++ b/neutron_lbaas/services/loadbalancer/plugin.py
@@ -710,9 +710,9 @@ class LoadBalancerPluginv2(loadbalancerv2.LoadBalancerPluginBaseV2,
710 self.db.update_loadbalancer_provisioning_status( 710 self.db.update_loadbalancer_provisioning_status(
711 context, db_pool.loadbalancer_id) 711 context, db_pool.loadbalancer_id)
712 raise exc 712 raise exc
713 # Reload the pool from the DB to re-populate pool.listeners 713
714 # before calling the driver 714 db_pool.listeners = self.db.get_listeners(
715 db_pool = self.db.get_pool(context, db_pool.id) 715 context, filters={'default_pool_id': [db_pool.id]})
716 driver = self._get_driver_for_loadbalancer( 716 driver = self._get_driver_for_loadbalancer(
717 context, db_pool.loadbalancer_id) 717 context, db_pool.loadbalancer_id)
718 self._call_driver_operation(context, driver.pool.create, db_pool) 718 self._call_driver_operation(context, driver.pool.create, db_pool)