From 1ef09c105c8b56b7c663ce904c8241e254336272 Mon Sep 17 00:00:00 2001 From: Kobi Samoray Date: Wed, 27 Jul 2016 15:01:43 +0300 Subject: [PATCH] NSXv - log the call stack while locking Having the call stack while locking successully will help with troubleshooting deadlocks and locking issues. Change-Id: I2c431e66c5ea6a05197e3f9a33831ee6b4bae42d --- vmware_nsx/common/locking.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vmware_nsx/common/locking.py b/vmware_nsx/common/locking.py index a221dead3e..b29848bf4f 100644 --- a/vmware_nsx/common/locking.py +++ b/vmware_nsx/common/locking.py @@ -14,6 +14,7 @@ # under the License. import os +import traceback from oslo_concurrency import lockutils from oslo_config import cfg @@ -34,11 +35,17 @@ class LockManager(object): @staticmethod def get_lock(name, **kwargs): if cfg.CONF.locking_coordinator_url: - return LockManager._get_lock_distributed(name) + lck = LockManager._get_lock_distributed(name) + LOG.debug('Lock %s taken with traceback %s', name, + traceback.extract_stack()) + return lck else: # Ensure that external=True kwargs['external'] = True - return LockManager._get_lock_local(name, **kwargs) + lck = LockManager._get_lock_local(name, **kwargs) + LOG.debug('Lock %s taken with traceback %s', name, + traceback.extract_stack()) + return lck @staticmethod def _get_lock_local(name, **kwargs):