Skip to content

Commit 516f789

Browse files
authored
Merge pull request #62 from stackhpc/upstream/yoga-2023-08-21
Synchronise yoga with upstream
2 parents b34ea94 + c569db7 commit 516f789

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

neutron/db/ovn_hash_ring_db.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
# NOTE(ralonsoh): this was migrated from networking-ovn to neutron and should
3131
# be refactored to be integrated in a OVO.
32+
@db_api.retry_if_session_inactive()
3233
def add_node(context, group_name, node_uuid=None):
3334
if node_uuid is None:
3435
node_uuid = uuidutils.generate_uuid()
@@ -41,6 +42,7 @@ def add_node(context, group_name, node_uuid=None):
4142
return node_uuid
4243

4344

45+
@db_api.retry_if_session_inactive()
4446
def remove_nodes_from_host(context, group_name):
4547
with db_api.CONTEXT_WRITER.using(context):
4648
context.session.query(ovn_models.OVNHashRing).filter(
@@ -50,13 +52,15 @@ def remove_nodes_from_host(context, group_name):
5052
CONF.host, group_name)
5153

5254

55+
@db_api.retry_if_session_inactive()
5356
def remove_node_by_uuid(context, node_uuid):
5457
with db_api.CONTEXT_WRITER.using(context):
5558
context.session.query(ovn_models.OVNHashRing).filter(
5659
ovn_models.OVNHashRing.node_uuid == node_uuid).delete()
5760
LOG.info('Node "%s" removed from the Hash Ring', node_uuid)
5861

5962

63+
@db_api.retry_if_session_inactive()
6064
def _touch(context, updated_at=None, **filter_args):
6165
if updated_at is None:
6266
updated_at = timeutils.utcnow()
@@ -90,19 +94,22 @@ def _get_nodes_query(context, interval, group_name, offline=False,
9094
return query
9195

9296

97+
@db_api.retry_if_session_inactive()
9398
@db_api.CONTEXT_READER
9499
def get_active_nodes(context, interval, group_name, from_host=False):
95100
query = _get_nodes_query(context, interval, group_name,
96101
from_host=from_host)
97102
return query.all()
98103

99104

105+
@db_api.retry_if_session_inactive()
100106
@db_api.CONTEXT_READER
101107
def count_offline_nodes(context, interval, group_name):
102108
query = _get_nodes_query(context, interval, group_name, offline=True)
103109
return query.count()
104110

105111

112+
@db_api.retry_if_session_inactive()
106113
@db_api.CONTEXT_READER
107114
def count_nodes_from_host(context, group_name):
108115
query = context.session.query(ovn_models.OVNHashRing).filter(

0 commit comments

Comments
 (0)