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
This commit is contained in:
Samantha Blanco 2016-11-04 14:18:59 -04:00
parent 366acd02b4
commit d3ffcd5008

View File

@ -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 "