From 53773aab993fd419ce2ab2253d28b51fbace0592 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 18 Jun 2013 21:22:44 +0200 Subject: [PATCH] Fix and enable gating on H403 Fix occurrences of H403 - multi line docstring end on new line Change-Id: I79a818095e9f64a18ded1686fb152b9d58f3c8b1 --- bin/cinder-manage | 27 ++++++++++----- cinder/backup/manager.py | 3 +- cinder/db/api.py | 9 +++-- cinder/service.py | 3 +- cinder/tests/api/v1/test_limits.py | 3 +- cinder/tests/api/v2/test_limits.py | 3 +- .../tests/scheduler/test_filter_scheduler.py | 6 ++-- cinder/tests/scheduler/test_scheduler.py | 3 +- cinder/tests/test_backup.py | 33 ++++++++++++------- cinder/tests/test_migrations.py | 3 +- cinder/tests/test_rbd.py | 3 +- cinder/tests/test_volume.py | 12 ++++--- cinder/tests/test_volume_types.py | 3 +- cinder/utils.py | 3 +- cinder/volume/api.py | 3 +- cinder/volume/configuration.py | 3 +- cinder/volume/driver.py | 12 ++++--- cinder/volume/drivers/glusterfs.py | 12 ++++--- cinder/volume/drivers/lvm.py | 12 ++++--- cinder/volume/drivers/netapp/api.py | 3 +- cinder/volume/drivers/netapp/iscsi.py | 6 ++-- cinder/volume/drivers/netapp/nfs.py | 9 +++-- cinder/volume/drivers/nexenta/volume.py | 3 +- cinder/volume/drivers/nfs.py | 18 ++++++---- cinder/volume/drivers/rbd.py | 3 +- cinder/volume/drivers/storwize_svc.py | 3 +- cinder/volume/manager.py | 3 +- cinder/volume/utils.py | 3 +- tox.ini | 2 +- 29 files changed, 139 insertions(+), 70 deletions(-) diff --git a/bin/cinder-manage b/bin/cinder-manage index b13a66f95..62f96dfdc 100755 --- a/bin/cinder-manage +++ b/bin/cinder-manage @@ -118,19 +118,22 @@ class ShellCommands(object): def bpython(self): """Runs a bpython shell. - Falls back to Ipython/python shell if unavailable""" + Falls back to Ipython/python shell if unavailable + """ self.run('bpython') def ipython(self): """Runs an Ipython shell. - Falls back to Python shell if unavailable""" + Falls back to Python shell if unavailable + """ self.run('ipython') def python(self): """Runs a python shell. - Falls back to Python shell if unavailable""" + Falls back to Python shell if unavailable + """ self.run('python') @args('--shell', dest="shell", @@ -174,7 +177,8 @@ class ShellCommands(object): @args('--path', required=True, help='Script path') def script(self, path): """Runs the script from the specifed path with flags set properly. - arguments: path""" + arguments: path + """ exec(compile(open(path).read(), path, 'exec'), locals(), globals()) @@ -193,7 +197,8 @@ class HostCommands(object): help='Availability Zone (default: %(default)s)') def list(self, zone=None): """Show a list of all physical hosts. Filter by zone. - args: [zone]""" + args: [zone] + """ print "%-25s\t%-15s" % (_('host'), _('zone')) ctxt = context.get_admin_context() @@ -246,7 +251,8 @@ class VolumeCommands(object): help='Volume ID to be deleted') def delete(self, volume_id): """Delete a volume, bypassing the check that it - must be available.""" + must be available. + """ ctxt = context.get_admin_context() volume = db.volume_get(ctxt, param2id(volume_id)) host = volume['host'] @@ -272,7 +278,8 @@ class VolumeCommands(object): def reattach(self, volume_id): """Re-attach a volume that has previously been attached to an instance. Typically called after a compute host - has been rebooted.""" + has been rebooted. + """ ctxt = context.get_admin_context() volume = db.volume_get(ctxt, param2id(volume_id)) if not volume['instance_id']: @@ -504,7 +511,8 @@ class BackupCommands(object): def list(self): """List all backups (including ones in progress) and the host - on which the backup operation is running.""" + on which the backup operation is running. + """ ctxt = context.get_admin_context() backups = db.backup_get_all(ctxt) @@ -575,7 +583,8 @@ CATEGORIES = { def methods_of(obj): """Get all callable methods of an object that don't start with underscore - returns a list of tuples of the form (method_name, method)""" + returns a list of tuples of the form (method_name, method) + """ result = [] for i in dir(obj): if callable(getattr(obj, i)) and not i.startswith('_'): diff --git a/cinder/backup/manager.py b/cinder/backup/manager.py index 414669430..ffba9821c 100755 --- a/cinder/backup/manager.py +++ b/cinder/backup/manager.py @@ -71,7 +71,8 @@ class BackupManager(manager.SchedulerDependentManager): def init_host(self): """Do any initialization that needs to be run if this is a - standalone service.""" + standalone service. + """ ctxt = context.get_admin_context() self.driver.do_setup(ctxt) diff --git a/cinder/db/api.py b/cinder/db/api.py index 15e4a3f78..04e7254d3 100644 --- a/cinder/db/api.py +++ b/cinder/db/api.py @@ -326,7 +326,8 @@ def snapshot_data_get_for_project(context, project_id, session=None): def snapshot_get_active_by_window(context, begin, end=None, project_id=None): """Get all the snapshots inside the window. - Specifying a project_id will filter for a certain project.""" + Specifying a project_id will filter for a certain project. + """ return IMPL.snapshot_get_active_by_window(context, begin, end, project_id) @@ -397,7 +398,8 @@ def volume_type_destroy(context, id): def volume_get_active_by_window(context, begin, end=None, project_id=None): """Get all the volumes inside the window. - Specifying a project_id will filter for a certain project.""" + Specifying a project_id will filter for a certain project. + """ return IMPL.volume_get_active_by_window(context, begin, end, project_id) @@ -418,7 +420,8 @@ def volume_type_extra_specs_update_or_create(context, volume_type_id, extra_specs): """Create or update volume type extra specs. This adds or modifies the - key/value pairs specified in the extra specs dict argument""" + key/value pairs specified in the extra specs dict argument + """ IMPL.volume_type_extra_specs_update_or_create(context, volume_type_id, extra_specs) diff --git a/cinder/service.py b/cinder/service.py index c8d374895..7eed1e338 100644 --- a/cinder/service.py +++ b/cinder/service.py @@ -331,7 +331,8 @@ class Service(object): A service takes a manager and enables rpc by listening to queues based on topic. It also periodically runs tasks on the manager and reports - it state to the database services table.""" + it state to the database services table. + """ def __init__(self, host, binary, topic, manager, report_interval=None, periodic_interval=None, periodic_fuzzy_delay=None, diff --git a/cinder/tests/api/v1/test_limits.py b/cinder/tests/api/v1/test_limits.py index a8f1b9bdd..873f747ec 100644 --- a/cinder/tests/api/v1/test_limits.py +++ b/cinder/tests/api/v1/test_limits.py @@ -696,7 +696,8 @@ def wire_HTTPConnection_to_WSGI(host, app): """ class HTTPConnectionDecorator(object): """Wraps the real HTTPConnection class so that when you instantiate - the class you might instead get a fake instance.""" + the class you might instead get a fake instance. + """ def __init__(self, wrapped): self.wrapped = wrapped diff --git a/cinder/tests/api/v2/test_limits.py b/cinder/tests/api/v2/test_limits.py index 07b63b1a9..ec7c152fb 100644 --- a/cinder/tests/api/v2/test_limits.py +++ b/cinder/tests/api/v2/test_limits.py @@ -695,7 +695,8 @@ def wire_HTTPConnection_to_WSGI(host, app): """ class HTTPConnectionDecorator(object): """Wraps the real HTTPConnection class so that when you instantiate - the class you might instead get a fake instance.""" + the class you might instead get a fake instance. + """ def __init__(self, wrapped): self.wrapped = wrapped diff --git a/cinder/tests/scheduler/test_filter_scheduler.py b/cinder/tests/scheduler/test_filter_scheduler.py index 167014aa8..0a15511eb 100644 --- a/cinder/tests/scheduler/test_filter_scheduler.py +++ b/cinder/tests/scheduler/test_filter_scheduler.py @@ -62,7 +62,8 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase): 'Test requires Cinder installed (try setup.py develop') def test_create_volume_non_admin(self): """Test creating an instance locally using run_instance, passing - a non-admin context. DB actions should work.""" + a non-admin context. DB actions should work. + """ self.was_admin = False def fake_get(context, *args, **kwargs): @@ -88,7 +89,8 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase): 'Test requires Cinder installed (try setup.py develop') def test_schedule_happy_day(self): """Make sure there's nothing glaringly wrong with _schedule() - by doing a happy day pass through.""" + by doing a happy day pass through. + """ self.next_weight = 1.0 diff --git a/cinder/tests/scheduler/test_scheduler.py b/cinder/tests/scheduler/test_scheduler.py index 7cf279675..cda27f197 100644 --- a/cinder/tests/scheduler/test_scheduler.py +++ b/cinder/tests/scheduler/test_scheduler.py @@ -164,7 +164,8 @@ class SchedulerTestCase(test.TestCase): class SchedulerDriverBaseTestCase(SchedulerTestCase): """Test cases for base scheduler driver class methods - that can't will fail if the driver is changed""" + that can't will fail if the driver is changed. + """ def test_unimplemented_schedule(self): fake_args = (1, 2, 3) diff --git a/cinder/tests/test_backup.py b/cinder/tests/test_backup.py index 9679ea8ae..c7a363ad7 100644 --- a/cinder/tests/test_backup.py +++ b/cinder/tests/test_backup.py @@ -103,7 +103,8 @@ class BackupTestCase(test.TestCase): def test_init_host(self): """Make sure stuck volumes and backups are reset to correct - states when backup_manager.init_host() is called""" + states when backup_manager.init_host() is called + """ vol1_id = self._create_volume_db_entry(status='backing-up') vol2_id = self._create_volume_db_entry(status='restoring-backup') backup1_id = self._create_backup_db_entry(status='creating') @@ -127,7 +128,8 @@ class BackupTestCase(test.TestCase): def test_create_backup_with_bad_volume_status(self): """Test error handling when creating a backup from a volume - with a bad status""" + with a bad status + """ vol_id = self._create_volume_db_entry(status='available', size=1) backup_id = self._create_backup_db_entry(volume_id=vol_id) self.assertRaises(exception.InvalidVolume, @@ -137,7 +139,8 @@ class BackupTestCase(test.TestCase): def test_create_backup_with_bad_backup_status(self): """Test error handling when creating a backup with a backup - with a bad status""" + with a bad status + """ vol_id = self._create_volume_db_entry(size=1) backup_id = self._create_backup_db_entry(status='available', volume_id=vol_id) @@ -187,7 +190,8 @@ class BackupTestCase(test.TestCase): def test_restore_backup_with_bad_volume_status(self): """Test error handling when restoring a backup to a volume - with a bad status""" + with a bad status + """ vol_id = self._create_volume_db_entry(status='available', size=1) backup_id = self._create_backup_db_entry(volume_id=vol_id) self.assertRaises(exception.InvalidVolume, @@ -200,7 +204,8 @@ class BackupTestCase(test.TestCase): def test_restore_backup_with_bad_backup_status(self): """Test error handling when restoring a backup with a backup - with a bad status""" + with a bad status + """ vol_id = self._create_volume_db_entry(status='restoring-backup', size=1) backup_id = self._create_backup_db_entry(status='available', @@ -240,7 +245,8 @@ class BackupTestCase(test.TestCase): def test_restore_backup_with_bad_service(self): """Test error handling when attempting a restore of a backup - with a different service to that used to create the backup""" + with a different service to that used to create the backup + """ vol_id = self._create_volume_db_entry(status='restoring-backup', size=1) backup_id = self._create_backup_db_entry(status='restoring', @@ -286,7 +292,8 @@ class BackupTestCase(test.TestCase): def test_delete_backup_with_bad_backup_status(self): """Test error handling when deleting a backup with a backup - with a bad status""" + with a bad status + """ vol_id = self._create_volume_db_entry(size=1) backup_id = self._create_backup_db_entry(status='available', volume_id=vol_id) @@ -312,7 +319,8 @@ class BackupTestCase(test.TestCase): def test_delete_backup_with_bad_service(self): """Test error handling when attempting a delete of a backup - with a different service to that used to create the backup""" + with a different service to that used to create the backup + """ vol_id = self._create_volume_db_entry(size=1) backup_id = self._create_backup_db_entry(status='deleting', volume_id=vol_id) @@ -327,7 +335,8 @@ class BackupTestCase(test.TestCase): def test_delete_backup_with_no_service(self): """Test error handling when attempting a delete of a backup - with no service defined for that backup, relates to bug #1162908""" + with no service defined for that backup, relates to bug #1162908 + """ vol_id = self._create_volume_db_entry(size=1) backup_id = self._create_backup_db_entry(status='deleting', volume_id=vol_id) @@ -363,7 +372,8 @@ class BackupTestCase(test.TestCase): def test_backup_get_all_by_project_with_deleted(self): """Test deleted backups don't show up in backup_get_all_by_project. - Unless context.read_deleted is 'yes'""" + Unless context.read_deleted is 'yes' + """ backups = db.backup_get_all_by_project(self.ctxt, 'fake') self.assertEqual(len(backups), 0) @@ -381,7 +391,8 @@ class BackupTestCase(test.TestCase): def test_backup_get_all_by_host_with_deleted(self): """Test deleted backups don't show up in backup_get_all_by_project. - Unless context.read_deleted is 'yes'""" + Unless context.read_deleted is 'yes' + """ backups = db.backup_get_all_by_host(self.ctxt, 'testhost') self.assertEqual(len(backups), 0) diff --git a/cinder/tests/test_migrations.py b/cinder/tests/test_migrations.py index b61ea5679..2683307ff 100644 --- a/cinder/tests/test_migrations.py +++ b/cinder/tests/test_migrations.py @@ -96,7 +96,8 @@ def get_table(engine, name): """Returns an sqlalchemy table dynamically from db. Needed because the models don't work for us in migrations - as models will be far out of sync with the current data.""" + as models will be far out of sync with the current data. + """ metadata = sqlalchemy.schema.MetaData() metadata.bind = engine return sqlalchemy.Table(name, metadata, autoload=True) diff --git a/cinder/tests/test_rbd.py b/cinder/tests/test_rbd.py index 16ce5bd5f..a36a278b2 100644 --- a/cinder/tests/test_rbd.py +++ b/cinder/tests/test_rbd.py @@ -451,7 +451,8 @@ class ManagedRBDTestCase(DriverTestCase): def _clone_volume_from_image(self, expected_status, clone_works=True): """Try to clone a volume from an image, and check the status - afterwards""" + afterwards. + """ def fake_clone_image(volume, image_location): return True diff --git a/cinder/tests/test_volume.py b/cinder/tests/test_volume.py index bdfe0154d..fdf7b8e9c 100644 --- a/cinder/tests/test_volume.py +++ b/cinder/tests/test_volume.py @@ -675,7 +675,8 @@ class VolumeTestCase(test.TestCase): def _create_volume_from_image(self, expected_status, fakeout_copy_image_to_volume=False): """Call copy image to volume, Test the status of volume after calling - copying image to volume.""" + copying image to volume. + """ def fake_local_path(volume): return dst_path @@ -719,12 +720,14 @@ class VolumeTestCase(test.TestCase): def test_create_volume_from_image_status_available(self): """Verify that before copying image to volume, it is in available - state.""" + state. + """ self._create_volume_from_image('available') def test_create_volume_from_image_exception(self): """Verify that create volume from image, the volume status is - 'downloading'.""" + 'downloading'. + """ dst_fd, dst_path = tempfile.mkstemp() os.close(dst_fd) @@ -869,7 +872,8 @@ class VolumeTestCase(test.TestCase): def test_create_volume_from_exact_sized_image(self): """Verify that an image which is exactly the same size as the - volume, will work correctly.""" + volume, will work correctly. + """ class _FakeImageService: def __init__(self, db_driver=None, image_service=None): pass diff --git a/cinder/tests/test_volume_types.py b/cinder/tests/test_volume_types.py index b11fa12ef..37210cb60 100644 --- a/cinder/tests/test_volume_types.py +++ b/cinder/tests/test_volume_types.py @@ -92,7 +92,8 @@ class VolumeTypeTestCase(test.TestCase): def test_default_volume_type_missing_in_db(self): """Ensures proper exception raised if default volume type - is not in database.""" + is not in database. + """ session = db_api.get_session() default_vol_type = volume_types.get_default_volume_type() self.assertEqual(default_vol_type, {}) diff --git a/cinder/utils.py b/cinder/utils.py index a303037e3..2109635b8 100644 --- a/cinder/utils.py +++ b/cinder/utils.py @@ -301,7 +301,8 @@ def last_completed_audit_period(unit=None): returns: 2 tuple of datetimes (begin, end) The begin timestamp of this audit period is the same as the - end of the previous.""" + end of the previous. + """ if not unit: unit = CONF.volume_usage_audit_period diff --git a/cinder/volume/api.py b/cinder/volume/api.py index 7d1510e40..6069eb60a 100644 --- a/cinder/volume/api.py +++ b/cinder/volume/api.py @@ -799,5 +799,6 @@ class HostAPI(base.Base): def set_host_maintenance(self, context, host, mode): """Start/Stop host maintenance window. On start, it triggers - volume evacuation.""" + volume evacuation. + """ raise NotImplementedError() diff --git a/cinder/volume/configuration.py b/cinder/volume/configuration.py index 893f4638a..81b5223dd 100644 --- a/cinder/volume/configuration.py +++ b/cinder/volume/configuration.py @@ -56,7 +56,8 @@ class Configuration(object): def __init__(self, volume_opts, config_group=None): """This takes care of grafting the implementation's config - values into the config group""" + values into the config group + """ self.config_group = config_group # set the local conf so that __call__'s know what to use diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index a6b445571..38e1e039e 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -100,7 +100,8 @@ class VolumeDriver(object): def create_volume(self, volume): """Creates a volume. Can optionally return a Dictionary of - changes to the volume object to be persisted.""" + changes to the volume object to be persisted. + """ raise NotImplementedError() def create_volume_from_snapshot(self, volume, snapshot): @@ -132,7 +133,8 @@ class VolumeDriver(object): def create_export(self, context, volume): """Exports the volume. Can optionally return a Dictionary of changes - to the volume object to be persisted.""" + to the volume object to be persisted. + """ raise NotImplementedError() def remove_export(self, context, volume): @@ -157,7 +159,8 @@ class VolumeDriver(object): def get_volume_stats(self, refresh=False): """Return the current state of the volume service. If 'refresh' is - True, run the update first.""" + True, run the update first. + """ return None def do_setup(self, context): @@ -514,7 +517,8 @@ class ISCSIDriver(VolumeDriver): def get_volume_stats(self, refresh=False): """Get volume status. - If 'refresh' is True, run update the stats first.""" + If 'refresh' is True, run update the stats first. + """ if refresh: self._update_volume_status() diff --git a/cinder/volume/drivers/glusterfs.py b/cinder/volume/drivers/glusterfs.py index 7220321e9..3dea75f13 100644 --- a/cinder/volume/drivers/glusterfs.py +++ b/cinder/volume/drivers/glusterfs.py @@ -49,7 +49,8 @@ CONF.register_opts(volume_opts) class GlusterfsDriver(nfs.RemoteFsDriver): """Gluster based cinder driver. Creates file on Gluster share for using it - as block device on hypervisor.""" + as block device on hypervisor. + """ def __init__(self, *args, **kwargs): super(GlusterfsDriver, self).__init__(*args, **kwargs) @@ -122,7 +123,8 @@ class GlusterfsDriver(nfs.RemoteFsDriver): def create_export(self, ctx, volume): """Exports the volume. Can optionally return a Dictionary of changes - to the volume object to be persisted.""" + to the volume object to be persisted. + """ pass def remove_export(self, ctx, volume): @@ -160,7 +162,8 @@ class GlusterfsDriver(nfs.RemoteFsDriver): def _ensure_shares_mounted(self): """Look for GlusterFS shares in the flags and try to mount them - locally.""" + locally. + """ self._mounted_shares = [] self._load_shares_config(self.configuration.glusterfs_shares_config) @@ -255,7 +258,8 @@ class GlusterfsDriver(nfs.RemoteFsDriver): def get_volume_stats(self, refresh=False): """Get volume stats. - If 'refresh' is True, update the stats first.""" + If 'refresh' is True, update the stats first. + """ if refresh or not self._stats: self._update_volume_stats() diff --git a/cinder/volume/drivers/lvm.py b/cinder/volume/drivers/lvm.py index f4705e2b1..3c214cc5f 100644 --- a/cinder/volume/drivers/lvm.py +++ b/cinder/volume/drivers/lvm.py @@ -156,7 +156,8 @@ class LVMVolumeDriver(driver.VolumeDriver): def create_volume(self, volume): """Creates a logical volume. Can optionally return a Dictionary of - changes to the volume object to be persisted.""" + changes to the volume object to be persisted. + """ self._create_volume(volume['name'], self._sizestr(volume['size'])) def create_volume_from_snapshot(self, volume, snapshot): @@ -550,7 +551,8 @@ class LVMISCSIDriver(LVMVolumeDriver, driver.ISCSIDriver): def get_volume_stats(self, refresh=False): """Get volume status. - If 'refresh' is True, run update the stats first.""" + If 'refresh' is True, run update the stats first. + """ if refresh: self._update_volume_status() @@ -643,7 +645,8 @@ class ThinLVMVolumeDriver(LVMISCSIDriver): def create_volume(self, volume): """Creates a logical volume. Can optionally return a Dictionary of - changes to the volume object to be persisted.""" + changes to the volume object to be persisted. + """ sizestr = self._sizestr(volume['size']) vg_name = ("%s/%s-pool" % (self.configuration.volume_group, self.configuration.volume_group)) @@ -674,7 +677,8 @@ class ThinLVMVolumeDriver(LVMISCSIDriver): def get_volume_stats(self, refresh=False): """Get volume status. - If 'refresh' is True, run update the stats first.""" + If 'refresh' is True, run update the stats first. + """ if refresh: self._update_volume_status() diff --git a/cinder/volume/drivers/netapp/api.py b/cinder/volume/drivers/netapp/api.py index 241a22daa..f0dc91f84 100644 --- a/cinder/volume/drivers/netapp/api.py +++ b/cinder/volume/drivers/netapp/api.py @@ -366,7 +366,8 @@ class NaElement(object): def add_new_child(self, name, content, convert=False): """Add child with tag name and context. - Convert replaces entity refs to chars.""" + Convert replaces entity refs to chars. + """ child = NaElement(name) if convert: content = NaElement._convert_entity_refs(content) diff --git a/cinder/volume/drivers/netapp/iscsi.py b/cinder/volume/drivers/netapp/iscsi.py index fce49dadd..a68e3dd66 100644 --- a/cinder/volume/drivers/netapp/iscsi.py +++ b/cinder/volume/drivers/netapp/iscsi.py @@ -1109,7 +1109,8 @@ class NetAppISCSIDriver(driver.ISCSIDriver): def get_volume_stats(self, refresh=False): """Get volume status. - If 'refresh' is True, run update the stats first.""" + If 'refresh' is True, run update the stats first. + """ if refresh: self._update_volume_status() @@ -1959,7 +1960,8 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver): def get_volume_stats(self, refresh=False): """Get volume status. - If 'refresh' is True, run update the stats first.""" + If 'refresh' is True, run update the stats first. + """ if refresh: self._update_volume_status() diff --git a/cinder/volume/drivers/netapp/nfs.py b/cinder/volume/drivers/netapp/nfs.py index 885c619ea..05322d74c 100644 --- a/cinder/volume/drivers/netapp/nfs.py +++ b/cinder/volume/drivers/netapp/nfs.py @@ -103,7 +103,8 @@ class NetAppNFSDriver(nfs.NfsDriver): def _check_dfm_flags(self): """Raises error if any required configuration flag for OnCommand proxy - is missing.""" + is missing. + """ required_flags = ['netapp_wsdl_url', 'netapp_login', 'netapp_password', @@ -325,7 +326,8 @@ class NetAppCmodeNfsDriver (NetAppNFSDriver): def _check_flags(self): """Raises error if any required configuration flag for NetApp Cloud - Webservices is missing.""" + Webservices is missing. + """ required_flags = ['netapp_wsdl_url', 'netapp_login', 'netapp_password', @@ -376,7 +378,8 @@ class NetAppDirectNfsDriver (NetAppNFSDriver): def _check_flags(self): """Raises error if any required configuration flag for NetApp - filer is missing.""" + filer is missing. + """ required_flags = ['netapp_login', 'netapp_password', 'netapp_server_hostname', diff --git a/cinder/volume/drivers/nexenta/volume.py b/cinder/volume/drivers/nexenta/volume.py index 2444bc2ff..ffefa2fa0 100644 --- a/cinder/volume/drivers/nexenta/volume.py +++ b/cinder/volume/drivers/nexenta/volume.py @@ -298,7 +298,8 @@ class NexentaDriver(driver.ISCSIDriver): # pylint: disable=R0921 def get_volume_stats(self, refresh=False): """Get volume status. - If 'refresh' is True, run update the stats first.""" + If 'refresh' is True, run update the stats first. + """ if refresh: self._update_volume_status() diff --git a/cinder/volume/drivers/nfs.py b/cinder/volume/drivers/nfs.py index bb15377e0..275b61000 100644 --- a/cinder/volume/drivers/nfs.py +++ b/cinder/volume/drivers/nfs.py @@ -78,7 +78,8 @@ class RemoteFsDriver(driver.VolumeDriver): def delete_snapshot(self, snapshot): """Do nothing for this driver, but allow manager to handle deletion - of snapshot in error state.""" + of snapshot in error state. + """ pass def ensure_export(self, ctx, volume): @@ -91,7 +92,8 @@ class RemoteFsDriver(driver.VolumeDriver): def _create_regular_file(self, path, size): """Creates regular file of given size. Takes a lot of time for large - files.""" + files. + """ block_size_mb = 1 block_count = size * units.GiB / (block_size_mb * units.MiB) @@ -115,7 +117,8 @@ class RemoteFsDriver(driver.VolumeDriver): def _get_hash_str(self, base_str): """returns string that represents hash of base_str - (in a hex format).""" + (in a hex format). + """ return hashlib.md5(base_str).hexdigest() def copy_image_to_volume(self, context, volume, image_service, image_id): @@ -185,7 +188,8 @@ class RemoteFsDriver(driver.VolumeDriver): class NfsDriver(RemoteFsDriver): """NFS based cinder driver. Creates file on NFS share for using it - as block device on hypervisor.""" + as block device on hypervisor. + """ def __init__(self, *args, **kwargs): super(NfsDriver, self).__init__(*args, **kwargs) self.configuration.append_config_values(volume_opts) @@ -265,7 +269,8 @@ class NfsDriver(RemoteFsDriver): def create_export(self, ctx, volume): """Exports the volume. Can optionally return a Dictionary of changes - to the volume object to be persisted.""" + to the volume object to be persisted. + """ pass def remove_export(self, ctx, volume): @@ -433,7 +438,8 @@ class NfsDriver(RemoteFsDriver): def get_volume_stats(self, refresh=False): """Get volume status. - If 'refresh' is True, run update the stats first.""" + If 'refresh' is True, run update the stats first. + """ if refresh or not self._stats: self._update_volume_status() diff --git a/cinder/volume/drivers/rbd.py b/cinder/volume/drivers/rbd.py index 3ee97b30e..d8dbd3895 100644 --- a/cinder/volume/drivers/rbd.py +++ b/cinder/volume/drivers/rbd.py @@ -225,7 +225,8 @@ class RBDDriver(driver.VolumeDriver): def get_volume_stats(self, refresh=False): """Return the current state of the volume service. If 'refresh' is - True, run the update first.""" + True, run the update first. + """ if refresh: self._update_volume_stats() return self._stats diff --git a/cinder/volume/drivers/storwize_svc.py b/cinder/volume/drivers/storwize_svc.py index 3cd9a15d9..b9eacc494 100755 --- a/cinder/volume/drivers/storwize_svc.py +++ b/cinder/volume/drivers/storwize_svc.py @@ -1336,7 +1336,8 @@ class StorwizeSVCDriver(san.SanISCSIDriver): """Get volume status. If we haven't gotten stats yet or 'refresh' is True, - run update the stats first.""" + run update the stats first. + """ if not self._stats or refresh: self._update_volume_status() diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 4f4b3d8ad..920d265d9 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -135,7 +135,8 @@ class VolumeManager(manager.SchedulerDependentManager): def init_host(self): """Do any initialization that needs to be run if this is a - standalone service.""" + standalone service. + """ ctxt = context.get_admin_context() self.driver.do_setup(ctxt) diff --git a/cinder/volume/utils.py b/cinder/volume/utils.py index 3970ea4cd..f24b47bd9 100644 --- a/cinder/volume/utils.py +++ b/cinder/volume/utils.py @@ -43,7 +43,8 @@ def notify_usage_exists(context, volume_ref, current_period=False): purposes. Generates usage for last completed period, unless 'current_period' - is True.""" + is True. + """ begin, end = utils.last_completed_audit_period() if current_period: audit_start = end diff --git a/tox.ini b/tox.ini index 9620047f9..46ea3d143 100644 --- a/tox.ini +++ b/tox.ini @@ -43,6 +43,6 @@ commands = commands = {posargs} [flake8] -ignore = E711,E712,F401,F403,F811,F841,H302,H303,H304,H401,H402,H403,H404 +ignore = E711,E712,F401,F403,F811,F841,H302,H303,H304,H401,H402,H404 builtins = _ exclude = .venv,.tox,dist,doc,openstack,*egg -- 2.45.2