From 8e9c038f15f9f3440ed8c430a682d7bdd48f313c Mon Sep 17 00:00:00 2001 From: Masayuki Igawa Date: Fri, 10 Jan 2014 11:43:32 +0900 Subject: [PATCH] Remove the coverage extension code The coverage extension has been removed from Nova V2 API by the I07d798129ee277a6f7691c25f88c07a5204c0943 This commit remove the code. Change-Id: I430a8b17be11bb961dc5b89b2d098f373e0a27fa --- novaclient/tests/v1_1/fakes.py | 18 ------- novaclient/tests/v1_1/test_coverage_ext.py | 43 ---------------- novaclient/tests/v1_1/test_shell.py | 32 ------------ novaclient/v1_1/client.py | 2 - novaclient/v1_1/coverage_ext.py | 60 ---------------------- novaclient/v1_1/shell.py | 43 ---------------- 6 files changed, 198 deletions(-) delete mode 100644 novaclient/tests/v1_1/test_coverage_ext.py delete mode 100644 novaclient/v1_1/coverage_ext.py diff --git a/novaclient/tests/v1_1/fakes.py b/novaclient/tests/v1_1/fakes.py index fbd701298..3ac805884 100644 --- a/novaclient/tests/v1_1/fakes.py +++ b/novaclient/tests/v1_1/fakes.py @@ -1712,14 +1712,6 @@ class FakeHTTPClient(base_client.HTTPClient): } ) - def post_os_coverage_action(self, body, **kw): - if 'report' not in body: - return (200, {}, None) - else: - return (200, {}, { - 'path': '/tmp/tmpdir/' + body['report']['file'] - }) - def post_os_networks_1_action(self, **kw): return (202, {}, None) @@ -1729,16 +1721,6 @@ class FakeHTTPClient(base_client.HTTPClient): def post_os_networks_2_action(self, **kw): return (202, {}, None) - def post_os_coverage_action(self, body, **kw): - if 'start' in body or 'reset' in body: - return (200, {}, None) - elif 'stop' in body: - return (200, {}, {'path': '/tmp/tmpdir/'}) - else: - return (200, {}, { - 'path': '/tmp/tmpdir/' + body['report']['file'] - }) - def get_os_availability_zone(self, **kw): return (200, {}, {"availabilityZoneInfo": [ {"zoneName": "zone-1", diff --git a/novaclient/tests/v1_1/test_coverage_ext.py b/novaclient/tests/v1_1/test_coverage_ext.py deleted file mode 100644 index 8c9870d43..000000000 --- a/novaclient/tests/v1_1/test_coverage_ext.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2012 IBM Corp. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# See: http://wiki.openstack.org/Nova/CoverageExtension for more information -# and usage explanation for this API extension - -from novaclient.tests import utils -from novaclient.tests.v1_1 import fakes - - -cs = fakes.FakeClient() - - -class CoverageTest(utils.TestCase): - - def test_start_coverage(self): - c = cs.coverage.start() - cs.assert_called('POST', '/os-coverage/action') - - def test_stop_coverage(self): - c = cs.coverage.stop() - return_dict = {'path': '/tmp/tmpdir/report'} - cs.assert_called_anytime('POST', '/os-coverage/action') - - def test_report_coverage(self): - c = cs.coverage.report('report') - return_dict = {'path': '/tmp/tmpdir/report'} - cs.assert_called_anytime('POST', '/os-coverage/action') - - def test_reset_coverage(self): - c = cs.coverage.reset() - cs.assert_called_anytime('POST', '/os-coverage/action') diff --git a/novaclient/tests/v1_1/test_shell.py b/novaclient/tests/v1_1/test_shell.py index 61f0f0285..75af786a0 100644 --- a/novaclient/tests/v1_1/test_shell.py +++ b/novaclient/tests/v1_1/test_shell.py @@ -1378,38 +1378,6 @@ class ShellTest(utils.TestCase): self.assert_called('POST', '/servers/uuid4/action', {'migrate': None}, pos=4) - def test_coverage_start(self): - self.run_command('coverage-start') - self.assert_called('POST', '/os-coverage/action') - - def test_coverage_start_with_combine(self): - self.run_command('coverage-start --combine') - body = {'start': {'combine': True}} - self.assert_called('POST', '/os-coverage/action', body) - - def test_coverage_stop(self): - self.run_command('coverage-stop') - self.assert_called_anytime('POST', '/os-coverage/action') - - def test_coverage_report(self): - self.run_command('coverage-report report') - self.assert_called_anytime('POST', '/os-coverage/action') - - def test_coverage_report_with_html(self): - self.run_command('coverage-report report --html') - body = {'report': {'html': True, 'file': 'report'}} - self.assert_called_anytime('POST', '/os-coverage/action', body) - - def test_coverage_report_with_xml(self): - self.run_command('coverage-report report --xml') - body = {'report': {'xml': True, 'file': 'report'}} - self.assert_called_anytime('POST', '/os-coverage/action', body) - - def test_coverage_reset(self): - self.run_command('coverage-reset') - body = {'reset': {}} - self.assert_called_anytime('POST', '/os-coverage/action', body) - def test_hypervisor_list(self): self.run_command('hypervisor-list') self.assert_called('GET', '/os-hypervisors') diff --git a/novaclient/v1_1/client.py b/novaclient/v1_1/client.py index a89581eac..c7e3d65fb 100644 --- a/novaclient/v1_1/client.py +++ b/novaclient/v1_1/client.py @@ -19,7 +19,6 @@ from novaclient.v1_1 import aggregates from novaclient.v1_1 import availability_zones from novaclient.v1_1 import certs from novaclient.v1_1 import cloudpipe -from novaclient.v1_1 import coverage_ext from novaclient.v1_1 import fixed_ips from novaclient.v1_1 import flavor_access from novaclient.v1_1 import flavors @@ -115,7 +114,6 @@ class Client(object): self.fixed_ips = fixed_ips.FixedIPsManager(self) self.floating_ips_bulk = floating_ips_bulk.FloatingIPBulkManager(self) self.os_cache = os_cache or not no_cache - self.coverage = coverage_ext.CoverageManager(self) self.availability_zones = \ availability_zones.AvailabilityZoneManager(self) diff --git a/novaclient/v1_1/coverage_ext.py b/novaclient/v1_1/coverage_ext.py deleted file mode 100644 index 92fc5a880..000000000 --- a/novaclient/v1_1/coverage_ext.py +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright 2012 IBM Corp. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from novaclient import base - - -class Coverage(base.Resource): - def __repr__(self): - return "" % self.name - - -class CoverageManager(base.Manager): - - resource_class = Coverage - - def start(self, combine=False, **kwargs): - body = {'start': {}} - if combine: - body['start'] = {'combine': True} - self.run_hooks('modify_body_for_action', body) - url = '/os-coverage/action' - return self.api.client.post(url, body=body) - - def stop(self): - body = {'stop': {}} - self.run_hooks('modify_body_for_action', body) - url = '/os-coverage/action' - return self.api.client.post(url, body=body) - - def report(self, filename, xml=False, html=False): - body = { - 'report': { - 'file': filename, - } - } - if xml: - body['report']['xml'] = True - elif html: - body['report']['html'] = True - self.run_hooks('modify_body_for_action', body) - url = '/os-coverage/action' - return self.api.client.post(url, body=body) - - def reset(self): - body = {'reset': {}} - self.run_hooks('modify_body_for_action', body) - url = '/os-coverage/action' - return self.api.client.post(url, body=body) diff --git a/novaclient/v1_1/shell.py b/novaclient/v1_1/shell.py index d83a01447..07c62d6cd 100644 --- a/novaclient/v1_1/shell.py +++ b/novaclient/v1_1/shell.py @@ -2911,49 +2911,6 @@ def do_host_action(cs, args): utils.print_list([result], ['HOST', 'power_action']) -@utils.arg('--combine', - dest='combine', - action="store_true", - default=False, - help='Generate a single report for all services.') -def do_coverage_start(cs, args): - """Start Nova coverage reporting.""" - cs.coverage.start(combine=args.combine) - print("Coverage collection started") - - -def do_coverage_stop(cs, args): - """Stop Nova coverage reporting.""" - out = cs.coverage.stop() - print("Coverage data file path: %s" % out[-1]['path']) - - -@utils.arg('filename', metavar='', help='report filename') -@utils.arg('--html', - dest='html', - action="store_true", - default=False, - help='Generate HTML reports instead of text ones.') -@utils.arg('--xml', - dest='xml', - action="store_true", - default=False, - help='Generate XML reports instead of text ones.') -def do_coverage_report(cs, args): - """Generate coverage report.""" - if args.html is True and args.xml is True: - raise exceptions.CommandError("--html and --xml must not be " - "specified together.") - cov = cs.coverage.report(args.filename, xml=args.xml, html=args.html) - print("Report path: %s" % cov[-1]['path']) - - -def do_coverage_reset(cs, args): - """Reset coverage data.""" - cs.coverage.reset() - print("Coverage data reset") - - def _find_hypervisor(cs, hypervisor): """Get a hypervisor by name or ID.""" return utils.find_resource(cs.hypervisors, hypervisor)