From 751a395fa92ce11f2b2e9869b6bd69e649e98954 Mon Sep 17 00:00:00 2001 From: ashoksingh Date: Thu, 12 Feb 2015 09:15:06 +0530 Subject: [PATCH] Fix AttributeError exception raised by Nova-compute Add locks to ensure that client object of ContrailVRouterApi is not used while it is being modified. Closes-Bug: #1389157 Change-Id: I42bff175600d61beaff24904cbb86b21543829a1 --- nova_contrail_vif/contrailvif.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nova_contrail_vif/contrailvif.py b/nova_contrail_vif/contrailvif.py index 433352e..51f607f 100644 --- a/nova_contrail_vif/contrailvif.py +++ b/nova_contrail_vif/contrailvif.py @@ -18,6 +18,7 @@ import gettext import threading import time +import eventlet gettext.install('contrail_vif') @@ -110,7 +111,8 @@ class VRouterVIFDriver(LibVirtVIFDriver): def __init__(self, get_connection): super(VRouterVIFDriver, self).__init__(get_connection) - self._vrouter_client = ContrailVRouterApi(doconnect=True) + self._vrouter_semaphore = eventlet.semaphore.Semaphore() + self._vrouter_client = ContrailVRouterApi(doconnect=True, semaphore=self._vrouter_semaphore) timer = loopingcall.FixedIntervalLoopingCall(self._keep_alive) timer.start(interval=2)