summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-17 06:22:08 +0000
committerGerrit Code Review <review@openstack.org>2017-06-17 06:22:08 +0000
commit1a1dc6fc96bd1ef3ae6186dd13d5516e4e28442d (patch)
treec0d76a8d7e92402d2f9cdc9dd07155286cbb73ac
parente82d0fe5c06ef6460069aca4710efcb709ad8ba8 (diff)
parentd84016c8ff64619b00d4d94d33c9ae15b830a05b (diff)
Merge "NSXv3: Race condition fix for cert provider"
-rw-r--r--vmware_nsx/plugins/nsx_v3/utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/vmware_nsx/plugins/nsx_v3/utils.py b/vmware_nsx/plugins/nsx_v3/utils.py
index 5b46008..b7ec705 100644
--- a/vmware_nsx/plugins/nsx_v3/utils.py
+++ b/vmware_nsx/plugins/nsx_v3/utils.py
@@ -53,7 +53,11 @@ class DbCertProvider(client_cert.ClientCertProvider):
53 # Such collisions are handled with refcount and locking. 53 # Such collisions are handled with refcount and locking.
54 super(DbCertProvider, self).__init__(None) 54 super(DbCertProvider, self).__init__(None)
55 random.seed() 55 random.seed()
56 self.refcount = 0 56
57 with self.lock:
58 # Initialize refcount if other threads did not do it already
59 if not hasattr(self, 'refcount'):
60 self.refcount = 0
57 61
58 def _check_expiration(self, expires_in_days): 62 def _check_expiration(self, expires_in_days):
59 if expires_in_days > self.EXPIRATION_ALERT_DAYS: 63 if expires_in_days > self.EXPIRATION_ALERT_DAYS: