Fix doc string definitions

Changed """" at start of docstring to """
and changed ''' to """ in docstrings.

Docstring standards are here -
https://www.python.org/dev/peps/pep-0008/#documentation-strings

Closes-Bug: #1466802
Change-Id: I7d03643845b0542deb52aed59edc1543827436ba
This commit is contained in:
Andrey Pavlov 2015-06-18 16:19:51 +03:00
parent 9e7a7e113f
commit 76df9f313b
23 changed files with 254 additions and 254 deletions

View File

@ -1430,7 +1430,7 @@ def volume_get_all_by_group(context, group_id, filters=None):
@require_context
def volume_get_all_by_project(context, project_id, marker, limit,
sort_keys=None, sort_dirs=None, filters=None):
""""Retrieves all volumes in a project.
"""Retrieves all volumes in a project.
If no sort parameters are specified then the returned volumes are sorted
first by the 'created_at' key and then by the 'id' key in descending

View File

@ -42,10 +42,10 @@ CONF.register_opts(scheduler_driver_opts)
def volume_update_db(context, volume_id, host):
'''Set the host and set the scheduled_at field of a volume.
"""Set the host and set the scheduled_at field of a volume.
:returns: A Volume with the updated fields set properly.
'''
"""
now = timeutils.utcnow()
values = {'host': host, 'scheduled_at': now}
return db.volume_update(context, volume_id, values)

View File

@ -28,7 +28,7 @@ CONF = cfg.CONF
class SchedulerAPI(object):
'''Client side of the scheduler rpc API.
"""Client side of the scheduler rpc API.
API version history:
@ -41,7 +41,7 @@ class SchedulerAPI(object):
1.5 - Add manage_existing method
1.6 - Add create_consistencygroup method
1.7 - Add get_active_pools method
'''
"""
RPC_API_VERSION = '1.0'

View File

@ -208,34 +208,34 @@ class PaginationParamsTest(test.TestCase):
class SortParamUtilsTest(test.TestCase):
def test_get_sort_params_defaults(self):
'''Verifies the default sort key and direction.'''
"""Verifies the default sort key and direction."""
sort_keys, sort_dirs = common.get_sort_params({})
self.assertEqual(['created_at'], sort_keys)
self.assertEqual(['desc'], sort_dirs)
def test_get_sort_params_override_defaults(self):
'''Verifies that the defaults can be overriden.'''
"""Verifies that the defaults can be overriden."""
sort_keys, sort_dirs = common.get_sort_params({}, default_key='key1',
default_dir='dir1')
self.assertEqual(['key1'], sort_keys)
self.assertEqual(['dir1'], sort_dirs)
def test_get_sort_params_single_value_sort_param(self):
'''Verifies a single sort key and direction.'''
"""Verifies a single sort key and direction."""
params = {'sort': 'key1:dir1'}
sort_keys, sort_dirs = common.get_sort_params(params)
self.assertEqual(['key1'], sort_keys)
self.assertEqual(['dir1'], sort_dirs)
def test_get_sort_params_single_value_old_params(self):
'''Verifies a single sort key and direction.'''
"""Verifies a single sort key and direction."""
params = {'sort_key': 'key1', 'sort_dir': 'dir1'}
sort_keys, sort_dirs = common.get_sort_params(params)
self.assertEqual(['key1'], sort_keys)
self.assertEqual(['dir1'], sort_dirs)
def test_get_sort_params_single_with_default_sort_param(self):
'''Verifies a single sort value with a default direction.'''
"""Verifies a single sort value with a default direction."""
params = {'sort': 'key1'}
sort_keys, sort_dirs = common.get_sort_params(params)
self.assertEqual(['key1'], sort_keys)
@ -243,7 +243,7 @@ class SortParamUtilsTest(test.TestCase):
self.assertEqual(['desc'], sort_dirs)
def test_get_sort_params_single_with_default_old_params(self):
'''Verifies a single sort value with a default direction.'''
"""Verifies a single sort value with a default direction."""
params = {'sort_key': 'key1'}
sort_keys, sort_dirs = common.get_sort_params(params)
self.assertEqual(['key1'], sort_keys)
@ -251,14 +251,14 @@ class SortParamUtilsTest(test.TestCase):
self.assertEqual(['desc'], sort_dirs)
def test_get_sort_params_multiple_values(self):
'''Verifies multiple sort parameter values.'''
"""Verifies multiple sort parameter values."""
params = {'sort': 'key1:dir1,key2:dir2,key3:dir3'}
sort_keys, sort_dirs = common.get_sort_params(params)
self.assertEqual(['key1', 'key2', 'key3'], sort_keys)
self.assertEqual(['dir1', 'dir2', 'dir3'], sort_dirs)
def test_get_sort_params_multiple_not_all_dirs(self):
'''Verifies multiple sort keys without all directions.'''
"""Verifies multiple sort keys without all directions."""
params = {'sort': 'key1:dir1,key2,key3:dir3'}
sort_keys, sort_dirs = common.get_sort_params(params)
self.assertEqual(['key1', 'key2', 'key3'], sort_keys)
@ -266,7 +266,7 @@ class SortParamUtilsTest(test.TestCase):
self.assertEqual(['dir1', 'desc', 'dir3'], sort_dirs)
def test_get_sort_params_multiple_override_default_dir(self):
'''Verifies multiple sort keys and overriding default direction.'''
"""Verifies multiple sort keys and overriding default direction."""
params = {'sort': 'key1:dir1,key2,key3'}
sort_keys, sort_dirs = common.get_sort_params(params,
default_dir='foo')
@ -274,7 +274,7 @@ class SortParamUtilsTest(test.TestCase):
self.assertEqual(['dir1', 'foo', 'foo'], sort_dirs)
def test_get_sort_params_params_modified(self):
'''Verifies that the input sort parameter are modified.'''
"""Verifies that the input sort parameter are modified."""
params = {'sort': 'key1:dir1,key2:dir2,key3:dir3'}
common.get_sort_params(params)
self.assertEqual({}, params)
@ -284,14 +284,14 @@ class SortParamUtilsTest(test.TestCase):
self.assertEqual({}, params)
def test_get_sort_params_random_spaces(self):
'''Verifies that leading and trailing spaces are removed.'''
"""Verifies that leading and trailing spaces are removed."""
params = {'sort': ' key1 : dir1,key2: dir2 , key3 '}
sort_keys, sort_dirs = common.get_sort_params(params)
self.assertEqual(['key1', 'key2', 'key3'], sort_keys)
self.assertEqual(['dir1', 'dir2', 'desc'], sort_dirs)
def test_get_params_mix_sort_and_old_params(self):
'''An exception is raised if both types of sorting params are given.'''
"""An exception is raised if both types of sorting params are given."""
for params in ({'sort': 'k1', 'sort_key': 'k1'},
{'sort': 'k1', 'sort_dir': 'd1'},
{'sort': 'k1', 'sort_key': 'k1', 'sort_dir': 'd2'}):

View File

@ -1261,7 +1261,7 @@ class VolumeApiTest(test.TestCase):
self.stubs.Set(volume_api.API, 'get', stubs.stub_volume_get)
def _verify_links(links, url_key):
'''Verify next link and url.'''
"""Verify next link and url."""
self.assertEqual(links[0]['rel'], 'next')
href_parts = urllib.parse.urlparse(links[0]['href'])
self.assertEqual('/v2/fakeproject/%s' % key, href_parts.path)

View File

@ -24,7 +24,7 @@ LOG = logging.getLogger(__name__)
class XmlTests(integrated_helpers._IntegratedTestBase):
""""Some basic XML sanity checks."""
"""Some basic XML sanity checks."""
# FIXME(ja): does cinder need limits?
# def test_namespace_limits(self):

View File

@ -522,7 +522,7 @@ class BackupTestCase(BaseBackupTest):
self.assertEqual(len(backups), 2)
def test_backup_manager_driver_name(self):
""""Test mapping between backup services and backup drivers."""
"""Test mapping between backup services and backup drivers."""
self.override_config('backup_driver', "cinder.backup.services.swift")
backup_mgr = \
importutils.import_object(CONF.backup_manager)

View File

@ -773,7 +773,7 @@ class BackupCephTestCase(test.TestCase):
@common_mocks
def test_diff_restore_allowed_with_image_not_exists(self):
'''Test diff restore not allowed when backup not diff-format.'''
"""Test diff restore not allowed when backup not diff-format."""
not_allowed = (False, None)
backup_base = 'backup.base'
rbd_io = self._get_wrapped_rbd_io(self.service.rbd.Image())
@ -794,12 +794,12 @@ class BackupCephTestCase(test.TestCase):
@common_mocks
def test_diff_restore_allowed_with_no_restore_point(self):
'''Test diff restore not allowed when no restore point found.
"""Test diff restore not allowed when no restore point found.
Detail conditions:
1. backup base is diff-format
2. restore point does not exist
'''
"""
not_allowed = (False, None)
backup_base = 'backup.base'
rbd_io = self._get_wrapped_rbd_io(self.service.rbd.Image())
@ -824,13 +824,13 @@ class BackupCephTestCase(test.TestCase):
@common_mocks
def test_diff_restore_allowed_with_not_rbd(self):
'''Test diff restore not allowed when destination volume is not rbd.
"""Test diff restore not allowed when destination volume is not rbd.
Detail conditions:
1. backup base is diff-format
2. restore point exists
3. destination volume is not an rbd.
'''
"""
backup_base = 'backup.base'
restore_point = 'backup.snap.1'
rbd_io = self._get_wrapped_rbd_io(self.service.rbd.Image())
@ -858,14 +858,14 @@ class BackupCephTestCase(test.TestCase):
@common_mocks
def test_diff_restore_allowed_with_same_volume(self):
'''Test diff restore not allowed when volumes are same.
"""Test diff restore not allowed when volumes are same.
Detail conditions:
1. backup base is diff-format
2. restore point exists
3. destination volume is an rbd
4. source and destination volumes are the same
'''
"""
backup_base = 'backup.base'
restore_point = 'backup.snap.1'
rbd_io = self._get_wrapped_rbd_io(self.service.rbd.Image())
@ -891,7 +891,7 @@ class BackupCephTestCase(test.TestCase):
@common_mocks
def test_diff_restore_allowed_with_has_extents(self):
'''Test diff restore not allowed when destination volume has data.
"""Test diff restore not allowed when destination volume has data.
Detail conditions:
1. backup base is diff-format
@ -899,7 +899,7 @@ class BackupCephTestCase(test.TestCase):
3. destination volume is an rbd
4. source and destination volumes are different
5. destination volume has data on it - full copy is mandated
'''
"""
backup_base = 'backup.base'
restore_point = 'backup.snap.1'
rbd_io = self._get_wrapped_rbd_io(self.service.rbd.Image())
@ -931,7 +931,7 @@ class BackupCephTestCase(test.TestCase):
@common_mocks
def test_diff_restore_allowed_with_no_extents(self):
'''Test diff restore allowed when no data in destination volume.
"""Test diff restore allowed when no data in destination volume.
Detail conditions:
1. backup base is diff-format
@ -939,7 +939,7 @@ class BackupCephTestCase(test.TestCase):
3. destination volume is an rbd
4. source and destination volumes are different
5. destination volume no data on it
'''
"""
backup_base = 'backup.base'
restore_point = 'backup.snap.1'
rbd_io = self._get_wrapped_rbd_io(self.service.rbd.Image())

View File

@ -540,7 +540,7 @@ class DBAPIVolumeTestCase(BaseTest):
match_keys=['id', 'display_name',
'volume_metadata',
'created_at']):
""""Verifies that volumes are returned in the correct order."""
"""Verifies that volumes are returned in the correct order."""
if project_id:
result = db.volume_get_all_by_project(self.ctxt, project_id,
marker, limit,
@ -821,7 +821,7 @@ class DBAPIVolumeTestCase(BaseTest):
self._assertEqualsVolumeOrderResult(correct_order)
def test_volume_get_all_by_filters_sort_keys_paginate(self):
'''Verifies sort order with pagination.'''
"""Verifies sort order with pagination."""
# Volumes that will reply to the query
test1_avail = db.volume_create(self.ctxt, {'display_name': 'test',
'size': 1,
@ -1814,7 +1814,7 @@ class DBAPIBackupTestCase(BaseTest):
class DBAPIProcessSortParamTestCase(test.TestCase):
def test_process_sort_params_defaults(self):
'''Verifies default sort parameters.'''
"""Verifies default sort parameters."""
sort_keys, sort_dirs = sqlalchemy_api.process_sort_params([], [])
self.assertEqual(['created_at', 'id'], sort_keys)
self.assertEqual(['asc', 'asc'], sort_dirs)
@ -1824,21 +1824,21 @@ class DBAPIProcessSortParamTestCase(test.TestCase):
self.assertEqual(['asc', 'asc'], sort_dirs)
def test_process_sort_params_override_default_keys(self):
'''Verifies that the default keys can be overridden.'''
"""Verifies that the default keys can be overridden."""
sort_keys, sort_dirs = sqlalchemy_api.process_sort_params(
[], [], default_keys=['key1', 'key2', 'key3'])
self.assertEqual(['key1', 'key2', 'key3'], sort_keys)
self.assertEqual(['asc', 'asc', 'asc'], sort_dirs)
def test_process_sort_params_override_default_dir(self):
'''Verifies that the default direction can be overridden.'''
"""Verifies that the default direction can be overridden."""
sort_keys, sort_dirs = sqlalchemy_api.process_sort_params(
[], [], default_dir='dir1')
self.assertEqual(['created_at', 'id'], sort_keys)
self.assertEqual(['dir1', 'dir1'], sort_dirs)
def test_process_sort_params_override_default_key_and_dir(self):
'''Verifies that the default key and dir can be overridden.'''
"""Verifies that the default key and dir can be overridden."""
sort_keys, sort_dirs = sqlalchemy_api.process_sort_params(
[], [], default_keys=['key1', 'key2', 'key3'],
default_dir='dir1')
@ -1851,7 +1851,7 @@ class DBAPIProcessSortParamTestCase(test.TestCase):
self.assertEqual([], sort_dirs)
def test_process_sort_params_non_default(self):
'''Verifies that non-default keys are added correctly.'''
"""Verifies that non-default keys are added correctly."""
sort_keys, sort_dirs = sqlalchemy_api.process_sort_params(
['key1', 'key2'], ['asc', 'desc'])
self.assertEqual(['key1', 'key2', 'created_at', 'id'], sort_keys)
@ -1859,7 +1859,7 @@ class DBAPIProcessSortParamTestCase(test.TestCase):
self.assertEqual(['asc', 'desc', 'asc', 'asc'], sort_dirs)
def test_process_sort_params_default(self):
'''Verifies that default keys are added correctly.'''
"""Verifies that default keys are added correctly."""
sort_keys, sort_dirs = sqlalchemy_api.process_sort_params(
['id', 'key2'], ['asc', 'desc'])
self.assertEqual(['id', 'key2', 'created_at'], sort_keys)
@ -1872,7 +1872,7 @@ class DBAPIProcessSortParamTestCase(test.TestCase):
self.assertEqual(['asc', 'asc', 'asc'], sort_dirs)
def test_process_sort_params_default_dir(self):
'''Verifies that the default dir is applied to all keys.'''
"""Verifies that the default dir is applied to all keys."""
# Direction is set, ignore default dir
sort_keys, sort_dirs = sqlalchemy_api.process_sort_params(
['id', 'key2'], ['desc'], default_dir='dir')
@ -1886,7 +1886,7 @@ class DBAPIProcessSortParamTestCase(test.TestCase):
self.assertEqual(['dir', 'dir', 'dir'], sort_dirs)
def test_process_sort_params_unequal_length(self):
'''Verifies that a sort direction list is applied correctly.'''
"""Verifies that a sort direction list is applied correctly."""
sort_keys, sort_dirs = sqlalchemy_api.process_sort_params(
['id', 'key2', 'key3'], ['desc'])
self.assertEqual(['id', 'key2', 'key3', 'created_at'], sort_keys)
@ -1904,14 +1904,14 @@ class DBAPIProcessSortParamTestCase(test.TestCase):
self.assertEqual(['desc', 'asc', 'asc', 'desc'], sort_dirs)
def test_process_sort_params_extra_dirs_lengths(self):
'''InvalidInput raised if more directions are given.'''
"""InvalidInput raised if more directions are given."""
self.assertRaises(exception.InvalidInput,
sqlalchemy_api.process_sort_params,
['key1', 'key2'],
['asc', 'desc', 'desc'])
def test_process_sort_params_invalid_sort_dir(self):
'''InvalidInput raised if invalid directions are given.'''
"""InvalidInput raised if invalid directions are given."""
for dirs in [['foo'], ['asc', 'foo'], ['asc', 'desc', 'foo']]:
self.assertRaises(exception.InvalidInput,
sqlalchemy_api.process_sort_params,

View File

@ -35,10 +35,10 @@ from cinder.volume.drivers.dell import dell_storagecenter_api
'close_connection')
class DellSCSanAPITestCase(test.TestCase):
'''DellSCSanAPITestCase
"""DellSCSanAPITestCase
Class to test the Storage Center API using Mock.
'''
"""
SC = {u'IPv6ManagementIPPrefix': 128,
u'connectionError': u'',
@ -5635,10 +5635,10 @@ class DellSCSanAPITestCase(test.TestCase):
class DellSCSanAPIConnectionTestCase(test.TestCase):
'''DellSCSanAPIConnectionTestCase
"""DellSCSanAPIConnectionTestCase
Class to test the Storage Center API connection using Mock.
'''
"""
# Create a Response object that indicates OK
response_ok = models.Response()

View File

@ -743,7 +743,7 @@ class V7000CommonTestCase(test.TestCase):
def test_get_volume_type_extra_spec(self,
m_get_volume_type,
m_get_admin_context):
'''Volume_type extra specs are found successfully.'''
"""Volume_type extra specs are found successfully."""
vol = VOLUME.copy()
vol['volume_type_id'] = 1
volume_type = {'extra_specs': {'override:test_key': 'test_value'}}
@ -762,7 +762,7 @@ class V7000CommonTestCase(test.TestCase):
def test_get_violin_extra_spec(self,
m_get_volume_type,
m_get_admin_context):
'''Volume_type extra specs are found successfully.'''
"""Volume_type extra specs are found successfully."""
vol = VOLUME.copy()
vol['volume_type_id'] = 1
volume_type = {'extra_specs': {'violin:test_key': 'test_value'}}

View File

@ -1023,7 +1023,7 @@ class VolumeTestCase(BaseVolumeTestCase):
@mock.patch.object(db, 'volume_get', side_effect=exception.VolumeNotFound(
volume_id='12345678-1234-5678-1234-567812345678'))
def test_delete_volume_not_found(self, mock_get_volume):
""""Test delete volume moves on if the volume does not exist."""
"""Test delete volume moves on if the volume does not exist."""
volume_id = '12345678-1234-5678-1234-567812345678'
self.assertTrue(self.volume.delete_volume(self.context, volume_id))
self.assertTrue(mock_get_volume.called)

View File

@ -433,7 +433,7 @@ def create_configuration_eseries():
def deepcopy_return_value_method_decorator(fn):
'''Returns a deepcopy of the returned value of the wrapped function.'''
"""Returns a deepcopy of the returned value of the wrapped function."""
def decorator(*args, **kwargs):
return copy.deepcopy(fn(*args, **kwargs))
@ -441,9 +441,9 @@ def deepcopy_return_value_method_decorator(fn):
def deepcopy_return_value_class_decorator(cls):
'''Wraps all 'non-protected' methods of a class with the
"""Wraps all 'non-protected' methods of a class with the
deepcopy_return_value_method_decorator decorator.
'''
"""
class NewClass(cls):
def __getattribute__(self, attr_name):
obj = super(NewClass, self).__getattribute__(attr_name)

File diff suppressed because it is too large Load Diff

View File

@ -61,12 +61,12 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
self.configuration.safe_get('volume_backend_name') or 'Dell'
def _bytes_to_gb(self, spacestring):
'''Space is returned in a string like ...
"""Space is returned in a string like ...
7.38197504E8 Bytes
Need to split that apart and convert to GB.
returns gbs in int form
'''
"""
try:
n = spacestring.split(' ', 1)
fgbs = float(n[0]) / 1073741824.0
@ -78,22 +78,22 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
return None
def do_setup(self, context):
'''One time driver setup.
"""One time driver setup.
Called once by the manager after the driver is loaded.
Sets up clients, check licenses, sets up protocol
specific helpers.
'''
"""
self._client = dell_storagecenter_api.StorageCenterApiHelper(
self.configuration)
def check_for_setup_error(self):
'''Validates the configuration information.'''
"""Validates the configuration information."""
with self._client.open_connection() as api:
api.find_sc()
def _get_volume_extra_specs(self, volume):
'''Gets extra specs for the given volume.'''
"""Gets extra specs for the given volume."""
type_id = volume.get('volume_type_id')
if type_id:
return volume_types.get_volume_type_extra_specs(type_id)
@ -101,13 +101,13 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
return {}
def _add_volume_to_consistency_group(self, api, scvolume, volume):
'''Just a helper to add a volume to a consistency group.
"""Just a helper to add a volume to a consistency group.
:param api: Dell SC API opbject.
:param scvolume: Dell SC Volume object.
:param volume: Cinder Volume object.
:return: Nothing.
'''
"""
if scvolume and volume.get('consistencygroup_id'):
profile = api.find_replay_profile(
volume.get('consistencygroup_id'))
@ -115,7 +115,7 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
api.update_cg_volumes(profile, [volume])
def create_volume(self, volume):
'''Create a volume.'''
"""Create a volume."""
# We use id as our name as it is unique.
volume_name = volume.get('id')
@ -166,7 +166,7 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
raise exception.VolumeIsBusy(volume_name=volume_name)
def create_snapshot(self, snapshot):
'''Create snapshot'''
"""Create snapshot"""
# our volume name is the volume id
volume_name = snapshot.get('volume_id')
snapshot_id = snapshot.get('id')
@ -192,7 +192,7 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
snapshot_id)
def create_volume_from_snapshot(self, volume, snapshot):
'''Create new volume from other volume's snapshot on appliance.'''
"""Create new volume from other volume's snapshot on appliance."""
scvolume = None
src_volume_name = snapshot.get('volume_id')
# This snapshot could have been created on its own or as part of a
@ -239,7 +239,7 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
_('Failed to create volume %s') % volume_name)
def create_cloned_volume(self, volume, src_vref):
'''Creates a clone of the specified volume.'''
"""Creates a clone of the specified volume."""
scvolume = None
src_volume_name = src_vref.get('id')
volume_name = volume.get('id')
@ -270,7 +270,7 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
_('Failed to create volume %s') % volume_name)
def delete_snapshot(self, snapshot):
'''delete_snapshot'''
"""delete_snapshot"""
volume_name = snapshot.get('volume_id')
snapshot_id = snapshot.get('id')
LOG.debug('Deleting snapshot %(snap)s from volume %(vol)s',
@ -289,19 +289,19 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
_('Failed to delete snapshot %s') % snapshot_id)
def create_export(self, context, volume):
'''Create an export of a volume.
"""Create an export of a volume.
The volume exists on creation and will be visible on
initialize connection. So nothing to do here.
'''
"""
pass
def ensure_export(self, context, volume):
'''Ensure an export of a volume.
"""Ensure an export of a volume.
Per the eqlx driver we just make sure that the volume actually
exists where we think it does.
'''
"""
scvolume = None
volume_name = volume.get('id')
LOG.debug('Checking existence of volume %s', volume_name)
@ -318,15 +318,15 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
_('Unable to find volume %s') % volume_name)
def remove_export(self, context, volume):
'''Remove an export of a volume.
"""Remove an export of a volume.
We do nothing here to match the nothing we do in create export. Again
we do everything in initialize and terminate connection.
'''
"""
pass
def extend_volume(self, volume, new_size):
'''Extend the size of the volume.'''
"""Extend the size of the volume."""
volume_name = volume.get('id')
LOG.debug('Extending volume %(vol)s to %(size)s',
{'vol': volume_name,
@ -342,17 +342,17 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
_('Unable to extend volume %s') % volume_name)
def get_volume_stats(self, refresh=False):
'''Get volume status.
"""Get volume status.
If 'refresh' is True, run update the stats first.
'''
"""
if refresh:
self._update_volume_stats()
return self._stats
def _update_volume_stats(self):
'''Retrieve stats info from volume group.'''
"""Retrieve stats info from volume group."""
with self._client.open_connection() as api:
storageusage = api.get_storage_usage() if api.find_sc() else None
@ -383,14 +383,14 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
def update_migrated_volume(self, ctxt, volume, new_volume,
original_volume_status):
'''Return model update for migrated volume.
"""Return model update for migrated volume.
:param volume: The original volume that was migrated to this backend
:param new_volume: The migration volume object that was created on
this backend as part of the migration process
:param original_volume_status: The status of the original volume
:return model_update to update DB with any needed changes
'''
"""
# We use id as our volume name so we need to rename the backend
# volume to the original volume name.
original_volume_name = volume.get('id')
@ -413,13 +413,13 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
return {'_name_id': new_volume['_name_id'] or new_volume['id']}
def create_consistencygroup(self, context, group):
'''This creates a replay profile on the storage backend.
"""This creates a replay profile on the storage backend.
:param context: the context of the caller.
:param group: the dictionary of the consistency group to be created.
:return: Nothing on success.
:raises: VolumeBackendAPIException
'''
"""
gid = group['id']
with self._client.open_connection() as api:
cgroup = api.create_replay_profile(gid)
@ -430,12 +430,12 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
_('Unable to create consistency group %s') % gid)
def delete_consistencygroup(self, context, group):
'''Delete the Dell SC profile associated with this consistency group.
"""Delete the Dell SC profile associated with this consistency group.
:param context: the context of the caller.
:param group: the dictionary of the consistency group to be created.
:return: Updated model_update, volumes.
'''
"""
gid = group['id']
with self._client.open_connection() as api:
profile = api.find_replay_profile(gid)
@ -457,7 +457,7 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
def update_consistencygroup(self, context, group,
add_volumes=None, remove_volumes=None):
'''Updates a consistency group.
"""Updates a consistency group.
:param context: the context of the caller.
:param group: the dictionary of the consistency group to be updated.
@ -480,7 +480,7 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
If the driver throws an exception, the status of the group as well as
those of the volumes to be added/removed will be set to 'error'.
'''
"""
gid = group['id']
with self._client.open_connection() as api:
profile = api.find_replay_profile(gid)
@ -497,13 +497,13 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
_('Unable to update consistency group %s') % gid)
def create_cgsnapshot(self, context, cgsnapshot):
'''Takes a snapshot of the consistency group.
"""Takes a snapshot of the consistency group.
:param context: the context of the caller.
:param cgsnapshot: Information about the snapshot to take.
:return: Updated model_update, snapshots.
:raises: VolumeBackendAPIException.
'''
"""
cgid = cgsnapshot['consistencygroup_id']
snapshotid = cgsnapshot['id']
@ -530,7 +530,7 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
_('Unable to snap Consistency Group %s') % cgid)
def delete_cgsnapshot(self, context, cgsnapshot):
'''Deletes a cgsnapshot.
"""Deletes a cgsnapshot.
If profile isn't found return success. If failed to delete the
replay (the snapshot) then raise an exception.
@ -539,7 +539,7 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
:param cgsnapshot: Information about the snapshot to delete.
:return: Updated model_update, snapshots.
:raises: VolumeBackendAPIException.
'''
"""
cgid = cgsnapshot['consistencygroup_id']
snapshotid = cgsnapshot['id']

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
'''Volume driver for Dell Storage Center.'''
"""Volume driver for Dell Storage Center."""
from oslo_log import log as logging
from oslo_utils import excutils
@ -29,7 +29,7 @@ LOG = logging.getLogger(__name__)
class DellStorageCenterFCDriver(dell_storagecenter_common.DellCommonDriver,
driver.FibreChannelDriver):
'''Implements commands for Dell EqualLogic SAN ISCSI management.
"""Implements commands for Dell EqualLogic SAN ISCSI management.
To enable the driver add the following line to the cinder configuration:
volume_driver=cinder.volume.drivers.dell.DellStorageCenterFCDriver
@ -42,7 +42,7 @@ class DellStorageCenterFCDriver(dell_storagecenter_common.DellCommonDriver,
driver.
2.1.0 - Added support for ManageableVD.
2.2.0 - Driver retype support for switching volume's Storage Profile
'''
"""
VERSION = '2.2.0'
@ -53,7 +53,7 @@ class DellStorageCenterFCDriver(dell_storagecenter_common.DellCommonDriver,
@fczm_utils.AddFCZone
def initialize_connection(self, volume, connector):
'''Initializes the connection and returns connection info.
"""Initializes the connection and returns connection info.
Assign any created volume to a compute node/host so that it can be
used from that host.
@ -61,7 +61,7 @@ class DellStorageCenterFCDriver(dell_storagecenter_common.DellCommonDriver,
The driver returns a driver_volume_type of 'fibre_channel'.
The target_wwn can be a single entry or a list of wwns that
correspond to the list of remote wwn(s) that will export the volume.
'''
"""
# We use id to name the volume name as it is a
# known unique name.
@ -154,10 +154,10 @@ class DellStorageCenterFCDriver(dell_storagecenter_common.DellCommonDriver,
_('Terminate connection unable to connect to backend.'))
def get_volume_stats(self, refresh=False):
'''Get volume status.
"""Get volume status.
If 'refresh' is True, run update the stats first.
'''
"""
if refresh:
self._update_volume_stats()
# Update our protocol to the correct one.

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
'''Volume driver for Dell Storage Center.'''
"""Volume driver for Dell Storage Center."""
from oslo_log import log as logging
from oslo_utils import excutils
@ -27,7 +27,7 @@ LOG = logging.getLogger(__name__)
class DellStorageCenterISCSIDriver(dell_storagecenter_common.DellCommonDriver,
driver.ISCSIDriver):
'''Implements commands for Dell StorageCenter ISCSI management.
"""Implements commands for Dell StorageCenter ISCSI management.
To enable the driver add the following line to the cinder configuration:
volume_driver=cinder.volume.drivers.dell.DellStorageCenterISCSIDriver
@ -40,7 +40,7 @@ class DellStorageCenterISCSIDriver(dell_storagecenter_common.DellCommonDriver,
driver.
2.1.0 - Added support for ManageableVD.
2.2.0 - Driver retype support for switching volume's Storage Profile
'''
"""
VERSION = '2.2.0'

View File

@ -421,7 +421,7 @@ class DellEQLSanISCSIDriver(san.SanISCSIDriver):
'volume "%s".'), volume['name'])
def create_snapshot(self, snapshot):
""""Create snapshot of existing volume on appliance."""
"""Create snapshot of existing volume on appliance."""
try:
out = self._eql_execute('volume', 'select',
snapshot['volume_name'],

View File

@ -363,7 +363,7 @@ class StorwizeSSH(object):
class CLIResponse(object):
'''Parse SVC CLI output and generate iterable.'''
"""Parse SVC CLI output and generate iterable."""
def __init__(self, raw, ssh_cmd=None, delim='!', with_header=True):
super(CLIResponse, self).__init__()

View File

@ -56,7 +56,7 @@ NETAPP_UNIFIED_DRIVER_REGISTRY = {
class NetAppDriver(driver.ProxyVD):
""""NetApp unified block storage driver.
"""NetApp unified block storage driver.
Acts as a factory to create NetApp storage drivers based on the
storage family and protocol configured.
@ -85,7 +85,7 @@ class NetAppDriver(driver.ProxyVD):
@staticmethod
def create_driver(storage_family, storage_protocol, *args, **kwargs):
""""Creates an appropriate driver based on family and protocol."""
"""Creates an appropriate driver based on family and protocol."""
storage_family = storage_family.lower()
storage_protocol = storage_protocol.lower()

View File

@ -641,7 +641,7 @@ class HP3PARISCSIDriver(cinder.volume.driver.ISCSIDriver):
return key
def _get_least_used_nsp(self, common, vluns, nspss):
""""Return the nsp that has the fewest active vluns."""
"""Return the nsp that has the fewest active vluns."""
# return only the nsp (node:server:port)
# count the number of nsps
nsp_counts = {}

View File

@ -218,14 +218,14 @@ class LVM(lvm.LVM):
@contextlib.contextmanager
def patched(obj, attr, fun):
'''Context manager to locally patch a method.
"""Context manager to locally patch a method.
Within the managed context, the `attr` method of `obj` will be replaced by
a method which calls `fun` passing in the original `attr` attribute of
`obj` as well as any positional and keyword arguments.
At the end of the context, the original method is restored.
'''
"""
orig = getattr(obj, attr)
@ -242,7 +242,7 @@ def patched(obj, attr, fun):
@contextlib.contextmanager
def handle_process_execution_error(message, info_message, reraise=True):
'''Consistently handle `putils.ProcessExecutionError` exceptions
"""Consistently handle `putils.ProcessExecutionError` exceptions
This context-manager will catch any `putils.ProcessExecutionError`
exceptions raised in the managed block, and generate logging output
@ -259,7 +259,7 @@ def handle_process_execution_error(message, info_message, reraise=True):
object will be raised instead (so you most likely want it to be some
`Exception`). Any `False` value will result in the exception to be
swallowed.
'''
"""
try:
yield
@ -460,8 +460,8 @@ class SRBDriver(driver.VolumeDriver):
@staticmethod
def _activate_lv(orig, *args, **kwargs):
'''Use with `patched` to patch `lvm.LVM.activate_lv` to ignore `EEXIST`
'''
"""Use with `patched` to patch `lvm.LVM.activate_lv` to ignore `EEXIST`
"""
try:
orig(*args, **kwargs)
except putils.ProcessExecutionError as exc:

View File

@ -29,7 +29,7 @@ CONF = cfg.CONF
class VolumeAPI(object):
'''Client side of the volume rpc API.
"""Client side of the volume rpc API.
API version history:
@ -68,7 +68,7 @@ class VolumeAPI(object):
source_volid, source_replicaid, consistencygroup_id and
cgsnapshot_id from create_volume. All off them are already
passed either in request_spec or available in the DB.
'''
"""
BASE_RPC_API_VERSION = '1.0'