From d3ffcd500875f8f48752ce9945f57fd73972d67c Mon Sep 17 00:00:00 2001 From: Samantha Blanco Date: Fri, 4 Nov 2016 14:18:59 -0400 Subject: [PATCH] Fixes hpelefthandclient AttributeError Adds check during setup in hpe_lefthand_iscsi.py to see if python-lefthandclient is installed. Change-Id: Ia2dce33e0f72132167edeccdefa46d253f40c2cd Closes-Bug: #1525321 --- cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py b/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py index f97d0a2d3a0..9a9729f9918 100644 --- a/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py +++ b/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py @@ -329,6 +329,14 @@ class HPELeftHandISCSIDriver(driver.ISCSIDriver): def do_setup(self, context): """Set up LeftHand client.""" + if not hpelefthandclient: + # Checks if client was successfully imported + ex_msg = (_("HPELeftHand client is not installed. Please" + " install using 'pip install " + "python-lefthandclient'.")) + LOG.error(ex_msg) + raise exception.VolumeDriverException(ex_msg) + if hpelefthandclient.version < MIN_CLIENT_VERSION: ex_msg = (_("Invalid hpelefthandclient version found (" "%(found)s). Version %(minimum)s or greater "