Merge "NSXv: ensure per process task manager"

This commit is contained in:
Jenkins 2015-08-27 16:32:35 +00:00 committed by Gerrit Code Review
commit 750d72c09f

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
@ -45,14 +47,17 @@ 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,
self.ca_file, self.insecure)
@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")