possible race condition for multiattach in Unity driver
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cinder |
New
|
Undecided
|
Unassigned |
Bug Description
Reviewing the Unity driver for multiattach functionality...
I believe there's a race condition possible in terminate_
https:/
Since there is no locking around initialize_
1) Volume A starts terminate_
2) Volume B starts initialize_
3) Volume A gets into _detach_
Can someone who maintains the Unity driver look into this?
Changed in cinder: | |
assignee: | nobody → Rajini Karthik (rajini-karthik) |
Changed in cinder: | |
assignee: | Rajini Karthik (rajini-karthik) → nobody |
Hi Eric,
Actually there is a lock around initialize_ connection and terminate_ connection. _create_ host_and_ attach called by initialize_ connection and _detach_ and_delete_ host called by terminate_ connection share this lock:
def _create_ host_and_ attach( self, host_name, lun_or_snap): lock_if( self.to_ lock_host, '{lock_name}') lock_name) : '{unity} -{host} '.format( unity=self. client. host, host=host_name))
@utils.
def _lock_helper(
...
return _lock_helper(
def _detach_ and_delete_ host(self, host_name, lun_or_snap, is_multiattach_ to_host= False): lock_if( self.to_ lock_host, '{lock_name}') lock_name) : '{unity} -{host} '.format( unity=self. client. host, host=host_name))
@utils.
def _lock_helper(
...
return _lock_helper(
So the Volume B attach should not be impacted by Volume A detach.
And if is_multiattach_ to_host is True, self.client. detach( host, lun_or_snap) and self.client. delete_ host_wo_ lock(host) will not be called in _detach_ and_delete_ host since the volume still attached to some instances.
So I think the race condition you mentioned may not happen.