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
This commit is contained in:
Masayuki Igawa 2014-01-10 11:43:32 +09:00
parent 1a20d2964d
commit 8e9c038f15
6 changed files with 0 additions and 198 deletions

View File

@ -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",

View File

@ -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')

View File

@ -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')

View File

@ -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)

View File

@ -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 "<Coverage: %s>" % 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)

View File

@ -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='<filename>', 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)