Merge "3PAR: Get host from os-brick"
This commit is contained in:
commit
2f672b7c80
|
@ -7996,6 +7996,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
|
|||
|
||||
volume = {'host': 'test-host@3pariscsi',
|
||||
'id': 'd03338a9-9115-48a3-8dfc-35cdfcdc15a7'}
|
||||
connector = {'host': 'test-host'}
|
||||
mock_utils.return_value = 'random-pass'
|
||||
mock_client.getHostVLUNs.return_value = [
|
||||
{'active': True,
|
||||
|
@ -8018,7 +8019,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
|
|||
'_create_client') as mock_create_client:
|
||||
mock_create_client.return_value = mock_client
|
||||
common = self.driver._login()
|
||||
model = self.driver._do_export(common, volume)
|
||||
model = self.driver._do_export(common, volume, connector)
|
||||
|
||||
mock_client.assert_has_calls(expected)
|
||||
self.assertEqual(expected_model, model)
|
||||
|
@ -8064,7 +8065,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
|
|||
'_create_client') as mock_create_client:
|
||||
mock_create_client.return_value = mock_client
|
||||
common = self.driver._login()
|
||||
model = self.driver._do_export(common, volume)
|
||||
model = self.driver._do_export(common, volume, connector)
|
||||
mock_client.assert_has_calls(expected)
|
||||
self.assertEqual(expected_model, model)
|
||||
|
||||
|
@ -8078,6 +8079,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
|
|||
|
||||
volume = {'host': 'test-host@3pariscsi',
|
||||
'id': 'd03338a9-9115-48a3-8dfc-35cdfcdc15a7'}
|
||||
connector = {'host': 'test-host'}
|
||||
mock_utils.return_value = "random-pass"
|
||||
mock_client.getHostVLUNs.side_effect = hpeexceptions.HTTPNotFound(
|
||||
'fake')
|
||||
|
@ -8099,7 +8101,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
|
|||
'_create_client') as mock_create_client:
|
||||
mock_create_client.return_value = mock_client
|
||||
common = self.driver._login()
|
||||
model = self.driver._do_export(common, volume)
|
||||
model = self.driver._do_export(common, volume, connector)
|
||||
mock_client.assert_has_calls(expected)
|
||||
self.assertEqual(expected_model, model)
|
||||
|
||||
|
@ -8113,6 +8115,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
|
|||
|
||||
volume = {'host': 'test-host@3pariscsi',
|
||||
'id': 'd03338a9-9115-48a3-8dfc-35cdfcdc15a7'}
|
||||
connector = {'host': 'test-host'}
|
||||
mock_utils.return_value = 'random-pass'
|
||||
mock_client.getHostVLUNs.return_value = [
|
||||
{'active': True,
|
||||
|
@ -8144,7 +8147,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
|
|||
'_create_client') as mock_create_client:
|
||||
mock_create_client.return_value = mock_client
|
||||
common = self.driver._login()
|
||||
model = self.driver._do_export(common, volume)
|
||||
model = self.driver._do_export(common, volume, connector)
|
||||
mock_client.assert_has_calls(expected)
|
||||
self.assertEqual(expected_model, model)
|
||||
|
||||
|
@ -8158,6 +8161,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
|
|||
|
||||
volume = {'host': 'test-host@3pariscsi',
|
||||
'id': 'd03338a9-9115-48a3-8dfc-35cdfcdc15a7'}
|
||||
connector = {'host': 'test-host'}
|
||||
mock_utils.return_value = "random-pass"
|
||||
mock_client.getHostVLUNs.return_value = [
|
||||
{'active': False,
|
||||
|
@ -8187,7 +8191,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
|
|||
'_create_client') as mock_create_client:
|
||||
mock_create_client.return_value = mock_client
|
||||
common = self.driver._login()
|
||||
model = self.driver._do_export(common, volume)
|
||||
model = self.driver._do_export(common, volume, connector)
|
||||
mock_client.assert_has_calls(expected)
|
||||
self.assertEqual(expected_model, model)
|
||||
|
||||
|
@ -8201,6 +8205,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
|
|||
|
||||
volume = {'host': 'test-host@3pariscsi',
|
||||
'id': self.VOLUME_ID}
|
||||
connector = {'host': 'test-host'}
|
||||
mock_utils.return_value = 'random-pass'
|
||||
|
||||
mock_client.getHost.return_value = {
|
||||
|
@ -8232,7 +8237,8 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
|
|||
'lun': 1, 'type': 3,
|
||||
'remoteName': 'iqn.1993-08.org.debian:01:222'}]
|
||||
|
||||
model_with_remote_name = self.driver._do_export(common, volume)
|
||||
model_with_remote_name = self.driver._do_export(
|
||||
common, volume, connector)
|
||||
mock_client.assert_has_calls(expected)
|
||||
self.assertDictEqual(expected_model, model_with_remote_name)
|
||||
|
||||
|
@ -8241,7 +8247,8 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
|
|||
{'active': False, 'volumeName': self.VOLUME_3PAR_NAME,
|
||||
'lun': None, 'type': 1}]
|
||||
|
||||
model_without_remote_name = self.driver._do_export(common, volume)
|
||||
model_without_remote_name = self.driver._do_export(
|
||||
common, volume, connector)
|
||||
mock_client.assert_has_calls(expected)
|
||||
self.assertDictEqual(expected_model, model_without_remote_name)
|
||||
|
||||
|
@ -8253,6 +8260,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
|
|||
mock_utils.return_value = 'random-pass'
|
||||
volume = {'host': 'test-host@3pariscsi',
|
||||
'id': self.VOLUME_ID}
|
||||
connector = {'host': 'test-host'}
|
||||
mock_client.getHostVLUNs.return_value = [
|
||||
{'active': True,
|
||||
'volumeName': self.VOLUME_3PAR_NAME,
|
||||
|
@ -8278,7 +8286,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase):
|
|||
'_create_client',
|
||||
return_value=mock_client)
|
||||
mock_create_client.return_value = mock_client
|
||||
model = self.driver.create_export(None, volume, None)
|
||||
model = self.driver.create_export(None, volume, connector)
|
||||
mock_client.assert_has_calls(expected)
|
||||
self.assertDictEqual(expected_model, model)
|
||||
|
||||
|
|
|
@ -123,10 +123,11 @@ class HPE3PARISCSIDriver(driver.ManageableVD,
|
|||
by another host, while creating 3PAR iSCSI Host. bug #1642945
|
||||
3.0.14 - Handle manage and unmanage hosts present. bug #1648067
|
||||
3.0.15 - Adds consistency group capability in generic volume groups.
|
||||
3.0.16 - Get host from os-brick connector. bug #1690244
|
||||
|
||||
"""
|
||||
|
||||
VERSION = "3.0.15"
|
||||
VERSION = "3.0.16"
|
||||
|
||||
# The name of the CI wiki page.
|
||||
CI_WIKI_NAME = "HPE_Storage_CI"
|
||||
|
@ -636,7 +637,7 @@ class HPE3PARISCSIDriver(driver.ManageableVD,
|
|||
|
||||
return host, username, password
|
||||
|
||||
def _do_export(self, common, volume):
|
||||
def _do_export(self, common, volume, connector):
|
||||
"""Gets the associated account, generates CHAP info and updates."""
|
||||
model_update = {}
|
||||
|
||||
|
@ -645,7 +646,7 @@ class HPE3PARISCSIDriver(driver.ManageableVD,
|
|||
return model_update
|
||||
|
||||
# CHAP username will be the hostname
|
||||
chap_username = volume['host'].split('@')[0]
|
||||
chap_username = connector['host']
|
||||
|
||||
chap_password = None
|
||||
try:
|
||||
|
@ -712,7 +713,7 @@ class HPE3PARISCSIDriver(driver.ManageableVD,
|
|||
def create_export(self, context, volume, connector):
|
||||
common = self._login()
|
||||
try:
|
||||
return self._do_export(common, volume)
|
||||
return self._do_export(common, volume, connector)
|
||||
finally:
|
||||
self._logout(common)
|
||||
|
||||
|
|
Loading…
Reference in New Issue