diff options
| author | Mitsuhiko Yamazaki <yamazaki-mitsuhiko@cnt.mxc.nes.nec.co.jp> | 2013-03-08 17:01:09 +0900 |
|---|---|---|
| committer | Mitsuhiko Yamazaki <yamazaki-mitsuhiko@cnt.mxc.nes.nec.co.jp> | 2013-03-11 09:00:11 +0900 |
| commit | ef4f75b088b09d4ed86ff02bb69cd4046cccb3f6 (patch) | |
| tree | a7b8124ea8a1004f90091e4c1746f5e2813a7727 /nova/api | |
| parent | 92482459963e21cb692c0515450abc81d69e40ed (diff) | |
| download | nova-ef4f75b088b09d4ed86ff02bb69cd4046cccb3f6.tar.gz nova-ef4f75b088b09d4ed86ff02bb69cd4046cccb3f6.tar.xz nova-ef4f75b088b09d4ed86ff02bb69cd4046cccb3f6.zip | |
Prevent nova services' coverage data from combining into nova-api's
Now if combining a coverage report once, nova services' coverage
data are combined into nova-api's.
This renames nova-api coverage datafile to .nova-coverage.api and
creates a new coverage instance to combine when reporting.
Fixes bug: 1152475
Change-Id: I90b6535d490cf0123a127f8752986edd782ef37e
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/coverage_ext.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/nova/api/openstack/compute/contrib/coverage_ext.py b/nova/api/openstack/compute/contrib/coverage_ext.py index bafb6711e..ad30987ff 100644 --- a/nova/api/openstack/compute/contrib/coverage_ext.py +++ b/nova/api/openstack/compute/contrib/coverage_ext.py @@ -66,7 +66,7 @@ class CoverageController(object): if not self._cover_inst: try: import coverage - data_out = os.path.join(self.data_path, '.nova-coverage') + data_out = os.path.join(self.data_path, '.nova-coverage.api') self._cover_inst = coverage.coverage(data_file=data_out) except ImportError: pass @@ -224,17 +224,20 @@ class CoverageController(object): html = body['html'] if self.combine: - self.coverInst.combine() + data_out = os.path.join(self.data_path, '.nova-coverage') + import coverage + coverInst = coverage.coverage(data_file=data_out) + coverInst.combine() if xml: - self.coverInst.xml_report(outfile=path) + coverInst.xml_report(outfile=path) elif html: if os.path.isdir(path): msg = _("Directory conflict: %s already exists") raise exc.HTTPBadRequest(explanation=msg) - self.coverInst.html_report(directory=path) + coverInst.html_report(directory=path) else: output = open(path, 'w') - self.coverInst.report(file=output) + coverInst.report(file=output) output.close() for service in self.services: service['telnet'].close() |
