From b6e072a84a31eca1f7d7c44117327c5042e153c2 Mon Sep 17 00:00:00 2001 From: Yang Yu Date: Wed, 17 Apr 2013 18:11:02 +0800 Subject: nova coverage creates lots of empty folders With nova coverage extension disabled as a default behaviour, nova will create lots of empty folders under /tmp folder. And also with each time the nova service reboot, it will create a new directory with name like nova_coverage_*. There will be number of the empty folders accumulated. Patch-Set 3: Rebase for merging code Fixes: bug 1169005 Change-Id: I26d1037eb66d781ac6ef6b600cca04a709bff3f7 --- nova/api/openstack/compute/contrib/coverage_ext.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/coverage_ext.py b/nova/api/openstack/compute/contrib/coverage_ext.py index 50003bdab..154699470 100644 --- a/nova/api/openstack/compute/contrib/coverage_ext.py +++ b/nova/api/openstack/compute/contrib/coverage_ext.py @@ -42,7 +42,7 @@ CONF = cfg.CONF class CoverageController(object): """The Coverage report API controller for the OpenStack API.""" def __init__(self): - self.data_path = tempfile.mkdtemp(prefix='nova-coverage_') + self.data_path = None self.services = [] self.combine = False self._cover_inst = None @@ -54,6 +54,8 @@ class CoverageController(object): if not self._cover_inst: try: import coverage + if self.data_path is None: + self.data_path = tempfile.mkdtemp(prefix='nova-coverage_') data_out = os.path.join(self.data_path, '.nova-coverage.api') self._cover_inst = coverage.coverage(data_file=data_out) except ImportError: -- cgit