Merge "Add lock on API layer delete floating IP"
This commit is contained in:
commit
44cae9cff8
@ -891,12 +891,24 @@ def floating_ip_fixed_ip_associate(context, floating_address,
|
|||||||
|
|
||||||
|
|
||||||
@require_context
|
@require_context
|
||||||
|
@_retry_on_deadlock
|
||||||
def floating_ip_deallocate(context, address):
|
def floating_ip_deallocate(context, address):
|
||||||
model_query(context, models.FloatingIp).\
|
session = get_session()
|
||||||
filter_by(address=address).\
|
|
||||||
update({'project_id': None,
|
with session.begin():
|
||||||
'host': None,
|
floating_ip_ref = model_query(context, models.FloatingIp,
|
||||||
'auto_assigned': False})
|
session=session).\
|
||||||
|
filter_by(address=address).\
|
||||||
|
filter(models.FloatingIp.project_id != None).\
|
||||||
|
with_lockmode('update').\
|
||||||
|
first()
|
||||||
|
|
||||||
|
if floating_ip_ref:
|
||||||
|
floating_ip_ref.update({'project_id': None,
|
||||||
|
'host': None,
|
||||||
|
'auto_assigned': False})
|
||||||
|
|
||||||
|
return floating_ip_ref
|
||||||
|
|
||||||
|
|
||||||
@require_context
|
@require_context
|
||||||
|
Loading…
Reference in New Issue
Block a user