VNX:Add more check on replication_device keys
This change makes following keys optional * san_login, san_password, storage_vnx_authentication_type, * storage_vnx_security_file_dir and the following keys mandatory: * backend_id, san_ip DocImpact Closes-bug: 1627569 Change-Id: I01d7f8c3d752761d3347d3fc24bad1291ebbee41
This commit is contained in:
parent
ed909a8ed3
commit
8f845056fd
@ -209,6 +209,22 @@ class TestReplicationDeviceList(test.TestCase):
|
||||
self.assertEqual('global', device.storage_vnx_authentication_type)
|
||||
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):
|
||||
devices_list = common.ReplicationDeviceList(self.configuration)
|
||||
device = devices_list.get_device('array_id_not_existed')
|
||||
|
@ -359,27 +359,29 @@ class ReplicationDevice(object):
|
||||
|
||||
@property
|
||||
def backend_id(self):
|
||||
return self.replication_device['backend_id']
|
||||
return self.replication_device.get('backend_id')
|
||||
|
||||
@property
|
||||
def san_ip(self):
|
||||
return self.replication_device['san_ip']
|
||||
return self.replication_device.get('san_ip')
|
||||
|
||||
@property
|
||||
def san_login(self):
|
||||
return self.replication_device['san_login']
|
||||
return self.replication_device.get('san_login')
|
||||
|
||||
@property
|
||||
def san_password(self):
|
||||
return self.replication_device['san_password']
|
||||
return self.replication_device.get('san_password')
|
||||
|
||||
@property
|
||||
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
|
||||
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):
|
||||
@ -399,6 +401,10 @@ class ReplicationDeviceList(list):
|
||||
if self.configuration.replication_device:
|
||||
for replication_device in self.configuration.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.list.append(rd)
|
||||
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