Replace deprecated with_lockmode with with_for_update
The Query.with_lockmode() method is deprecated since version 0.9.0 and will be removed in a future release. [1] This patch replaces it with Query.with_for_update(). [1] https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.with_lockmode Change-Id: I2d4c6a108eb0fee0bd5b0a20f2f508727b44e887
This commit is contained in:
parent
88f26ae6fe
commit
06dd82bd30
@ -632,7 +632,7 @@ class Connection(api.Connection):
|
||||
query = model_query(models.Node)
|
||||
query = add_identity_filter(query, node_id)
|
||||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
ref = query.with_for_update().one()
|
||||
except NoResultFound:
|
||||
raise exception.NodeNotFound(node=node_id)
|
||||
|
||||
@ -1760,7 +1760,7 @@ class Connection(api.Connection):
|
||||
|
||||
if values.get('node_id') and update_node:
|
||||
node = model_query(models.Node, session=session).filter_by(
|
||||
id=ref.node_id).with_lockmode('update').one()
|
||||
id=ref.node_id).with_for_update().one()
|
||||
node_uuid = node.uuid
|
||||
if node.instance_uuid and node.instance_uuid != ref.uuid:
|
||||
raise exception.NodeAssociated(
|
||||
@ -1933,7 +1933,7 @@ class Connection(api.Connection):
|
||||
query = model_query(models.DeployTemplate)
|
||||
query = add_identity_filter(query, template_id)
|
||||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
ref = query.with_for_update().one()
|
||||
except NoResultFound:
|
||||
raise exception.DeployTemplateNotFound(
|
||||
template=template_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user