diff options
| author | Mitsuhiko Yamazaki <yamazaki-mitsuhiko@cnt.mxc.nes.nec.co.jp> | 2013-02-12 17:50:06 +0900 |
|---|---|---|
| committer | Mitsuhiko Yamazaki <yamazaki-mitsuhiko@cnt.mxc.nes.nec.co.jp> | 2013-02-21 10:26:41 +0900 |
| commit | 9e53cbbe18e7aa292ed585958f18eda516e2bb84 (patch) | |
| tree | 208d10f8e6aaf24818e7c0208d7f765d13c6b1b7 /nova/api | |
| parent | 4b4781bd5909abdc993b0edff22da407571212f9 (diff) | |
| download | nova-9e53cbbe18e7aa292ed585958f18eda516e2bb84.tar.gz nova-9e53cbbe18e7aa292ed585958f18eda516e2bb84.tar.xz nova-9e53cbbe18e7aa292ed585958f18eda516e2bb84.zip | |
Standardize the coverage initializations.
Now when we measure coverage repeatedly, the coverage data of
nova-api is accumulated but the ones of other nova services are
reset each time.
This is due to create new "coverage" class each time
"_start_coverage_telnet" method is executed.
This patch limits creating "coverage" class the first time
the method is executed.
Fixes bug 1122720
Change-Id: Ia900c96113bee65362ccb7c4c1975535d814d835
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/coverage_ext.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/nova/api/openstack/compute/contrib/coverage_ext.py b/nova/api/openstack/compute/contrib/coverage_ext.py index 6edf9244f..56e174cf6 100644 --- a/nova/api/openstack/compute/contrib/coverage_ext.py +++ b/nova/api/openstack/compute/contrib/coverage_ext.py @@ -109,14 +109,13 @@ class CoverageController(object): return ports def _start_coverage_telnet(self, tn, service): + data_file = os.path.join(self.data_path, + '.nova-coverage.%s' % str(service)) tn.write('import sys\n') tn.write('from coverage import coverage\n') - if self.combine: - data_file = os.path.join(self.data_path, - '.nova-coverage.%s' % str(service)) - tn.write("coverInst = coverage(data_file='%s')\n)" % data_file) - else: - tn.write('coverInst = coverage()\n') + tn.write("coverInst = coverage(data_file='%s') " + "if 'coverInst' not in locals() " + "else coverInst\n" % data_file) tn.write('coverInst.skipModules = sys.modules.keys()\n') tn.write("coverInst.start()\n") tn.write("print 'finished'\n") |
