Merge "Fix: storage_pools key in Huawei Driver"

This commit is contained in:
Zuul 2018-12-07 10:55:41 +00:00 committed by Gerrit Code Review
commit 3343b0e09f
2 changed files with 38 additions and 2 deletions

View File

@ -5622,6 +5622,42 @@ class HuaweiConfTestCase(test.TestCase):
self.assertRaises(expect_result,
self.huawei_conf._lun_type, xml_root)
@ddt.data(
[{
'backend_id': "default",
'san_address': 'https://192.0.2.69:8088/deviceManager/rest/',
'san_user': 'admin',
'san_password': '123456',
'storage_pool': 'OpenStack_Pool',
'iscsi_info': """{Name:iqn.1993-08.debian:01:ec2bff7acxxx;
TargetIP:1.1.1.1;
CHAPinfo:mm-user@storage;
ALUA:1;
TargetPortGroup:portgroup-test}"""
}]
)
def test_get_replication_devices(self, config):
self.mock_object(self.conf,
'safe_get',
mock.Mock(return_value=config)
)
replication_devices = self.huawei_conf.get_replication_devices()
expected = [
{'backend_id': 'default',
'iscsi_default_target_ip': [],
'iscsi_info': [{'ALUA': '1',
'CHAPinfo': 'mm-user@storage',
'Name': 'iqn.1993-08.debian:01:ec2bff7acxxx',
'TargetIP': '1.1.1.1',
'TargetPortGroup': 'portgroup-test'}],
'san_address': ['https://192.0.2.69:8088/deviceManager/rest/'],
'san_password': '123456',
'san_user': 'admin',
'storage_pools': ['OpenStack_Pool']}]
self.assertEqual(expected, replication_devices)
@ddt.ddt
class HuaweiRestClientTestCase(test.TestCase):

View File

@ -315,7 +315,7 @@ class HuaweiConf(object):
dev_config['san_address'] = dev['san_address'].split(';')
dev_config['san_user'] = dev['san_user']
dev_config['san_password'] = dev['san_password']
dev_config['storage_pool'] = dev['storage_pool'].split(';')
dev_config['storage_pools'] = dev['storage_pool'].split(';')
dev_config['iscsi_info'] = self._parse_rmt_iscsi_info(
dev.get('iscsi_info'))
dev_config['iscsi_default_target_ip'] = (
@ -332,7 +332,7 @@ class HuaweiConf(object):
'san_address': self.conf.san_address,
'san_user': self.conf.san_user,
'san_password': self.conf.san_password,
'storage_pool': self.conf.storage_pools,
'storage_pools': self.conf.storage_pools,
'iscsi_info': self.conf.iscsi_info,
'iscsi_default_target_ip': self.conf.iscsi_default_target_ip,
}