summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-novaclient
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-novaclient')
-rw-r--r--meta-openstack/recipes-devtools/python/python-novaclient/fix_novaclient_memory_leak.patch103
1 files changed, 103 insertions, 0 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-novaclient/fix_novaclient_memory_leak.patch b/meta-openstack/recipes-devtools/python/python-novaclient/fix_novaclient_memory_leak.patch
new file mode 100644
index 0000000..5732d9a
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-novaclient/fix_novaclient_memory_leak.patch
@@ -0,0 +1,103 @@
1---
2 novaclient/client.py | 10 ++++++++++
3 novaclient/openstack/common/apiclient/client.py | 10 ++++++++++
4 novaclient/v1_1/client.py | 6 ++++++
5 novaclient/v3/client.py | 6 ++++++
6 4 files changed, 32 insertions(+)
7
8--- a/novaclient/client.py
9+++ b/novaclient/client.py
10@@ -87,6 +87,7 @@
11 self.timeout = None
12
13 self.times = [] # [("item", starttime, endtime), ...]
14+ self.times_max_len = 200
15
16 self.management_url = self.bypass_url or None
17 self.auth_token = auth_token
18@@ -139,6 +140,12 @@
19 def reset_timings(self):
20 self.times = []
21
22+ def get_timings_max_len(self):
23+ return self.times_max_len
24+
25+ def set_timings_max_len(self, new_len):
26+ self.times_max_len = new_len
27+
28 def http_log_req(self, method, url, kwargs):
29 if not self.http_log_debug:
30 return
31@@ -214,6 +221,9 @@
32 resp, body = self.request(url, method, **kwargs)
33 self.times.append(("%s %s" % (method, url),
34 start_time, time.time()))
35+ # remove oldest items until we maintain max length
36+ while len(self.times) > self.times_max_len:
37+ del self.times[0]
38 return resp, body
39
40 def _cs_request(self, url, method, **kwargs):
41--- a/novaclient/openstack/common/apiclient/client.py
42+++ b/novaclient/openstack/common/apiclient/client.py
43@@ -90,6 +90,7 @@
44 self.user_agent = user_agent or self.user_agent
45
46 self.times = [] # [("item", starttime, endtime), ...]
47+ self.times_max_len = 200
48 self.timings = timings
49
50 # requests within the same session can reuse TCP connections from pool
51@@ -142,6 +143,12 @@
52 def reset_timings(self):
53 self.times = []
54
55+ def get_timings_max_len(self):
56+ return self.times_max_len
57+
58+ def set_timings_max_len(self, new_len):
59+ self.times_max_len = new_len
60+
61 def request(self, method, url, **kwargs):
62 """Send an http request with the specified characteristics.
63
64@@ -173,6 +180,9 @@
65 if self.timings:
66 self.times.append(("%s %s" % (method, url),
67 start_time, time.time()))
68+ # remove oldest items until we maintain max length
69+ while len(self.times) > self.times_max_len:
70+ del self.times[0]
71 self._http_log_resp(resp)
72
73 if resp.status_code >= 400:
74--- a/novaclient/v1_1/client.py
75+++ b/novaclient/v1_1/client.py
76@@ -156,6 +156,12 @@
77 def reset_timings(self):
78 self.client.reset_timings()
79
80+ def get_timings_max_len(self):
81+ return self.client.get_timings_max_len()
82+
83+ def set_timings_max_len(self, new_len):
84+ self.client.set_timings_max_len(new_len)
85+
86 def authenticate(self):
87 """
88 Authenticate against the server.
89--- a/novaclient/v3/client.py
90+++ b/novaclient/v3/client.py
91@@ -121,6 +121,12 @@
92 def reset_timings(self):
93 self.client.reset_timings()
94
95+ def get_timings_max_len(self):
96+ return self.client.get_timings_max_len()
97+
98+ def set_timings_max_len(self, new_len):
99+ self.client.set_timings_max_len(new_len)
100+
101 def authenticate(self):
102 """
103 Authenticate against the server.