Merge "VNX:Add more check on replication_device keys"
This commit is contained in:
commit
4093bb6946
@ -209,6 +209,22 @@ class TestReplicationDeviceList(test.TestCase):
|
|||||||
self.assertEqual('global', device.storage_vnx_authentication_type)
|
self.assertEqual('global', device.storage_vnx_authentication_type)
|
||||||
self.assertEqual('/home/stack/', device.storage_vnx_security_file_dir)
|
self.assertEqual('/home/stack/', device.storage_vnx_security_file_dir)
|
||||||
|
|
||||||
|
def test_device_no_backend_id(self):
|
||||||
|
device = {'san_ip': '192.168.1.2'}
|
||||||
|
config = FakeConfiguration()
|
||||||
|
config.replication_device = [device]
|
||||||
|
self.assertRaises(
|
||||||
|
exception.InvalidInput,
|
||||||
|
common.ReplicationDeviceList, config)
|
||||||
|
|
||||||
|
def test_device_no_secfile(self):
|
||||||
|
device = {'backend_id': 'test_id',
|
||||||
|
'san_ip': '192.168.1.2'}
|
||||||
|
config = FakeConfiguration()
|
||||||
|
config.replication_device = [device]
|
||||||
|
rep_list = common.ReplicationDeviceList(config)
|
||||||
|
self.assertIsNone(rep_list[0].storage_vnx_security_file_dir)
|
||||||
|
|
||||||
def test_get_device_not_found(self):
|
def test_get_device_not_found(self):
|
||||||
devices_list = common.ReplicationDeviceList(self.configuration)
|
devices_list = common.ReplicationDeviceList(self.configuration)
|
||||||
device = devices_list.get_device('array_id_not_existed')
|
device = devices_list.get_device('array_id_not_existed')
|
||||||
|
@ -359,27 +359,29 @@ class ReplicationDevice(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def backend_id(self):
|
def backend_id(self):
|
||||||
return self.replication_device['backend_id']
|
return self.replication_device.get('backend_id')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def san_ip(self):
|
def san_ip(self):
|
||||||
return self.replication_device['san_ip']
|
return self.replication_device.get('san_ip')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def san_login(self):
|
def san_login(self):
|
||||||
return self.replication_device['san_login']
|
return self.replication_device.get('san_login')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def san_password(self):
|
def san_password(self):
|
||||||
return self.replication_device['san_password']
|
return self.replication_device.get('san_password')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def storage_vnx_authentication_type(self):
|
def storage_vnx_authentication_type(self):
|
||||||
return self.replication_device['storage_vnx_authentication_type']
|
return self.replication_device.get(
|
||||||
|
'storage_vnx_authentication_type',
|
||||||
|
'global')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def storage_vnx_security_file_dir(self):
|
def storage_vnx_security_file_dir(self):
|
||||||
return self.replication_device['storage_vnx_security_file_dir']
|
return self.replication_device.get('storage_vnx_security_file_dir')
|
||||||
|
|
||||||
|
|
||||||
class ReplicationDeviceList(list):
|
class ReplicationDeviceList(list):
|
||||||
@ -399,6 +401,10 @@ class ReplicationDeviceList(list):
|
|||||||
if self.configuration.replication_device:
|
if self.configuration.replication_device:
|
||||||
for replication_device in self.configuration.replication_device:
|
for replication_device in self.configuration.replication_device:
|
||||||
rd = ReplicationDevice(replication_device)
|
rd = ReplicationDevice(replication_device)
|
||||||
|
if not rd.backend_id or not rd.san_ip:
|
||||||
|
msg = _('backend_id or san_ip cannot be empty for '
|
||||||
|
'replication_device.')
|
||||||
|
raise exception.InvalidInput(reason=msg)
|
||||||
self._device_map[rd.backend_id] = rd
|
self._device_map[rd.backend_id] = rd
|
||||||
self.list.append(rd)
|
self.list.append(rd)
|
||||||
return self._device_map
|
return self._device_map
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- In VNX Cinder driver, ``replication_device`` keys, ``backend_id`` and
|
||||||
|
``san_ip`` are mandatory now. If you prefer security file authentication,
|
||||||
|
please append ``storage_vnx_security_file_dir`` in ``replication_device``,
|
||||||
|
otherwise, append ``san_login``, ``san_password``,
|
||||||
|
``storage_vnx_authentication_type`` in ``replication_device``.
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user