Fix and enable gating on H401
H401 docstring should not start with a space Change-Id: Iaf63af75b0534cae1bac3c931ef5f51f1644aec9
This commit is contained in:
parent
0c15581516
commit
a4817b30a4
@ -51,7 +51,7 @@ class VolumeTypeExtraSpecTemplate(xmlutil.TemplateBuilder):
|
||||
|
||||
|
||||
class VolumeTypeExtraSpecsController(wsgi.Controller):
|
||||
""" The volume type extra specs API controller for the OpenStack API """
|
||||
"""The volume type extra specs API controller for the OpenStack API."""
|
||||
|
||||
def _get_extra_specs(self, context, type_id):
|
||||
extra_specs = db.volume_type_extra_specs_get(context, type_id)
|
||||
@ -68,7 +68,7 @@ class VolumeTypeExtraSpecsController(wsgi.Controller):
|
||||
|
||||
@wsgi.serializers(xml=VolumeTypeExtraSpecsTemplate)
|
||||
def index(self, req, type_id):
|
||||
""" Returns the list of extra specs for a given volume type """
|
||||
"""Returns the list of extra specs for a given volume type."""
|
||||
context = req.environ['cinder.context']
|
||||
authorize(context)
|
||||
self._check_type(context, type_id)
|
||||
@ -130,7 +130,7 @@ class VolumeTypeExtraSpecsController(wsgi.Controller):
|
||||
raise webob.exc.HTTPNotFound()
|
||||
|
||||
def delete(self, req, type_id, id):
|
||||
""" Deletes an existing extra spec """
|
||||
"""Deletes an existing extra spec."""
|
||||
context = req.environ['cinder.context']
|
||||
self._check_type(context, type_id)
|
||||
authorize(context)
|
||||
|
@ -97,7 +97,7 @@ class AcceptDeserializer(wsgi.MetadataXMLDeserializer):
|
||||
|
||||
|
||||
class VolumeTransferController(wsgi.Controller):
|
||||
""" The Volume Transfer API controller for the Openstack API."""
|
||||
"""The Volume Transfer API controller for the Openstack API."""
|
||||
|
||||
_view_builder_class = transfer_view.ViewBuilder
|
||||
|
||||
|
@ -25,7 +25,7 @@ from webob import exc
|
||||
|
||||
|
||||
class Controller(object):
|
||||
""" The volume metadata API controller for the OpenStack API """
|
||||
"""The volume metadata API controller for the OpenStack API."""
|
||||
|
||||
def __init__(self):
|
||||
self.volume_api = volume.API()
|
||||
@ -42,7 +42,7 @@ class Controller(object):
|
||||
|
||||
@wsgi.serializers(xml=common.MetadataTemplate)
|
||||
def index(self, req, snapshot_id):
|
||||
""" Returns the list of metadata for a given snapshot"""
|
||||
"""Returns the list of metadata for a given snapshot."""
|
||||
context = req.environ['cinder.context']
|
||||
return {'metadata': self._get_metadata(context, snapshot_id)}
|
||||
|
||||
@ -131,7 +131,7 @@ class Controller(object):
|
||||
|
||||
@wsgi.serializers(xml=common.MetaItemTemplate)
|
||||
def show(self, req, snapshot_id, id):
|
||||
""" Return a single metadata item """
|
||||
"""Return a single metadata item."""
|
||||
context = req.environ['cinder.context']
|
||||
data = self._get_metadata(context, snapshot_id)
|
||||
|
||||
@ -142,7 +142,7 @@ class Controller(object):
|
||||
raise exc.HTTPNotFound(explanation=msg)
|
||||
|
||||
def delete(self, req, snapshot_id, id):
|
||||
""" Deletes an existing metadata """
|
||||
"""Deletes an existing metadata."""
|
||||
context = req.environ['cinder.context']
|
||||
|
||||
metadata = self._get_metadata(context, snapshot_id)
|
||||
|
@ -25,7 +25,7 @@ from webob import exc
|
||||
|
||||
|
||||
class Controller(object):
|
||||
""" The volume metadata API controller for the OpenStack API """
|
||||
"""The volume metadata API controller for the OpenStack API."""
|
||||
|
||||
def __init__(self):
|
||||
self.volume_api = volume.API()
|
||||
@ -42,7 +42,7 @@ class Controller(object):
|
||||
|
||||
@wsgi.serializers(xml=common.MetadataTemplate)
|
||||
def index(self, req, volume_id):
|
||||
""" Returns the list of metadata for a given volume"""
|
||||
"""Returns the list of metadata for a given volume."""
|
||||
context = req.environ['cinder.context']
|
||||
return {'metadata': self._get_metadata(context, volume_id)}
|
||||
|
||||
@ -131,7 +131,7 @@ class Controller(object):
|
||||
|
||||
@wsgi.serializers(xml=common.MetaItemTemplate)
|
||||
def show(self, req, volume_id, id):
|
||||
""" Return a single metadata item """
|
||||
"""Return a single metadata item."""
|
||||
context = req.environ['cinder.context']
|
||||
data = self._get_metadata(context, volume_id)
|
||||
|
||||
@ -142,7 +142,7 @@ class Controller(object):
|
||||
raise exc.HTTPNotFound(explanation=msg)
|
||||
|
||||
def delete(self, req, volume_id, id):
|
||||
""" Deletes an existing metadata """
|
||||
"""Deletes an existing metadata."""
|
||||
context = req.environ['cinder.context']
|
||||
|
||||
metadata = self._get_metadata(context, volume_id)
|
||||
|
@ -25,7 +25,7 @@ from webob import exc
|
||||
|
||||
|
||||
class Controller(object):
|
||||
""" The volume metadata API controller for the OpenStack API """
|
||||
"""The volume metadata API controller for the OpenStack API."""
|
||||
|
||||
def __init__(self):
|
||||
self.volume_api = volume.API()
|
||||
@ -42,7 +42,7 @@ class Controller(object):
|
||||
|
||||
@wsgi.serializers(xml=common.MetadataTemplate)
|
||||
def index(self, req, snapshot_id):
|
||||
""" Returns the list of metadata for a given snapshot"""
|
||||
"""Returns the list of metadata for a given snapshot."""
|
||||
context = req.environ['cinder.context']
|
||||
return {'metadata': self._get_metadata(context, snapshot_id)}
|
||||
|
||||
@ -131,7 +131,7 @@ class Controller(object):
|
||||
|
||||
@wsgi.serializers(xml=common.MetaItemTemplate)
|
||||
def show(self, req, snapshot_id, id):
|
||||
""" Return a single metadata item """
|
||||
"""Return a single metadata item."""
|
||||
context = req.environ['cinder.context']
|
||||
data = self._get_metadata(context, snapshot_id)
|
||||
|
||||
@ -142,7 +142,7 @@ class Controller(object):
|
||||
raise exc.HTTPNotFound(explanation=msg)
|
||||
|
||||
def delete(self, req, snapshot_id, id):
|
||||
""" Deletes an existing metadata """
|
||||
"""Deletes an existing metadata."""
|
||||
context = req.environ['cinder.context']
|
||||
|
||||
metadata = self._get_metadata(context, snapshot_id)
|
||||
|
@ -38,7 +38,7 @@ class LimiterTest(test.TestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
""" Run before each test. """
|
||||
"""Run before each test."""
|
||||
super(LimiterTest, self).setUp()
|
||||
self.tiny = range(1)
|
||||
self.small = range(10)
|
||||
@ -46,7 +46,7 @@ class LimiterTest(test.TestCase):
|
||||
self.large = range(10000)
|
||||
|
||||
def test_limiter_offset_zero(self):
|
||||
""" Test offset key works with 0. """
|
||||
"""Test offset key works with 0."""
|
||||
req = webob.Request.blank('/?offset=0')
|
||||
self.assertEqual(common.limited(self.tiny, req), self.tiny)
|
||||
self.assertEqual(common.limited(self.small, req), self.small)
|
||||
@ -54,7 +54,7 @@ class LimiterTest(test.TestCase):
|
||||
self.assertEqual(common.limited(self.large, req), self.large[:1000])
|
||||
|
||||
def test_limiter_offset_medium(self):
|
||||
""" Test offset key works with a medium sized number. """
|
||||
"""Test offset key works with a medium sized number."""
|
||||
req = webob.Request.blank('/?offset=10')
|
||||
self.assertEqual(common.limited(self.tiny, req), [])
|
||||
self.assertEqual(common.limited(self.small, req), self.small[10:])
|
||||
@ -62,7 +62,7 @@ class LimiterTest(test.TestCase):
|
||||
self.assertEqual(common.limited(self.large, req), self.large[10:1010])
|
||||
|
||||
def test_limiter_offset_over_max(self):
|
||||
""" Test offset key works with a number over 1000 (max_limit). """
|
||||
"""Test offset key works with a number over 1000 (max_limit)."""
|
||||
req = webob.Request.blank('/?offset=1001')
|
||||
self.assertEqual(common.limited(self.tiny, req), [])
|
||||
self.assertEqual(common.limited(self.small, req), [])
|
||||
@ -71,19 +71,19 @@ class LimiterTest(test.TestCase):
|
||||
common.limited(self.large, req), self.large[1001:2001])
|
||||
|
||||
def test_limiter_offset_blank(self):
|
||||
""" Test offset key works with a blank offset. """
|
||||
"""Test offset key works with a blank offset."""
|
||||
req = webob.Request.blank('/?offset=')
|
||||
self.assertRaises(
|
||||
webob.exc.HTTPBadRequest, common.limited, self.tiny, req)
|
||||
|
||||
def test_limiter_offset_bad(self):
|
||||
""" Test offset key works with a BAD offset. """
|
||||
"""Test offset key works with a BAD offset."""
|
||||
req = webob.Request.blank(u'/?offset=\u0020aa')
|
||||
self.assertRaises(
|
||||
webob.exc.HTTPBadRequest, common.limited, self.tiny, req)
|
||||
|
||||
def test_limiter_nothing(self):
|
||||
""" Test request with no offset or limit """
|
||||
"""Test request with no offset or limit."""
|
||||
req = webob.Request.blank('/')
|
||||
self.assertEqual(common.limited(self.tiny, req), self.tiny)
|
||||
self.assertEqual(common.limited(self.small, req), self.small)
|
||||
@ -91,7 +91,7 @@ class LimiterTest(test.TestCase):
|
||||
self.assertEqual(common.limited(self.large, req), self.large[:1000])
|
||||
|
||||
def test_limiter_limit_zero(self):
|
||||
""" Test limit of zero. """
|
||||
"""Test limit of zero."""
|
||||
req = webob.Request.blank('/?limit=0')
|
||||
self.assertEqual(common.limited(self.tiny, req), self.tiny)
|
||||
self.assertEqual(common.limited(self.small, req), self.small)
|
||||
@ -99,13 +99,13 @@ class LimiterTest(test.TestCase):
|
||||
self.assertEqual(common.limited(self.large, req), self.large[:1000])
|
||||
|
||||
def test_limiter_limit_bad(self):
|
||||
""" Test with a bad limit. """
|
||||
"""Test with a bad limit."""
|
||||
req = webob.Request.blank(u'/?limit=hello')
|
||||
self.assertRaises(
|
||||
webob.exc.HTTPBadRequest, common.limited, self.tiny, req)
|
||||
|
||||
def test_limiter_limit_medium(self):
|
||||
""" Test limit of 10. """
|
||||
"""Test limit of 10."""
|
||||
req = webob.Request.blank('/?limit=10')
|
||||
self.assertEqual(common.limited(self.tiny, req), self.tiny)
|
||||
self.assertEqual(common.limited(self.small, req), self.small)
|
||||
@ -113,7 +113,7 @@ class LimiterTest(test.TestCase):
|
||||
self.assertEqual(common.limited(self.large, req), self.large[:10])
|
||||
|
||||
def test_limiter_limit_over_max(self):
|
||||
""" Test limit of 3000. """
|
||||
"""Test limit of 3000."""
|
||||
req = webob.Request.blank('/?limit=3000')
|
||||
self.assertEqual(common.limited(self.tiny, req), self.tiny)
|
||||
self.assertEqual(common.limited(self.small, req), self.small)
|
||||
@ -121,7 +121,7 @@ class LimiterTest(test.TestCase):
|
||||
self.assertEqual(common.limited(self.large, req), self.large[:1000])
|
||||
|
||||
def test_limiter_limit_and_offset(self):
|
||||
""" Test request with both limit and offset. """
|
||||
"""Test request with both limit and offset."""
|
||||
items = range(2000)
|
||||
req = webob.Request.blank('/?offset=1&limit=3')
|
||||
self.assertEqual(common.limited(items, req), items[1:4])
|
||||
@ -133,7 +133,7 @@ class LimiterTest(test.TestCase):
|
||||
self.assertEqual(common.limited(items, req), [])
|
||||
|
||||
def test_limiter_custom_max_limit(self):
|
||||
""" Test a max_limit other than 1000. """
|
||||
"""Test a max_limit other than 1000."""
|
||||
items = range(2000)
|
||||
req = webob.Request.blank('/?offset=1&limit=3')
|
||||
self.assertEqual(
|
||||
@ -148,13 +148,13 @@ class LimiterTest(test.TestCase):
|
||||
self.assertEqual(common.limited(items, req, max_limit=2000), [])
|
||||
|
||||
def test_limiter_negative_limit(self):
|
||||
""" Test a negative limit. """
|
||||
"""Test a negative limit."""
|
||||
req = webob.Request.blank('/?limit=-3000')
|
||||
self.assertRaises(
|
||||
webob.exc.HTTPBadRequest, common.limited, self.tiny, req)
|
||||
|
||||
def test_limiter_negative_offset(self):
|
||||
""" Test a negative offset. """
|
||||
"""Test a negative offset."""
|
||||
req = webob.Request.blank('/?offset=-30')
|
||||
self.assertRaises(
|
||||
webob.exc.HTTPBadRequest, common.limited, self.tiny, req)
|
||||
@ -168,36 +168,36 @@ class PaginationParamsTest(test.TestCase):
|
||||
"""
|
||||
|
||||
def test_nonnumerical_limit(self):
|
||||
""" Test nonnumerical limit param. """
|
||||
"""Test nonnumerical limit param."""
|
||||
req = webob.Request.blank('/?limit=hello')
|
||||
self.assertRaises(
|
||||
webob.exc.HTTPBadRequest, common.get_pagination_params, req)
|
||||
|
||||
def test_no_params(self):
|
||||
""" Test no params. """
|
||||
"""Test no params."""
|
||||
req = webob.Request.blank('/')
|
||||
self.assertEqual(common.get_pagination_params(req), {})
|
||||
|
||||
def test_valid_marker(self):
|
||||
""" Test valid marker param. """
|
||||
"""Test valid marker param."""
|
||||
req = webob.Request.blank(
|
||||
'/?marker=263abb28-1de6-412f-b00b-f0ee0c4333c2')
|
||||
self.assertEqual(common.get_pagination_params(req),
|
||||
{'marker': '263abb28-1de6-412f-b00b-f0ee0c4333c2'})
|
||||
|
||||
def test_valid_limit(self):
|
||||
""" Test valid limit param. """
|
||||
"""Test valid limit param."""
|
||||
req = webob.Request.blank('/?limit=10')
|
||||
self.assertEqual(common.get_pagination_params(req), {'limit': 10})
|
||||
|
||||
def test_invalid_limit(self):
|
||||
""" Test invalid limit param. """
|
||||
"""Test invalid limit param."""
|
||||
req = webob.Request.blank('/?limit=-2')
|
||||
self.assertRaises(
|
||||
webob.exc.HTTPBadRequest, common.get_pagination_params, req)
|
||||
|
||||
def test_valid_limit_and_marker(self):
|
||||
""" Test valid limit and marker parameters. """
|
||||
"""Test valid limit and marker parameters."""
|
||||
marker = '263abb28-1de6-412f-b00b-f0ee0c4333c2'
|
||||
req = webob.Request.blank('/?limit=20&marker=%s' % marker)
|
||||
self.assertEqual(common.get_pagination_params(req),
|
||||
|
@ -1304,7 +1304,7 @@ class DriverTestCase(test.TestCase):
|
||||
return 1
|
||||
|
||||
def _attach_volume(self):
|
||||
"""Attach volumes to an instance. """
|
||||
"""Attach volumes to an instance."""
|
||||
return []
|
||||
|
||||
def _detach_volume(self, volume_id_list):
|
||||
@ -1341,7 +1341,7 @@ class ISCSITestCase(DriverTestCase):
|
||||
driver_name = "cinder.volume.drivers.lvm.LVMISCSIDriver"
|
||||
|
||||
def _attach_volume(self):
|
||||
"""Attach volumes to an instance. """
|
||||
"""Attach volumes to an instance."""
|
||||
volume_id_list = []
|
||||
for index in xrange(3):
|
||||
vol = {}
|
||||
|
@ -699,7 +699,7 @@ def check_isinstance(obj, cls):
|
||||
|
||||
|
||||
def is_valid_boolstr(val):
|
||||
"""Check if the provided string is a valid bool string or not. """
|
||||
"""Check if the provided string is a valid bool string or not."""
|
||||
val = str(val).lower()
|
||||
return (val == 'true' or val == 'false' or
|
||||
val == 'yes' or val == 'no' or
|
||||
@ -724,9 +724,10 @@ def is_valid_ipv4(address):
|
||||
|
||||
|
||||
def monkey_patch():
|
||||
""" If the CONF.monkey_patch set as True,
|
||||
"""If the CONF.monkey_patch set as True,
|
||||
this function patches a decorator
|
||||
for all functions in specified modules.
|
||||
|
||||
You can set decorators for each modules
|
||||
using CONF.monkey_patch_modules.
|
||||
The format is "Module path:Decorator function".
|
||||
|
@ -163,11 +163,11 @@ class VolumeDriver(object):
|
||||
raise NotImplementedError()
|
||||
|
||||
def attach_volume(self, context, volume_id, instance_uuid, mountpoint):
|
||||
""" Callback for volume attached to instance."""
|
||||
"""Callback for volume attached to instance."""
|
||||
pass
|
||||
|
||||
def detach_volume(self, context, volume_id):
|
||||
""" Callback for volume detached."""
|
||||
"""Callback for volume detached."""
|
||||
pass
|
||||
|
||||
def get_volume_stats(self, refresh=False):
|
||||
|
@ -221,7 +221,7 @@ class HP3PARCommon(object):
|
||||
return capacity
|
||||
|
||||
def _cli_run(self, verb, cli_args):
|
||||
""" Runs a CLI command over SSH, without doing any result parsing. """
|
||||
"""Runs a CLI command over SSH, without doing any result parsing."""
|
||||
cli_arg_strings = []
|
||||
if cli_args:
|
||||
for k, v in cli_args.items():
|
||||
@ -827,7 +827,7 @@ exit
|
||||
return showhost.split(',')[1]
|
||||
|
||||
def terminate_connection(self, volume, hostname, wwn_iqn):
|
||||
""" Driver entry point to unattach a volume from an instance."""
|
||||
"""Driver entry point to unattach a volume from an instance."""
|
||||
try:
|
||||
# does 3par know this host by a different name?
|
||||
if hostname in self.hosts_naming_dict:
|
||||
|
@ -102,7 +102,7 @@ class HP3PARISCSIDriver(cinder.volume.driver.ISCSIDriver):
|
||||
|
||||
@utils.synchronized('3par', external=True)
|
||||
def create_cloned_volume(self, volume, src_vref):
|
||||
""" Clone an existing volume. """
|
||||
"""Clone an existing volume."""
|
||||
self.common.client_login()
|
||||
new_vol = self.common.create_cloned_volume(volume, src_vref)
|
||||
self.common.client_logout()
|
||||
|
@ -209,11 +209,11 @@ class ScalityDriver(driver.VolumeDriver):
|
||||
pass
|
||||
|
||||
def attach_volume(self, context, volume_id, instance_uuid, mountpoint):
|
||||
""" Callback for volume attached to instance."""
|
||||
"""Callback for volume attached to instance."""
|
||||
pass
|
||||
|
||||
def detach_volume(self, context, volume_id):
|
||||
""" Callback for volume detached."""
|
||||
"""Callback for volume detached."""
|
||||
pass
|
||||
|
||||
def get_volume_stats(self, refresh=False):
|
||||
|
@ -609,7 +609,7 @@ class VolumeManager(manager.SchedulerDependentManager):
|
||||
self.driver.ensure_export(context, volume_ref)
|
||||
|
||||
def _copy_image_to_volume(self, context, volume, image_service, image_id):
|
||||
"""Downloads Glance image to the specified volume. """
|
||||
"""Downloads Glance image to the specified volume."""
|
||||
volume_id = volume['id']
|
||||
try:
|
||||
self.driver.copy_image_to_volume(context, volume,
|
||||
@ -721,7 +721,7 @@ class VolumeManager(manager.SchedulerDependentManager):
|
||||
self.update_service_capabilities(volume_stats)
|
||||
|
||||
def publish_service_capabilities(self, context):
|
||||
""" Collect driver status and then publish """
|
||||
"""Collect driver status and then publish."""
|
||||
self._report_driver_status(context)
|
||||
self._publish_service_capabilities(context)
|
||||
|
||||
|
@ -39,11 +39,11 @@ def get_host_from_queue(queuename):
|
||||
|
||||
|
||||
def notify_usage_exists(context, volume_ref, current_period=False):
|
||||
""" Generates 'exists' notification for a volume for usage auditing
|
||||
purposes.
|
||||
"""Generates 'exists' notification for a volume for usage auditing
|
||||
purposes.
|
||||
|
||||
Generates usage for last completed period, unless 'current_period'
|
||||
is True.
|
||||
Generates usage for last completed period, unless 'current_period'
|
||||
is True.
|
||||
"""
|
||||
begin, end = utils.last_completed_audit_period()
|
||||
if current_period:
|
||||
|
Loading…
x
Reference in New Issue
Block a user