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
This commit is contained in:
Kobi Samoray 2016-07-27 15:01:43 +03:00
parent 91fecee67c
commit 1ef09c105c

View File

@ -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):