]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fixes some unseen flake8 violations.
authorWalter A. Boring IV <walter.boring@hp.com>
Tue, 13 Aug 2013 18:53:06 +0000 (11:53 -0700)
committerWalter A. Boring IV <walter.boring@hp.com>
Tue, 13 Aug 2013 19:14:49 +0000 (12:14 -0700)
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

cinder/brick/exception.py
cinder/brick/initiator/connector.py
cinder/brick/initiator/host_driver.py
cinder/brick/initiator/linuxfc.py
cinder/brick/initiator/linuxscsi.py
cinder/brick/iscsi/iscsi.py

index b3de34298ba7a825376c1a1311b3434e75508d60..5f96435e0784496b82c0388c354573bff634bf70 100644 (file)
@@ -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
 
 
index 26a706755c71e03f7b9dcc8e1317552596b973ca..fe4e308bc4ab225b5defd3ecff3994d0665158b0 100644 (file)
 #    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):
index e675b3705931ef8574cee9d202649887af825a8b..eb5f8ffe5598237b36c3ae51821cbef27bbc428d 100644 (file)
@@ -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 = []
index 6be22253d3c10d57295a9e032728d006fd25e0b7..5878bf1f5571a3c4acfc8dcadbeef50ab8b39c6f 100644 (file)
@@ -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
index f197d3b7c2e74f11c9d8f5ad86444c2de26e5a7e..5a4a2e65b65064b46b38b2193030df5ec30ac0aa 100644 (file)
 
    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__)
index ec17e3181952232b12b083120ed315a8e9c45837..c68fbf0e29af3fbdfd8ecc8964962b2ecfca6be7 100644 (file)
@@ -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):