IBM storage: check pyxcli version on initialize
The IBM storage driver is using a python client called pyxcli. the client is: https://github.com/IBM/pyxcli Upon initialization of IBM Storage driver need to check if the required client version is installed. Change-Id: I664c0419b91952bc046c28d2474f52266bdbc351 Closes-Bug: 1696470
This commit is contained in:
parent
212b045a02
commit
71ff2adb6d
@ -26,6 +26,7 @@ pyxcli_client.events = mock.Mock()
|
||||
pyxcli_client.mirroring = mock.Mock()
|
||||
pyxcli_client.transports = fake_pyxcli_exceptions
|
||||
pyxcli_client.mirroring.cg_recovery_manager = mock.Mock()
|
||||
pyxcli_client.version = '1.1.5'
|
||||
|
||||
sys.modules['pyxcli'] = pyxcli_client
|
||||
sys.modules['pyxcli.events'] = pyxcli_client.events
|
||||
|
@ -150,6 +150,23 @@ class XIVProxyTest(test.TestCase):
|
||||
'san_password': REPLICA_PASSWORD,
|
||||
}
|
||||
|
||||
@mock.patch("cinder.volume.drivers.ibm.ibm_storage."
|
||||
"xiv_proxy.pyxcli")
|
||||
def test_wrong_pyxcli(self, mock_pyxcli):
|
||||
|
||||
driver = mock.MagicMock()
|
||||
driver.VERSION = "VERSION"
|
||||
|
||||
p = self.proxy(
|
||||
self.default_storage_info,
|
||||
mock.MagicMock(),
|
||||
test_mock.cinder.exception,
|
||||
driver)
|
||||
|
||||
mock_pyxcli.version = '1.1.4'
|
||||
self.assertRaises(test_mock.cinder.exception.CinderException,
|
||||
p.setup, {})
|
||||
|
||||
@mock.patch("cinder.volume.drivers.ibm.ibm_storage"
|
||||
".xiv_proxy.socket.getfqdn", new=mock.MagicMock(
|
||||
return_value='test_hostname'))
|
||||
|
@ -57,6 +57,7 @@ SYNC = 'sync'
|
||||
ASYNC = 'async'
|
||||
SYNC_TIMEOUT = 300
|
||||
SYNCHED_STATES = ['synchronized', 'rpo ok']
|
||||
PYXCLI_VERSION = '1.1.5'
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -95,6 +96,9 @@ DELETE_VOLUME_BASE_ERROR = ("Unable to delete volume '%(volume)s': "
|
||||
MANAGE_VOLUME_BASE_ERROR = _("Unable to manage the volume '%(volume)s': "
|
||||
"%(error)s.")
|
||||
|
||||
INCOMPATIBLE_PYXCLI = _('Incompatible pyxcli found. Required: %(required)s '
|
||||
'Found: %(found)s')
|
||||
|
||||
|
||||
class XIVProxy(proxy.IBMStorageProxy):
|
||||
"""Proxy between the Cinder Volume and Spectrum Accelerate Storage.
|
||||
@ -132,6 +136,22 @@ class XIVProxy(proxy.IBMStorageProxy):
|
||||
|
||||
@proxy._trace_time
|
||||
def setup(self, context):
|
||||
msg = ''
|
||||
if pyxcli:
|
||||
if pyxcli.version != PYXCLI_VERSION:
|
||||
msg = (INCOMPATIBLE_PYXCLI %
|
||||
{'required': PYXCLI_VERSION,
|
||||
'found': pyxcli.version
|
||||
})
|
||||
else:
|
||||
msg = (SETUP_BASE_ERROR %
|
||||
{'title': strings.TITLE,
|
||||
'details': "IBM Python XCLI Client (pyxcli) not found"
|
||||
})
|
||||
if msg != '':
|
||||
LOG.error(msg)
|
||||
raise self._get_exception()(msg)
|
||||
|
||||
"""Connect ssl client."""
|
||||
LOG.info("Setting up connection to %(title)s...\n"
|
||||
"Active backend_id: '%(id)s'.",
|
||||
|
@ -25,7 +25,7 @@ python-lefthandclient>=2.0.0 # Apache-2.0
|
||||
pywbem>=0.7.0 # LGPLv2.1+
|
||||
|
||||
# IBM XIV
|
||||
pyxcli>=1.1.0 # Apache-2.0
|
||||
pyxcli>=1.1.5 # Apache-2.0
|
||||
|
||||
# RBD
|
||||
rados # LGPLv2.1
|
||||
|
Loading…
Reference in New Issue
Block a user