summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <ralonsoh@redhat.com>2023-04-22 04:09:18 +0200
committerRodolfo Alonso Hernandez <ralonsoh@redhat.com>2023-04-23 07:26:55 +0200
commitdd184c5c10e3311ceaffd2cde8d66f76aadaebac (patch)
treedd926bf68612cc2b370a5dc01f8df29a42ca1a59
parent5cd0388eb7cac84fc1aaa425184bf4af67ed0608 (diff)
downloadneutron-dd184c5c10e3311ceaffd2cde8d66f76aadaebac.tar.gz
Fix Loki tempest jobs
This patch fixes the issues reported in the "neutron-ovn-tempest-with-uwsgi-loki" job: * The missing retry decorators in some ``TapPlugin`` methods. * Added a session flush in ``OVNL3RouterPlugin.create_router_precommit``. In case the router creation fails before the creation of the initial ``OVNRevisionNumbers`` register, the transaction is retried. That will prevent from trying to retrieve a router standard attribute that doesn't exist, due to a previous error. Closes-Bug: #2017131 Change-Id: Idbf7ea6018146b67387f2ff99e281e32170ba039
-rw-r--r--neutron/services/loki/loki_plugin.py4
-rw-r--r--neutron/services/ovn_l3/plugin.py1
-rw-r--r--neutron/services/tag/tag_plugin.py3
3 files changed, 7 insertions, 1 deletions
diff --git a/neutron/services/loki/loki_plugin.py b/neutron/services/loki/loki_plugin.py
index 491f914b86..9d496f523e 100644
--- a/neutron/services/loki/loki_plugin.py
+++ b/neutron/services/loki/loki_plugin.py
@@ -34,11 +34,13 @@ class LokiPlugin(service_base.ServicePluginBase):
def random_deadlock(self, session, flush_context, instances):
if random.randrange(0, 51) > 49: # 1/50 probability
+ LOG.info("Loki has raised a DBDeadlock exception, instances %s",
+ instances)
raise db_exc.DBDeadlock()
def random_delay(self, session, instance):
if random.randrange(0, 201) > 199: # 1/200 probability
- LOG.debug("Loki has delayed loading of instance %s", instance)
+ LOG.info("Loki has delayed loading of instance %s", instance)
time.sleep(1)
def get_plugin_type(self):
diff --git a/neutron/services/ovn_l3/plugin.py b/neutron/services/ovn_l3/plugin.py
index 56a58d3f5e..7d370089a2 100644
--- a/neutron/services/ovn_l3/plugin.py
+++ b/neutron/services/ovn_l3/plugin.py
@@ -170,6 +170,7 @@ class OVNL3RouterPlugin(service_base.ServicePluginBase,
def create_router_precommit(self, resource, event, trigger, payload):
context = payload.context
+ context.session.flush()
router_id = payload.resource_id
router_db = payload.metadata['router_db']
diff --git a/neutron/services/tag/tag_plugin.py b/neutron/services/tag/tag_plugin.py
index c44860034d..23f3cb9ed1 100644
--- a/neutron/services/tag/tag_plugin.py
+++ b/neutron/services/tag/tag_plugin.py
@@ -100,6 +100,7 @@ class TagPlugin(tagging.TagPluginBase):
tag=tag).create()
@log_helpers.log_method_call
+ @db_api.retry_if_session_inactive()
def update_tag(self, context, resource, resource_id, tag):
res = self._get_resource(context, resource, resource_id)
if any(tag == tag_db.tag for tag_db in res.standard_attr.tags):
@@ -111,12 +112,14 @@ class TagPlugin(tagging.TagPluginBase):
pass
@log_helpers.log_method_call
+ @db_api.retry_if_session_inactive()
def delete_tags(self, context, resource, resource_id):
res = self._get_resource(context, resource, resource_id)
tag_obj.Tag.delete_objects(context,
standard_attr_id=res.standard_attr_id)
@log_helpers.log_method_call
+ @db_api.retry_if_session_inactive()
def delete_tag(self, context, resource, resource_id, tag):
res = self._get_resource(context, resource, resource_id)
if not tag_obj.Tag.delete_objects(