Merge "ScaleIO to get volume name from connection properties"
This commit is contained in:
commit
cc47d81feb
@ -2812,6 +2812,7 @@ class ScaleIOConnector(BaseLinuxConnector):
|
||||
def get_config(self, connection_properties):
|
||||
self.local_sdc_ip = connection_properties['hostIP']
|
||||
self.volume_name = connection_properties['scaleIO_volname']
|
||||
self.volume_id = connection_properties['scaleIO_volume_id']
|
||||
self.server_ip = connection_properties['serverIP']
|
||||
self.server_port = connection_properties['serverPort']
|
||||
self.server_username = connection_properties['serverUsername']
|
||||
@ -2843,6 +2844,7 @@ class ScaleIOConnector(BaseLinuxConnector):
|
||||
"bandwidth limit: %(bandwidth_limit)s."
|
||||
), {
|
||||
'volume_name': self.volume_name,
|
||||
'volume_id': self.volume_id,
|
||||
'sdc_ip': self.local_sdc_ip,
|
||||
'server_ip': self.server_ip,
|
||||
'username': self.server_username,
|
||||
@ -2870,7 +2872,7 @@ class ScaleIOConnector(BaseLinuxConnector):
|
||||
guid = out
|
||||
LOG.info(_LI("Current sdc guid: %(guid)s"), {'guid': guid})
|
||||
params = {'guid': guid, 'allowMultipleMappings': 'TRUE'}
|
||||
self.volume_id = self._get_volume_id()
|
||||
self.volume_id = self.volume_id or self._get_volume_id()
|
||||
|
||||
headers = {'content-type': 'application/json'}
|
||||
request = (
|
||||
@ -2965,7 +2967,7 @@ class ScaleIOConnector(BaseLinuxConnector):
|
||||
:type device_info: dict
|
||||
"""
|
||||
self.get_config(connection_properties)
|
||||
self.volume_id = self._get_volume_id()
|
||||
self.volume_id = self.volume_id or self._get_volume_id()
|
||||
LOG.info(_LI(
|
||||
"ScaleIO disconnect volume in ScaleIO brick volume driver."
|
||||
))
|
||||
|
@ -2547,7 +2547,8 @@ class ScaleIOConnectorTestCase(ConnectorTestCase):
|
||||
# Fake volume information
|
||||
vol = {
|
||||
'id': 'vol1',
|
||||
'name': 'test_volume'
|
||||
'name': 'test_volume',
|
||||
'provider_id': 'vol1'
|
||||
}
|
||||
|
||||
# Fake SDC GUID
|
||||
@ -2560,6 +2561,7 @@ class ScaleIOConnectorTestCase(ConnectorTestCase):
|
||||
'hostIP': MY_IP,
|
||||
'serverIP': MY_IP,
|
||||
'scaleIO_volname': self.vol['name'],
|
||||
'scaleIO_volume_id': self.vol['provider_id'],
|
||||
'serverPort': 443,
|
||||
'serverUsername': 'test',
|
||||
'serverPassword': 'fake',
|
||||
@ -2712,6 +2714,7 @@ class ScaleIOConnectorTestCase(ConnectorTestCase):
|
||||
|
||||
def test_error_id(self):
|
||||
"""Fail to connect with bad volume name"""
|
||||
self.fake_connection_properties['scaleIO_volume_id'] = 'bad_id'
|
||||
self.mock_calls[self.get_volume_api] = self.MockHTTPSResponse(
|
||||
dict(errorCode='404', message='Test volume not found'), 404)
|
||||
|
||||
@ -2719,6 +2722,7 @@ class ScaleIOConnectorTestCase(ConnectorTestCase):
|
||||
|
||||
def test_error_no_volume_id(self):
|
||||
"""Faile to connect with no volume id"""
|
||||
self.fake_connection_properties['scaleIO_volume_id'] = None
|
||||
self.mock_calls[self.get_volume_api] = self.MockHTTPSResponse(
|
||||
'null', 200)
|
||||
|
||||
@ -2728,9 +2732,9 @@ class ScaleIOConnectorTestCase(ConnectorTestCase):
|
||||
"""Fail to connect with bad authentication"""
|
||||
self.mock_calls[self.get_volume_api] = self.MockHTTPSResponse(
|
||||
'null', 401)
|
||||
|
||||
self.mock_calls['login'] = self.MockHTTPSResponse('null', 401)
|
||||
|
||||
self.mock_calls[self.action_format.format(
|
||||
'addMappedSdc')] = self.MockHTTPSResponse(
|
||||
dict(errorCode=401, message='bad login'), 401)
|
||||
self.assertRaises(exception.BrickException, self.test_connect_volume)
|
||||
|
||||
def test_error_bad_drv_cfg(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user