Fix error message when running genconfig
The Fujitsu eternus_dx_common code was configured to try to import pywbem and immediately throw an error in the case that the module wasn't available. This would cause the error to be reported during the genconfig process. This patch changes the driver to just attempt to import the module and record whether it was successful. If not, the error message isn't reported until __init__ is called. This approach is consistent with what EMC does in their drivers for importing pywbem. Change-Id: I4f7d90bc2d05bde653f9d64fdb183ebf639fe3d4 Closes-bug: 1558644
This commit is contained in:
parent
4e062bd664
commit
3c6b224719
|
@ -39,10 +39,9 @@ CONF = cfg.CONF
|
|||
|
||||
try:
|
||||
import pywbem
|
||||
pywbemAvailable = True
|
||||
except ImportError:
|
||||
msg = _LE('import pywbem failed!! '
|
||||
'pywbem is necessary for this volume driver.')
|
||||
LOG.error(msg)
|
||||
pywbemAvailable = False
|
||||
|
||||
VOL_PREFIX = "FJosv_"
|
||||
RAIDGROUP = 2
|
||||
|
@ -154,6 +153,11 @@ class FJDXCommon(object):
|
|||
}
|
||||
|
||||
def __init__(self, prtcl, configuration=None):
|
||||
|
||||
if not pywbemAvailable:
|
||||
LOG.error(_LE('import pywbem failed!! '
|
||||
'pywbem is necessary for this volume driver.'))
|
||||
|
||||
self.protocol = prtcl
|
||||
self.configuration = configuration
|
||||
self.configuration.append_config_values(FJ_ETERNUS_DX_OPT_opts)
|
||||
|
|
Loading…
Reference in New Issue