]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fixes the import for Lefthand driver
authorWalter A. Boring IV <walter.boring@hp.com>
Thu, 26 Feb 2015 19:43:13 +0000 (11:43 -0800)
committerWalter A. Boring IV <walter.boring@hp.com>
Thu, 26 Feb 2015 19:47:21 +0000 (11:47 -0800)
Review 145780 broke the lefthand driver.  The author and reviewers
did not even bother to look at the 3rd party CI results that clearly
showed that this patch broke the hplefthand driver, due to changing
the imports.  The change removed an import to one of the hplefthandclient
modules, which was then later accessed.

Reviewers, please check 3rd party CI when a cinder patch touches a driver.

Authors of patches, if you touch a driver, you need to check the 3rd party
CI failures and make sure your patch changes aren't causing the failures.

Change-Id: Ie38f77fc9498915651c476ea10bc7bd7f49e393d
Partial-Bug: 1407162

cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py

index 35e7275c409fee4325ccbdfc108ce27a9cd0d879..890596976bebc88ccf28a38adc238cdd794cf5ae 100644 (file)
@@ -16,6 +16,7 @@
 """HP LeftHand SAN ISCSI REST Proxy."""
 
 from oslo_config import cfg
+from oslo_utils import importutils
 from oslo_utils import units
 
 from cinder import context
@@ -28,11 +29,10 @@ from cinder.volume import volume_types
 
 LOG = logging.getLogger(__name__)
 
-try:
-    import hplefthandclient
+hplefthandclient = importutils.try_import("hplefthandclient")
+if hplefthandclient:
+    from hplefthandclient import client as hp_lh_client
     from hplefthandclient import exceptions as hpexceptions
-except ImportError:
-    import cinder.tests.fake_hp_lefthand_client as hplefthandclient
 
 hplefthand_opts = [
     cfg.StrOpt('hplefthand_api_url',
@@ -120,7 +120,7 @@ class HPLeftHandRESTProxy(driver.ISCSIDriver):
         client.logout()
 
     def _create_client(self):
-        return hplefthandclient.client.HPLeftHandClient(
+        return hp_lh_client.HPLeftHandClient(
             self.configuration.hplefthand_api_url)
 
     def do_setup(self, context):
@@ -321,8 +321,8 @@ class HPLeftHandRESTProxy(driver.ISCSIDriver):
 
             iscsi_properties = self._get_iscsi_properties(volume)
 
-            if ('chapAuthenticationRequired' in server_info
-                    and server_info['chapAuthenticationRequired']):
+            if ('chapAuthenticationRequired' in server_info and
+                    server_info['chapAuthenticationRequired']):
                 iscsi_properties['auth_method'] = 'CHAP'
                 iscsi_properties['auth_username'] = connector['initiator']
                 iscsi_properties['auth_password'] = (