Merge "Fix postgresql database creation failures from prepare func"
This commit is contained in:
commit
651cee350f
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fix potential PostgreSQL database creation failures from the instance create API
|
@ -201,6 +201,8 @@ common_opts = [
|
|||||||
'change.'),
|
'change.'),
|
||||||
cfg.IntOpt('state_change_poll_time', default=3,
|
cfg.IntOpt('state_change_poll_time', default=3,
|
||||||
help='Interval between state change poll requests (seconds).'),
|
help='Interval between state change poll requests (seconds).'),
|
||||||
|
cfg.IntOpt('state_healthy_counts', default=5,
|
||||||
|
help='consecutive success db connections for status HEALTHY'),
|
||||||
cfg.IntOpt('agent_heartbeat_time', default=10,
|
cfg.IntOpt('agent_heartbeat_time', default=10,
|
||||||
help='Maximum time (in seconds) for the Guest Agent to reply '
|
help='Maximum time (in seconds) for the Guest Agent to reply '
|
||||||
'to a heartbeat request.'),
|
'to a heartbeat request.'),
|
||||||
|
@ -290,15 +290,15 @@ class BaseDbStatus(object):
|
|||||||
# outside.
|
# outside.
|
||||||
loop = True
|
loop = True
|
||||||
|
|
||||||
# We need 3 (by default) consecutive success db connections for status
|
# We need 5 (by default) consecutive success db connections for status
|
||||||
# 'HEALTHY'
|
# 'HEALTHY'
|
||||||
healthy_count = 0
|
healthy_count = 0
|
||||||
|
state_healthy_counts = CONF.state_healthy_counts - 1
|
||||||
while loop:
|
while loop:
|
||||||
self.status = self.get_actual_db_status()
|
self.status = self.get_actual_db_status()
|
||||||
if self.status == status:
|
if self.status == status:
|
||||||
if (status == service_status.ServiceStatuses.HEALTHY and
|
if (status == service_status.ServiceStatuses.HEALTHY and
|
||||||
healthy_count < 2):
|
healthy_count < state_healthy_counts):
|
||||||
healthy_count += 1
|
healthy_count += 1
|
||||||
time.sleep(CONF.state_change_poll_time)
|
time.sleep(CONF.state_change_poll_time)
|
||||||
continue
|
continue
|
||||||
@ -310,7 +310,8 @@ class BaseDbStatus(object):
|
|||||||
# should we remain in this loop? this is the thing
|
# should we remain in this loop? this is the thing
|
||||||
# that emulates the do-while construct.
|
# that emulates the do-while construct.
|
||||||
loop = (time.time() < end_time)
|
loop = (time.time() < end_time)
|
||||||
|
# reset the healthy_count
|
||||||
|
healthy_count = 0
|
||||||
# no point waiting if our time is up and we're
|
# no point waiting if our time is up and we're
|
||||||
# just going to error out anyway.
|
# just going to error out anyway.
|
||||||
if loop:
|
if loop:
|
||||||
|
Loading…
Reference in New Issue
Block a user