Ensure a functional database connection

Allow retrying database connection in get_engine() at an interval.  Resolves
the issue of nova components erroring at startup if a database connection is
unavailable, particularly at boot. Borrowed from a similar commit to glance,
(https://review.openstack.org/#change,5552).

Fixes Bug #959426 for nova.

Update: * Properly return an engine (fixes tests)
        * Setting sql_max_retries to -1 will retry infinitely
        * Bumped options count in nova.conf.sample
        * i18n log warning
        * Add note to flag help about -1 == infinite
        * Pep8 fix

Change-Id: Id34eda9e0bad6b477a74e9a7d3575e513e6291d5
This commit is contained in:
Adam Gandelman 2012-03-28 18:52:41 -07:00
parent 195d8ac27b
commit 599cea5d1e

View File

@ -325,6 +325,10 @@ global_opts = [
cfg.IntOpt('sql_idle_timeout',
default=3600,
help='timeout before idle sql connections are reaped'),
cfg.IntOpt('sql_max_retries',
default=10,
help='maximum db connection retries during startup. '
'(setting -1 implies an infinite retry count)'),
cfg.IntOpt('sql_retry_interval',
default=10,
help='interval between retries of opening a sql connection'),