diff options
author | Nejc Saje <nsaje@redhat.com> | 2014-07-25 12:46:27 +0200 |
---|---|---|
committer | Nejc Saje <nsaje@redhat.com> | 2014-07-28 14:47:00 +0200 |
commit | ff3f25b35b965a439c30f4501cebbe2d0288fe97 (patch) | |
tree | cf45d5b7ef00c115f049cb1a77e2f2e7ddd1a398 | |
parent | 6c872263127cc3fff5aecb9a167d726d58fbc2f2 (diff) | |
download | ceilometer-ff3f25b35b965a439c30f4501cebbe2d0288fe97.tar.gz |
Update ensure()/reconnect() to catch MessagingError
The error handling code that gets connections reset if necessary
caught ConnectionError. It really needs to catch MessagingError,
which ConnectionError inherits from. There are other types of
MessagingErrors that may occur, such as InternalError, and they need
to cause the connection to reset, as well.
This fix has already been merged into oslo.messaging.
--
Cherry-picked from oslo-incubator 234f64d608266f43d8856ff98c89ceba6699d752
See also https://bugzilla.redhat.com/show_bug.cgi?id=1086077
Closes-bug: #1303890
Change-Id: Ic5082b74a362ded8b35cbc75cf178fe6e0db62d0
-rw-r--r-- | ceilometer/openstack/common/rpc/impl_qpid.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ceilometer/openstack/common/rpc/impl_qpid.py b/ceilometer/openstack/common/rpc/impl_qpid.py index a697d911..c7d8852b 100644 --- a/ceilometer/openstack/common/rpc/impl_qpid.py +++ b/ceilometer/openstack/common/rpc/impl_qpid.py @@ -502,7 +502,7 @@ class Connection(object): if self.connection.opened(): try: self.connection.close() - except qpid_exceptions.ConnectionError: + except qpid_exceptions.MessagingError: pass broker = self.brokers[attempt % len(self.brokers)] @@ -511,7 +511,7 @@ class Connection(object): try: self.connection_create(broker) self.connection.open() - except qpid_exceptions.ConnectionError as e: + except qpid_exceptions.MessagingError as e: msg_dict = dict(e=e, delay=delay) msg = _("Unable to connect to AMQP server: %(e)s. " "Sleeping %(delay)s seconds") % msg_dict @@ -539,7 +539,7 @@ class Connection(object): try: return method(*args, **kwargs) except (qpid_exceptions.Empty, - qpid_exceptions.ConnectionError) as e: + qpid_exceptions.MessagingError) as e: if error_callback: error_callback(e) self.reconnect() |