From: Walter A. Boring IV Date: Tue, 13 Aug 2013 18:53:06 +0000 (-0700) Subject: Fixes some unseen flake8 violations. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=7c899c9b7750fe822a47496243ae075f9d3dc51b;p=openstack-build%2Fcinder-build.git Fixes some unseen flake8 violations. The failures aren't visible when run from cinder. Nova has different settings for flake8. This patch fixes the violations that nova's flake8 tests. fixes Bug #1211935 Change-Id: I80209130de23842a0a35cacb7d59f166e7dba89f --- diff --git a/cinder/brick/exception.py b/cinder/brick/exception.py index b3de34298..5f96435e0 100644 --- a/cinder/brick/exception.py +++ b/cinder/brick/exception.py @@ -20,6 +20,7 @@ import sys from oslo.config import cfg +from cinder.openstack.common.gettextutils import _ from cinder.openstack.common import log as logging diff --git a/cinder/brick/initiator/connector.py b/cinder/brick/initiator/connector.py index 26a706755..fe4e308bc 100644 --- a/cinder/brick/initiator/connector.py +++ b/cinder/brick/initiator/connector.py @@ -15,10 +15,6 @@ # License for the specific language governing permissions and limitations # under the License. -import executor -import host_driver -import linuxfc -import linuxscsi import os import socket import time @@ -26,6 +22,10 @@ import time from oslo.config import cfg from cinder.brick import exception +from cinder.brick.initiator import executor +from cinder.brick.initiator import host_driver +from cinder.brick.initiator import linuxfc +from cinder.brick.initiator import linuxscsi from cinder.openstack.common.gettextutils import _ from cinder.openstack.common import lockutils from cinder.openstack.common import log as logging @@ -74,17 +74,19 @@ class InitiatorConnector(executor.Executor): self.driver = driver @staticmethod - def factory(protocol, execute=putils.execute, + def factory(protocol, driver=None, execute=putils.execute, root_helper="sudo", use_multipath=False): """Build a Connector object based upon protocol.""" LOG.debug("Factory for %s" % protocol) protocol = protocol.upper() if protocol == "ISCSI": return ISCSIConnector(execute=execute, + driver=driver, root_helper=root_helper, use_multipath=use_multipath) elif protocol == "FIBRE_CHANNEL": return FibreChannelConnector(execute=execute, + driver=driver, root_helper=root_helper, use_multipath=use_multipath) else: @@ -132,10 +134,14 @@ class ISCSIConnector(InitiatorConnector): def __init__(self, driver=None, execute=putils.execute, root_helper="sudo", use_multipath=False, *args, **kwargs): + self._linuxscsi = linuxscsi.LinuxSCSI(execute, root_helper) super(ISCSIConnector, self).__init__(driver, execute, root_helper, *args, **kwargs) self.use_multipath = use_multipath - self._linuxscsi = linuxscsi.LinuxSCSI(execute, root_helper) + + def set_execute(self, execute): + super(ISCSIConnector, self).set_execute(execute) + self._linuxscsi.set_execute(execute) @synchronized('connect_volume') def connect_volume(self, connection_properties): @@ -466,12 +472,17 @@ class FibreChannelConnector(InitiatorConnector): def __init__(self, driver=None, execute=putils.execute, root_helper="sudo", use_multipath=False, *args, **kwargs): + self._linuxscsi = linuxscsi.LinuxSCSI(execute, root_helper) + self._linuxfc = linuxfc.LinuxFibreChannel(execute, root_helper) super(FibreChannelConnector, self).__init__(driver, execute, root_helper, *args, **kwargs) self.use_multipath = use_multipath - self._linuxscsi = linuxscsi.LinuxSCSI(execute, root_helper) - self._linuxfc = linuxfc.LinuxFibreChannel(execute, root_helper) + + def set_execute(self, execute): + super(FibreChannelConnector, self).set_execute(execute) + self._linuxscsi.set_execute(execute) + self._linuxfc.set_execute(execute) @synchronized('connect_volume') def connect_volume(self, connection_properties): diff --git a/cinder/brick/initiator/host_driver.py b/cinder/brick/initiator/host_driver.py index e675b3705..eb5f8ffe5 100644 --- a/cinder/brick/initiator/host_driver.py +++ b/cinder/brick/initiator/host_driver.py @@ -21,7 +21,7 @@ import os class HostDriver(object): def get_all_block_devices(self): - """Get the list of all block devices seen in /dev/disk/by-path/""" + """Get the list of all block devices seen in /dev/disk/by-path/.""" dir = "/dev/disk/by-path/" files = os.listdir(dir) devices = [] diff --git a/cinder/brick/initiator/linuxfc.py b/cinder/brick/initiator/linuxfc.py index 6be22253d..5878bf1f5 100644 --- a/cinder/brick/initiator/linuxfc.py +++ b/cinder/brick/initiator/linuxfc.py @@ -17,9 +17,8 @@ """Generic linux Fibre Channel utilities.""" import errno -import executor -import linuxscsi +from cinder.brick.initiator import linuxscsi from cinder.openstack.common.gettextutils import _ from cinder.openstack.common import log as logging from cinder.openstack.common import processutils as putils diff --git a/cinder/brick/initiator/linuxscsi.py b/cinder/brick/initiator/linuxscsi.py index f197d3b7c..5a4a2e65b 100644 --- a/cinder/brick/initiator/linuxscsi.py +++ b/cinder/brick/initiator/linuxscsi.py @@ -18,13 +18,11 @@ Note, this is not iSCSI. """ - -import executor import os +from cinder.brick.initiator import executor from cinder.openstack.common.gettextutils import _ from cinder.openstack.common import log as logging -from cinder.openstack.common import loopingcall from cinder.openstack.common import processutils as putils LOG = logging.getLogger(__name__) diff --git a/cinder/brick/iscsi/iscsi.py b/cinder/brick/iscsi/iscsi.py index ec17e3181..c68fbf0e2 100644 --- a/cinder/brick/iscsi/iscsi.py +++ b/cinder/brick/iscsi/iscsi.py @@ -85,11 +85,11 @@ class TargetAdmin(object): def create_iscsi_target(self, name, tid, lun, path, chap_auth=None, **kwargs): - """Create a iSCSI target and logical unit""" + """Create a iSCSI target and logical unit.""" raise NotImplementedError() def remove_iscsi_target(self, tid, lun, vol_id, **kwargs): - """Remove a iSCSI target and logical unit""" + """Remove a iSCSI target and logical unit.""" raise NotImplementedError() def _new_target(self, name, tid, **kwargs):