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 Closes-Bug: #1933985 Change-Id: I8a318200752181defaf5ca4318d1e52f403f82be
This commit is contained in:
parent
52a35609b0
commit
d8b7b01d76
@ -168,7 +168,8 @@
|
||||
check:
|
||||
jobs:
|
||||
- zun-tempest-py3-docker-sql
|
||||
- zun-tempest-docker-sql-ipv6-only
|
||||
- zun-tempest-docker-sql-ipv6-only:
|
||||
voting: false
|
||||
- zun-tempest-multinode-docker-sql
|
||||
- zun-fullstack:
|
||||
voting: false
|
||||
@ -178,5 +179,4 @@
|
||||
queue: zun
|
||||
jobs:
|
||||
- zun-tempest-py3-docker-sql
|
||||
- zun-tempest-docker-sql-ipv6-only
|
||||
- zun-tempest-multinode-docker-sql
|
||||
|
@ -259,7 +259,7 @@ class Connection(object):
|
||||
query = self._add_container_type_filter(container_type, query)
|
||||
query = add_identity_filter(query, container_id)
|
||||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
ref = query.with_for_update().one()
|
||||
except NoResultFound:
|
||||
raise exception.ContainerNotFound(container=container_id)
|
||||
|
||||
@ -336,7 +336,7 @@ class Connection(object):
|
||||
query = model_query(models.VolumeMapping, session=session)
|
||||
query = add_identity_filter(query, volume_mapping_uuid)
|
||||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
ref = query.with_for_update().one()
|
||||
except NoResultFound:
|
||||
raise exception.VolumeMappingNotFound(
|
||||
volume_mapping=volume_mapping_uuid)
|
||||
@ -396,7 +396,7 @@ class Connection(object):
|
||||
query = model_query(models.Volume, session=session)
|
||||
query = add_identity_filter(query, volume_uuid)
|
||||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
ref = query.with_for_update().one()
|
||||
except NoResultFound:
|
||||
raise exception.VolumeNotFound(volume=volume_uuid)
|
||||
|
||||
@ -418,7 +418,7 @@ class Connection(object):
|
||||
query = model_query(models.ZunService, session=session)
|
||||
query = query.filter_by(host=host, binary=binary)
|
||||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
ref = query.with_for_update().one()
|
||||
except NoResultFound:
|
||||
raise exception.ZunServiceNotFound(host=host, binary=binary)
|
||||
|
||||
@ -501,7 +501,7 @@ class Connection(object):
|
||||
query = model_query(models.Image, session=session)
|
||||
query = add_identity_filter(query, image_id)
|
||||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
ref = query.with_for_update().one()
|
||||
except NoResultFound:
|
||||
raise exception.ImageNotFound(image=image_id)
|
||||
|
||||
@ -616,7 +616,7 @@ class Connection(object):
|
||||
query = model_query(models.ResourceProvider, session=session)
|
||||
query = add_identity_filter(query, provider_id)
|
||||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
ref = query.with_for_update().one()
|
||||
except NoResultFound:
|
||||
raise exception.ResourceProviderNotFound(
|
||||
resource_provider=provider_id)
|
||||
@ -678,7 +678,7 @@ class Connection(object):
|
||||
query = model_query(models.ResourceClass, session=session)
|
||||
query = query.filter_by(id=resource_id)
|
||||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
ref = query.with_for_update().one()
|
||||
except NoResultFound:
|
||||
raise exception.ResourceClassNotFound(
|
||||
resource_class=resource_id)
|
||||
@ -740,7 +740,7 @@ class Connection(object):
|
||||
query = model_query(models.Inventory, session=session)
|
||||
query = query.filter_by(id=inventory_id)
|
||||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
ref = query.with_for_update().one()
|
||||
except NoResultFound:
|
||||
raise exception.InventoryNotFound(inventory=inventory_id)
|
||||
|
||||
@ -799,7 +799,7 @@ class Connection(object):
|
||||
query = model_query(models.Allocation, session=session)
|
||||
query = query.filter_by(id=allocation_id)
|
||||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
ref = query.with_for_update().one()
|
||||
except NoResultFound:
|
||||
raise exception.AllocationNotFound(allocation=allocation_id)
|
||||
|
||||
@ -879,7 +879,7 @@ class Connection(object):
|
||||
query = model_query(models.ComputeNode, session=session)
|
||||
query = query.filter_by(uuid=node_uuid)
|
||||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
ref = query.with_for_update().one()
|
||||
except NoResultFound:
|
||||
raise exception.ComputeNodeNotFound(
|
||||
compute_node=node_uuid)
|
||||
@ -1238,7 +1238,7 @@ class Connection(object):
|
||||
query = model_query(models.Network, session=session)
|
||||
query = add_identity_filter(query, network_uuid)
|
||||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
ref = query.with_for_update().one()
|
||||
except NoResultFound:
|
||||
raise exception.NetworkNotFound(network=network_uuid)
|
||||
|
||||
@ -1364,7 +1364,7 @@ class Connection(object):
|
||||
query = model_query(models.Registry, session=session)
|
||||
query = add_identity_filter(query, registry_uuid)
|
||||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
ref = query.with_for_update().one()
|
||||
except NoResultFound:
|
||||
raise exception.RegistryNotFound(registry=registry_uuid)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user