Merge "IBM storage: check pyxcli version on initialize"
This commit is contained in:
commit
580453e70a
@ -26,6 +26,7 @@ pyxcli_client.events = mock.Mock()
|
|||||||
pyxcli_client.mirroring = mock.Mock()
|
pyxcli_client.mirroring = mock.Mock()
|
||||||
pyxcli_client.transports = fake_pyxcli_exceptions
|
pyxcli_client.transports = fake_pyxcli_exceptions
|
||||||
pyxcli_client.mirroring.cg_recovery_manager = mock.Mock()
|
pyxcli_client.mirroring.cg_recovery_manager = mock.Mock()
|
||||||
|
pyxcli_client.version = '1.1.5'
|
||||||
|
|
||||||
sys.modules['pyxcli'] = pyxcli_client
|
sys.modules['pyxcli'] = pyxcli_client
|
||||||
sys.modules['pyxcli.events'] = pyxcli_client.events
|
sys.modules['pyxcli.events'] = pyxcli_client.events
|
||||||
|
@ -150,6 +150,23 @@ class XIVProxyTest(test.TestCase):
|
|||||||
'san_password': REPLICA_PASSWORD,
|
'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"
|
@mock.patch("cinder.volume.drivers.ibm.ibm_storage"
|
||||||
".xiv_proxy.socket.getfqdn", new=mock.MagicMock(
|
".xiv_proxy.socket.getfqdn", new=mock.MagicMock(
|
||||||
return_value='test_hostname'))
|
return_value='test_hostname'))
|
||||||
|
@ -57,6 +57,7 @@ SYNC = 'sync'
|
|||||||
ASYNC = 'async'
|
ASYNC = 'async'
|
||||||
SYNC_TIMEOUT = 300
|
SYNC_TIMEOUT = 300
|
||||||
SYNCHED_STATES = ['synchronized', 'rpo ok']
|
SYNCHED_STATES = ['synchronized', 'rpo ok']
|
||||||
|
PYXCLI_VERSION = '1.1.5'
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
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': "
|
MANAGE_VOLUME_BASE_ERROR = _("Unable to manage the volume '%(volume)s': "
|
||||||
"%(error)s.")
|
"%(error)s.")
|
||||||
|
|
||||||
|
INCOMPATIBLE_PYXCLI = _('Incompatible pyxcli found. Required: %(required)s '
|
||||||
|
'Found: %(found)s')
|
||||||
|
|
||||||
|
|
||||||
class XIVProxy(proxy.IBMStorageProxy):
|
class XIVProxy(proxy.IBMStorageProxy):
|
||||||
"""Proxy between the Cinder Volume and Spectrum Accelerate Storage.
|
"""Proxy between the Cinder Volume and Spectrum Accelerate Storage.
|
||||||
@ -134,6 +138,22 @@ class XIVProxy(proxy.IBMStorageProxy):
|
|||||||
|
|
||||||
@proxy._trace_time
|
@proxy._trace_time
|
||||||
def setup(self, context):
|
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."""
|
"""Connect ssl client."""
|
||||||
LOG.info("Setting up connection to %(title)s...\n"
|
LOG.info("Setting up connection to %(title)s...\n"
|
||||||
"Active backend_id: '%(id)s'.",
|
"Active backend_id: '%(id)s'.",
|
||||||
|
@ -25,7 +25,7 @@ python-lefthandclient>=2.0.0 # Apache-2.0
|
|||||||
pywbem>=0.7.0 # LGPLv2.1+
|
pywbem>=0.7.0 # LGPLv2.1+
|
||||||
|
|
||||||
# IBM XIV
|
# IBM XIV
|
||||||
pyxcli>=1.1.0 # Apache-2.0
|
pyxcli>=1.1.5 # Apache-2.0
|
||||||
|
|
||||||
# RBD
|
# RBD
|
||||||
rados # LGPLv2.1
|
rados # LGPLv2.1
|
||||||
|
Loading…
Reference in New Issue
Block a user