diff options
author | Josh Kearney <josh.kearney@rackspace.com> | 2011-01-04 18:34:47 -0600 |
---|---|---|
committer | Josh Kearney <josh.kearney@rackspace.com> | 2011-01-04 18:34:47 -0600 |
commit | 472af7e750f369e3b999d2b1ac48f74369975ba6 (patch) | |
tree | 1d87defb766f045afb090ec7f2ca86ce83425400 /nova/service.py | |
parent | dd1e36b9690a2c2de18c565c496b25295a13d0aa (diff) | |
download | nova-472af7e750f369e3b999d2b1ac48f74369975ba6.tar.gz nova-472af7e750f369e3b999d2b1ac48f74369975ba6.tar.xz nova-472af7e750f369e3b999d2b1ac48f74369975ba6.zip |
Recover from a lost data store connection
Diffstat (limited to 'nova/service.py')
-rw-r--r-- | nova/service.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/nova/service.py b/nova/service.py index f1f90742f..7203430c6 100644 --- a/nova/service.py +++ b/nova/service.py @@ -24,17 +24,21 @@ import inspect import logging import os import sys +import time from eventlet import event from eventlet import greenthread from eventlet import greenpool +from sqlalchemy.exc import OperationalError + from nova import context from nova import db from nova import exception from nova import flags from nova import rpc from nova import utils +from nova.db.sqlalchemy import models FLAGS = flags.FLAGS @@ -204,6 +208,14 @@ class Service(object): self.model_disconnected = True logging.exception(_("model server went away")) + try: + models.register_models() + except OperationalError: + logging.exception(_("Data store is unreachable." + " Trying again in %d seconds.") % + FLAGS.sql_retry_interval) + time.sleep(FLAGS.sql_retry_interval) + def serve(*services): argv = FLAGS(sys.argv) |