Skip to content

Commit

Permalink
[VNC config] Don't close AMQP consumer
Browse files Browse the repository at this point in the history
Don't close the AMQP producers or conusmers, just delete queue and
then close the AMQP connection.

Change-Id: I0efe52f889f0892b4a5e4336b39fa30062b08034
Closes-Bug: #1713899
(cherry picked from commit 51f6487)
  • Loading branch information
Édouard Thuleau committed Sep 4, 2017
1 parent 91ce823 commit 586903f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 30 deletions.
6 changes: 2 additions & 4 deletions src/config/common/vnc_kombu.py
Expand Up @@ -12,7 +12,7 @@
from gevent.queue import Queue
try:
from gevent.lock import Semaphore
except ImportError:
except ImportError:
# older versions of gevent
from gevent.coros import Semaphore

Expand Down Expand Up @@ -77,7 +77,7 @@ def _reconnect(self, delete_old_q=False):
if self._conn_lock.locked():
# either connection-monitor or publisher should have taken
# the lock. The one who acquired the lock would re-establish
# the connection and releases the lock, so the other one can
# the connection and releases the lock, so the other one can
# just wait on the lock, till it gets released
self._conn_lock.wait()
if self._conn_state == ConnectionStatus.UP:
Expand Down Expand Up @@ -229,9 +229,7 @@ def shutdown(self):
self._connection_monitor_greenlet.kill()
if self._connection_heartbeat_greenlet:
self._connection_heartbeat_greenlet.kill()
self._producer.close()
if self._consumer:
self._consumer.close()
self._delete_queue()
self._conn.close()

Expand Down
12 changes: 4 additions & 8 deletions src/config/device-manager/device_manager/device_manager.py
Expand Up @@ -492,14 +492,10 @@ def main(args_str=None):

# Initialize AMQP handler then close it to be sure remain queue of a
# precedent run is cleaned
try:
vnc_amqp = DMAmqpHandle(dm_logger, DeviceManager.REACTION_MAP, args)
vnc_amqp.establish()
vnc_amqp.close()
except Exception:
pass
finally:
dm_logger.debug("Removed remained AMQP queue")
vnc_amqp = DMAmqpHandle(dm_logger, DeviceManager.REACTION_MAP, args)
vnc_amqp.establish()
vnc_amqp.close()
dm_logger.debug("Removed remained AMQP queue")

_zookeeper_client = ZookeeperClient(client_pfx+"device-manager",
args.zk_server_ip)
Expand Down
13 changes: 4 additions & 9 deletions src/config/schema-transformer/to_bgp.py
Expand Up @@ -453,7 +453,6 @@ def parse_args(args_str):
if 'CASSANDRA' in config.sections():
cassandraopts.update(dict(config.items('CASSANDRA')))


# Override with CLI options
# Don't surpress add_help here so it will handle -h
parser = argparse.ArgumentParser(
Expand Down Expand Up @@ -632,14 +631,10 @@ def main(args_str=None):

# Initialize AMQP handler then close it to be sure remain queue of a
# precedent run is cleaned
try:
vnc_amqp = STAmqpHandle(st_logger, SchemaTransformer.REACTION_MAP, args)
vnc_amqp.establish()
vnc_amqp.close()
except Exception:
pass
finally:
st_logger.debug("Removed remained AMQP queue")
vnc_amqp = STAmqpHandle(st_logger, SchemaTransformer.REACTION_MAP, args)
vnc_amqp.establish()
vnc_amqp.close()
st_logger.debug("Removed remained AMQP queue")

# Waiting to be elected as master node
_zookeeper_client = ZookeeperClient(client_pfx+"schema", args.zk_server_ip,
Expand Down
14 changes: 5 additions & 9 deletions src/config/svc-monitor/svc_monitor/svc_monitor.py
Expand Up @@ -901,15 +901,11 @@ def main(args_str=None):

# Initialize AMQP handler then close it to be sure remain queue of a
# precedent run is cleaned
try:
vnc_amqp = VncAmqpHandle(sm_logger, DBBaseSM, REACTION_MAP, 'svc_monitor',
args=args)
vnc_amqp.establish()
vnc_amqp.close()
except Exception:
pass
finally:
sm_logger.debug("Removed remained AMQP queue")
vnc_amqp = VncAmqpHandle(sm_logger, DBBaseSM, REACTION_MAP, 'svc_monitor',
args=args)
vnc_amqp.establish()
vnc_amqp.close()
sm_logger.debug("Removed remained AMQP queue")

# Waiting to be elected as master node
_zookeeper_client = ZookeeperClient(
Expand Down

0 comments on commit 586903f

Please sign in to comment.