ScaleIO could connect wrong volume to VM

When running multiple attach volume operations with multiple
volumes and multiple VMs, a wrong volume could end up being
attached to a VM. To fix this, connect_volume and disconnect_volume
should be locked.

Change-Id: I47e94a945938123a913aee9d52d36f8ee088955a
Closes-Bug: #1524989
(cherry picked from commit e6d94fe0b0)
This commit is contained in:
Xing Yang 2015-12-10 16:42:14 -05:00
parent 9e70f2c435
commit 75a53354aa

View File

@ -1937,6 +1937,7 @@ class ScaleIOConnector(InitiatorConnector):
'path': self.volume_path}
return device_info
@lockutils.synchronized('scaleio', 'scaleio-')
def connect_volume(self, connection_properties):
"""Connect the volume."""
device_info = self.get_config(connection_properties)
@ -2059,6 +2060,7 @@ class ScaleIOConnector(InitiatorConnector):
return device_info
@lockutils.synchronized('scaleio', 'scaleio-')
def disconnect_volume(self, connection_properties, device_info):
self.get_config(connection_properties)
self.volume_id = self._get_volume_id()