File: Load_defaults_from_oslo.concurrency.patch

package info (click to toggle)
mistral 21.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 16,024 kB
  • sloc: python: 53,932; sh: 701; makefile: 57
file content (60 lines) | stat: -rw-r--r-- 1,868 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From: Thomas Goirand <zigo@debian.org>
Date: Fri, 03 Oct 2025 01:34:14 +0200
Description: Load defaults from oslo.concurrency
 Under my env (ie: Debian packages), I've seen mistral-api trying to
 write under:
 .
 /var/lock/nova/oslo_read_shm_<HOSTNAME>_mistral-api
 .
 Why /var/lock/nova is a mistery, but I want to fix this.
 .
 This patch:
 .
 Ensures oslo.concurrency lockutils uses the value from the parsed config.
 oslo.concurrency registers its opts on import, so the option exists;
 call set_defaults *after* CONF(...) so we pick up any value from files.
 .
 Sets the lockutils default to the configured path so external locks
 (synchronized(external=True)) use the right directory.
Signed-off-by: Thomas Goirand <zigo@debian.org>
Change-Id: I13da44ea4bf5410763499b9b32891764dad979e4

diff --git a/mistral/config.py b/mistral/config.py
index 46ccaa2..01a634c 100644
--- a/mistral/config.py
+++ b/mistral/config.py
@@ -24,6 +24,7 @@
 import os
 
 from keystoneauth1 import loading
+from oslo_concurrency import lockutils
 from oslo_config import cfg
 from oslo_config import types
 from oslo_log import log
@@ -882,6 +883,14 @@
         default_config_files=default_config_files,
     )
 
+    try:
+        lp = CONF.oslo_concurrency.lock_path
+    except Exception:
+        lp = None
+
+    if lp:
+        lockutils.set_defaults(lp)
+
 
 def set_config_defaults():
     """This method updates all configuration default values."""
diff --git a/tools/config/config-generator.mistral.conf b/tools/config/config-generator.mistral.conf
index c9c5723..76ad480 100644
--- a/tools/config/config-generator.mistral.conf
+++ b/tools/config/config-generator.mistral.conf
@@ -4,6 +4,7 @@
 summarize = true
 namespace = mistral.config
 namespace = cotyledon
+namespace = oslo.concurrency
 namespace = oslo.db
 namespace = oslo.messaging
 namespace = oslo.middleware.cors