ScaleIO: More connection info backward compatibility

Similar to I6f01a178616b74ed9a86876ca46e7e46eb360518, this patch
fixes a compatibility issue when the new connection properties
dictionary exists, but is missing the 'failed_over' field. This
situation may arise when booting a shelved instance whose connection
properties were created prior to when the ScaleIO driver was enhanced
to support replication failover.

Related-Bug: #1823200
Change-Id: I9b2a9cd2839a4efec824fc68cb2163ad70f4ebdc
(cherry picked from commit f8de43834b)
This commit is contained in:
Alan Bishop 2021-02-16 10:42:43 -08:00
parent 574d277246
commit 9317f9facb
2 changed files with 12 additions and 1 deletions

View File

@ -100,7 +100,7 @@ class ScaleIOConnector(base.BaseLinuxConnector):
password = priv_scaleio.get_connector_password(
CONNECTOR_CONF_PATH,
connection_properties['config_group'],
connection_properties['failed_over'])
connection_properties.get('failed_over', False))
return password, None
except Exception as e:
msg = _("Error getting ScaleIO connector password from "

View File

@ -320,3 +320,14 @@ class ScaleIOConnectorTestCase(test_connector.ConnectorTestCase):
mock_device_size.return_value)
self.rescan_vols_mock.assert_called_once_with(
self.connector.RESCAN_VOLS_OP_CODE)
def test_connection_properties_without_failed_over(self):
"""Handle connection properties with 'failed_over' missing"""
connection_properties = dict(self.fake_connection_properties)
connection_properties.pop('failed_over')
self.connector.connect_volume(connection_properties)
self.get_password_mock.assert_called_once_with(
scaleio.CONNECTOR_CONF_PATH,
connection_properties['config_group'],
False)