From: Walter A. Boring IV Date: Thu, 26 Feb 2015 19:43:13 +0000 (-0800) Subject: Fixes the import for Lefthand driver X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=851557c273b16c26a810bc3add9768f2091f5a76;p=openstack-build%2Fcinder-build.git Fixes the import for Lefthand driver 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 --- diff --git a/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py b/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py index 35e7275c4..890596976 100644 --- a/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py +++ b/cinder/volume/drivers/san/hp/hp_lefthand_rest_proxy.py @@ -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'] = (