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