import random
from oslo.config import cfg
+from oslo.db import exception as db_exc
from oslo import messaging
import osprofiler.notifier
from osprofiler import profiler
self.model_disconnected = False
LOG.error(_('Recovered model server connection!'))
- # TODO(vish): this should probably only catch connection errors
- except Exception: # pylint: disable=W0702
+ except db_exc.DBConnectionError:
if not getattr(self, 'model_disconnected', False):
self.model_disconnected = True
LOG.exception(_('model server went away'))
import mock
import mox
from oslo.config import cfg
+from oslo.db import exception as db_exc
from cinder import context
from cinder import db
binary).AndRaise(exception.NotFound())
service.db.service_create(mox.IgnoreArg(),
service_create).AndReturn(service_ref)
- service.db.service_get(mox.IgnoreArg(),
- mox.IgnoreArg()).AndRaise(Exception())
+ service.db.service_get(
+ mox.IgnoreArg(),
+ mox.IgnoreArg()).AndRaise(db_exc.DBConnectionError())
self.mox.ReplayAll()
serv = service.Service(host,