Merge "Fix VxFlexOs KeyError after upgrade"

This commit is contained in:
Zuul 2019-03-11 12:22:04 +00:00 committed by Gerrit Code Review
commit a22d316f79
2 changed files with 15 additions and 1 deletions

View File

@ -276,7 +276,7 @@ class VxFlexOsConnector(base.BaseLinuxConnector):
try:
self.volume_id = connection_properties['vxflexos_volume_id']
except KeyError:
self.volume_id = connection_properties['scaleIO_volume_id']
self.volume_id = connection_properties.get('scaleIO_volume_id')
d_option_used = True
if d_option_used:
LOG.warning("Deprecated: scaleIO_volname and scaleIO_volume_id "

View File

@ -171,6 +171,13 @@ class VxFlexOsConnectorTestCase(test_connector.ConnectorTestCase):
"""Successful connect to volume"""
self.connector.connect_volume(self.fake_connection_properties)
def test_connect_volume_without_volume_id(self):
"""Successful connect to volume without a Volume Id"""
connection_properties = dict(self.fake_connection_properties)
connection_properties.pop('vxflexos_volume_id')
self.connector.connect_volume(connection_properties)
def test_connect_with_bandwidth_limit(self):
"""Successful connect to volume with bandwidth limit"""
self.fake_connection_properties['bandwidthLimit'] = '500'
@ -191,6 +198,13 @@ class VxFlexOsConnectorTestCase(test_connector.ConnectorTestCase):
"""Successful disconnect from volume"""
self.connector.disconnect_volume(self.fake_connection_properties, None)
def test_disconnect_volume_without_volume_id(self):
"""Successful disconnect from volume without a Volume Id"""
connection_properties = dict(self.fake_connection_properties)
connection_properties.pop('vxflexos_volume_id')
self.connector.disconnect_volume(connection_properties, None)
def test_error_id(self):
"""Fail to connect with bad volume name"""
self.fake_connection_properties['vxflexos_volume_id'] = 'bad_id'