]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Dispose DB connections between backend proc starts
authorJay S. Bryant <jsbryant@us.ibm.com>
Tue, 9 Jun 2015 22:10:18 +0000 (17:10 -0500)
committerJay S. Bryant <jsbryant@us.ibm.com>
Thu, 11 Jun 2015 03:13:01 +0000 (22:13 -0500)
Currently we do not dispose the existing DB pools before
forking off additional storage backend processes.  This can
result in timing issues and DB errors.

This change simply ensures that we do a dispose_engine() in
the loop where we are forking off processes for the storage
backends.

Change-Id: I4ce67e1ce7853fafe5318393482d841583e42098
Closes-bug: 1463580
(cherry picked from commit bb683d6ce4f8e8ad6f1ba657eac5c7f92c9ea82f)

cinder/cmd/volume.py

index f7286403498a555edb43f7ec2a30c712369a4942..ed99dded34384ab4f37cbf5457a776471854b5bc 100644 (file)
@@ -43,6 +43,7 @@ i18n.enable_lazy()
 
 # Need to register global_opts
 from cinder.common import config  # noqa
+from cinder.db import api as session
 from cinder import service
 from cinder import utils
 from cinder import version
@@ -70,6 +71,10 @@ def main():
             server = service.Service.create(host=host,
                                             service_name=backend,
                                             binary='cinder-volume')
+            # Dispose of the whole DB connection pool here before
+            # starting another process.  Otherwise we run into cases where
+            # child processes share DB connections which results in errors.
+            session.dispose_engine()
             launcher.launch_service(server)
     else:
         server = service.Service.create(binary='cinder-volume')