NSXv: ensure per process task manager

When a metadata proxy is created the task manager will be created.
This will cause corruption of the per process task manager.

Change-Id: I9e281c26ca48d83d6b82e5b627b5dd7041171e1b
Closes-bug: #1487167
This commit is contained in:
Gary Kotton 2015-08-20 09:19:19 -07:00
parent 461a1b75fc
commit d742705ace
1 changed files with 6 additions and 1 deletions

View File

@ -14,6 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
from oslo_config import cfg
from oslo_log import log as logging
@ -43,13 +45,16 @@ class VcnsDriver(edge_appliance_driver.EdgeApplianceDriver,
self.resource_pool_id = cfg.CONF.nsxv.resource_pool_id
self.datastore_id = cfg.CONF.nsxv.datastore_id
self.external_network = cfg.CONF.nsxv.external_network
self._pid = None
self._task_manager = None
self.vcns = vcns.Vcns(self.vcns_uri, self.vcns_user, self.vcns_passwd)
@property
def task_manager(self):
if self._task_manager is None:
if (self._task_manager is None or
self._pid != os.getpid()):
LOG.debug("Creating task manager")
self._pid = os.getpid()
interval = cfg.CONF.nsxv.task_status_check_interval
self._task_manager = tasks.TaskManager(interval)
LOG.debug("Starting task manager")