summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python
diff options
context:
space:
mode:
authorAmy Fong <amy.fong@windriver.com>2014-03-28 15:58:45 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2014-03-31 13:14:49 -0400
commit02f129b1bb1fc17f17b2fbca43bd997aa8b28d09 (patch)
treea125ec774f2054684ddd364aeb6caceb8c1bf637 /meta-openstack/recipes-devtools/python
parent984c2d69f51824a4c1e7b3a448fe24759e594026 (diff)
downloadmeta-cloud-services-02f129b1bb1fc17f17b2fbca43bd997aa8b28d09.tar.gz
Memory leak from timings
Memory leak happens when the dynamic list times grows without anything to reset it. In ceilometer and cinder configuration files, the new option is created: [nova_client] max_timing_buffer=<value> In all clients found that uses extends the HTTPClient and uses the times list, we limit the size of the list by popping off the oldest item in the list to maintain a maximum size. A default size of 200 is chosen, configurable by the above configuration option. Signed-off-by: Amy Fong <amy.fong@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python')
-rw-r--r--meta-openstack/recipes-devtools/python/python-ceilometer/ceilometer.conf3
-rw-r--r--meta-openstack/recipes-devtools/python/python-ceilometer/fix_ceilometer_memory_leak.patch27
-rw-r--r--meta-openstack/recipes-devtools/python/python-ceilometer_git.bb1
-rw-r--r--meta-openstack/recipes-devtools/python/python-ceilometerclient/fix_ceilometerclient_memory_leak.patch37
-rw-r--r--meta-openstack/recipes-devtools/python/python-ceilometerclient_git.bb5
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinder/cinder.conf3
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinder/fix_cinder_memory_leak.patch28
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinder_git.bb1
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinderclient/fix_cinderclient_memory_leak.patch37
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinderclient_git.bb5
-rw-r--r--meta-openstack/recipes-devtools/python/python-glanceclient/fix_glanceclient_memory_leak.patch37
-rw-r--r--meta-openstack/recipes-devtools/python/python-glanceclient_git.bb5
-rw-r--r--meta-openstack/recipes-devtools/python/python-hp3parclient/fix_hp3parclient_memory_leak.patch37
-rw-r--r--meta-openstack/recipes-devtools/python/python-hp3parclient_2.0.0.bb5
-rw-r--r--meta-openstack/recipes-devtools/python/python-keystoneclient/fix_keystoneclient_memory_leak.patch37
-rw-r--r--meta-openstack/recipes-devtools/python/python-keystoneclient_git.bb5
-rw-r--r--meta-openstack/recipes-devtools/python/python-novaclient/fix_novaclient_memory_leak.patch103
-rw-r--r--meta-openstack/recipes-devtools/python/python-novaclient_git.bb5
18 files changed, 374 insertions, 7 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-ceilometer/ceilometer.conf b/meta-openstack/recipes-devtools/python/python-ceilometer/ceilometer.conf
index 4632f40..6340a15 100644
--- a/meta-openstack/recipes-devtools/python/python-ceilometer/ceilometer.conf
+++ b/meta-openstack/recipes-devtools/python/python-ceilometer/ceilometer.conf
@@ -868,4 +868,5 @@ admin_tenant_name=%SERVICE_TENANT_NAME%
868# Password for Redis server. (optional) (string value) 868# Password for Redis server. (optional) (string value)
869#password=<None> 869#password=<None>
870 870
871 871# [nova_client]
872# max_timing_buffer=100
diff --git a/meta-openstack/recipes-devtools/python/python-ceilometer/fix_ceilometer_memory_leak.patch b/meta-openstack/recipes-devtools/python/python-ceilometer/fix_ceilometer_memory_leak.patch
new file mode 100644
index 0000000..bdc1bf7
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-ceilometer/fix_ceilometer_memory_leak.patch
@@ -0,0 +1,27 @@
1---
2 ceilometer/nova_client.py | 7 +++++++
3 1 file changed, 7 insertions(+)
4
5--- a/ceilometer/nova_client.py
6+++ b/ceilometer/nova_client.py
7@@ -26,6 +26,12 @@
8
9 LOG = log.getLogger(__name__)
10
11+nova_client_opts = [
12+ cfg.IntOpt('max_timing_buffer',
13+ default=200,
14+ help='The max number of the timing objects to keep'),
15+]
16+cfg.CONF.register_opts(nova_client_opts, group="nova_client")
17
18 def logged(func):
19
20@@ -56,6 +62,7 @@
21 endpoint_type=conf.os_endpoint_type,
22 cacert=conf.os_cacert,
23 no_cache=True)
24+ self.nova_client.set_timings_max_len(cfg.CONF.nova_client.max_timing_buffer)
25
26 def _with_flavor_and_image(self, instances):
27 for instance in instances:
diff --git a/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb b/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb
index 7d1796d..f77cf1d 100644
--- a/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb
@@ -11,6 +11,7 @@ SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=master \
11 file://ceilometer.conf \ 11 file://ceilometer.conf \
12 file://ceilometer.init \ 12 file://ceilometer.init \
13 file://0001-sqlalchemy-Fix-for-get_statistics-with-postgresql.patch \ 13 file://0001-sqlalchemy-Fix-for-get_statistics-with-postgresql.patch \
14 file://fix_ceilometer_memory_leak.patch \
14" 15"
15 16
16SRCREV="a4c7411ac903984c7e7524469f89a417cf9cf97e" 17SRCREV="a4c7411ac903984c7e7524469f89a417cf9cf97e"
diff --git a/meta-openstack/recipes-devtools/python/python-ceilometerclient/fix_ceilometerclient_memory_leak.patch b/meta-openstack/recipes-devtools/python/python-ceilometerclient/fix_ceilometerclient_memory_leak.patch
new file mode 100644
index 0000000..8abc654
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-ceilometerclient/fix_ceilometerclient_memory_leak.patch
@@ -0,0 +1,37 @@
1---
2 ceilometerclient/openstack/common/apiclient/client.py | 12 ++++++++++++
3 1 file changed, 12 insertions(+)
4
5--- a/ceilometerclient/openstack/common/apiclient/client.py
6+++ b/ceilometerclient/openstack/common/apiclient/client.py
7@@ -90,6 +90,7 @@
8 self.user_agent = user_agent or self.user_agent
9
10 self.times = [] # [("item", starttime, endtime), ...]
11+ self.times_max_len = 200
12 self.timings = timings
13
14 # requests within the same session can reuse TCP connections from pool
15@@ -142,6 +143,12 @@
16 def reset_timings(self):
17 self.times = []
18
19+ def get_timings_max_len(self):
20+ return self.times_max_len
21+
22+ def set_timings_max_len(self, new_len):
23+ self.times_max_len = new_len
24+
25 def request(self, method, url, **kwargs):
26 """Send an http request with the specified characteristics.
27
28@@ -173,6 +180,9 @@
29 if self.timings:
30 self.times.append(("%s %s" % (method, url),
31 start_time, time.time()))
32+ # remove oldest items until we maintain max length
33+ while len(self.times) > self.times_max_len:
34+ del self.times[0]
35 self._http_log_resp(resp)
36
37 if resp.status_code >= 400:
diff --git a/meta-openstack/recipes-devtools/python/python-ceilometerclient_git.bb b/meta-openstack/recipes-devtools/python/python-ceilometerclient_git.bb
index 811bbd5..c7c6ff4 100644
--- a/meta-openstack/recipes-devtools/python/python-ceilometerclient_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-ceilometerclient_git.bb
@@ -20,7 +20,10 @@ RDEPENDS_${PN} +="python-cliff \
20 20
21PR = "r0" 21PR = "r0"
22 22
23SRC_URI = "git://github.com/openstack/python-ceilometerclient.git;branch=master" 23SRC_URI = "\
24 git://github.com/openstack/python-ceilometerclient.git;branch=master \
25 file://fix_ceilometerclient_memory_leak.patch \
26 "
24 27
25PV="1.0.9+git${SRCPV}" 28PV="1.0.9+git${SRCPV}"
26SRCREV="6f4ec9dc96477131c90040ee00f5535e50d5f914" 29SRCREV="6f4ec9dc96477131c90040ee00f5535e50d5f914"
diff --git a/meta-openstack/recipes-devtools/python/python-cinder/cinder.conf b/meta-openstack/recipes-devtools/python/python-cinder/cinder.conf
index fff6910..99a0fc7 100644
--- a/meta-openstack/recipes-devtools/python/python-cinder/cinder.conf
+++ b/meta-openstack/recipes-devtools/python/python-cinder/cinder.conf
@@ -1218,3 +1218,6 @@ rbd_user=cinder-volume
1218volume_backend_name=RBD_CEPH 1218volume_backend_name=RBD_CEPH
1219 1219
1220# Total option count: 255 1220# Total option count: 255
1221
1222# [nova_client]
1223# max_timing_buffer=100
diff --git a/meta-openstack/recipes-devtools/python/python-cinder/fix_cinder_memory_leak.patch b/meta-openstack/recipes-devtools/python/python-cinder/fix_cinder_memory_leak.patch
new file mode 100644
index 0000000..2566531
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-cinder/fix_cinder_memory_leak.patch
@@ -0,0 +1,28 @@
1---
2 cinder/compute/nova.py | 8 ++++++++
3 1 file changed, 8 insertions(+)
4
5--- a/cinder/compute/nova.py
6+++ b/cinder/compute/nova.py
7@@ -57,6 +57,13 @@
8 CONF = cfg.CONF
9 CONF.register_opts(nova_opts)
10
11+nova_client_opts = [
12+ cfg.IntOpt('max_timing_buffer',
13+ default=200,
14+ help='The max number of the timing objects to keep'),
15+]
16+cfg.CONF.register_opts(nova_client_opts, group="nova_client")
17+
18 LOG = logging.getLogger(__name__)
19
20
21@@ -106,6 +113,7 @@
22 insecure=CONF.nova_api_insecure,
23 cacert=CONF.nova_ca_certificates_file,
24 extensions=extensions)
25+ c.set_timings_max_len(cfg.CONF.nova_client.max_timing_buffer)
26 # noauth extracts user_id:project_id from auth_token
27 c.client.auth_token = context.auth_token or '%s:%s' % (context.user_id,
28 context.project_id)
diff --git a/meta-openstack/recipes-devtools/python/python-cinder_git.bb b/meta-openstack/recipes-devtools/python/python-cinder_git.bb
index 8b08dbb..15a2608 100644
--- a/meta-openstack/recipes-devtools/python/python-cinder_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-cinder_git.bb
@@ -16,6 +16,7 @@ SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/havana \
16 file://glusterfs_setup.sh \ 16 file://glusterfs_setup.sh \
17 file://lvm_iscsi_setup.sh \ 17 file://lvm_iscsi_setup.sh \
18 file://add-cinder-volume-types.sh \ 18 file://add-cinder-volume-types.sh \
19 file://fix_cinder_memory_leak.patch \
19 " 20 "
20 21
21SRCREV="8b5fb8409322f61d8b610c97c109a61bf48a940e" 22SRCREV="8b5fb8409322f61d8b610c97c109a61bf48a940e"
diff --git a/meta-openstack/recipes-devtools/python/python-cinderclient/fix_cinderclient_memory_leak.patch b/meta-openstack/recipes-devtools/python/python-cinderclient/fix_cinderclient_memory_leak.patch
new file mode 100644
index 0000000..137edfd
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-cinderclient/fix_cinderclient_memory_leak.patch
@@ -0,0 +1,37 @@
1---
2 cinderclient/openstack/common/apiclient/client.py | 10 ++++++++++
3 1 file changed, 10 insertions(+)
4
5--- a/cinderclient/openstack/common/apiclient/client.py
6+++ b/cinderclient/openstack/common/apiclient/client.py
7@@ -90,6 +90,7 @@
8 self.user_agent = user_agent or self.user_agent
9
10 self.times = [] # [("item", starttime, endtime), ...]
11+ self.times_max_len = 200
12 self.timings = timings
13
14 # requests within the same session can reuse TCP connections from pool
15@@ -142,6 +143,12 @@
16 def reset_timings(self):
17 self.times = []
18
19+ def get_timings_max_len(self):
20+ return self.times_max_len
21+
22+ def set_timings_max_len(self, new_len):
23+ self.times_max_len = new_len
24+
25 def request(self, method, url, **kwargs):
26 """Send an http request with the specified characteristics.
27
28@@ -173,6 +180,9 @@
29 if self.timings:
30 self.times.append(("%s %s" % (method, url),
31 start_time, time.time()))
32+ # remove oldest items until we maintain max length
33+ while len(self.times) > self.times_max_len:
34+ del self.times[0]
35 self._http_log_resp(resp)
36
37 if resp.status_code >= 400:
diff --git a/meta-openstack/recipes-devtools/python/python-cinderclient_git.bb b/meta-openstack/recipes-devtools/python/python-cinderclient_git.bb
index f12975e..3c7293b 100644
--- a/meta-openstack/recipes-devtools/python/python-cinderclient_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-cinderclient_git.bb
@@ -8,7 +8,10 @@ DEPENDS = "python-setuptools-git"
8PR = "r0" 8PR = "r0"
9SRCNAME = "python-cinderclient" 9SRCNAME = "python-cinderclient"
10 10
11SRC_URI = "git://github.com/openstack/python-cinderclient.git;branch=master" 11SRC_URI = "\
12 git://github.com/openstack/python-cinderclient.git;branch=master \
13 file://fix_cinderclient_memory_leak.patch \
14 "
12 15
13PV="1.0.8+git${SRCPV}" 16PV="1.0.8+git${SRCPV}"
14SRCREV="ea8c9554c947b7fd30adfb1249a9317f258901ab" 17SRCREV="ea8c9554c947b7fd30adfb1249a9317f258901ab"
diff --git a/meta-openstack/recipes-devtools/python/python-glanceclient/fix_glanceclient_memory_leak.patch b/meta-openstack/recipes-devtools/python/python-glanceclient/fix_glanceclient_memory_leak.patch
new file mode 100644
index 0000000..754d83f
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-glanceclient/fix_glanceclient_memory_leak.patch
@@ -0,0 +1,37 @@
1---
2 glanceclient/openstack/common/apiclient/client.py | 10 ++++++++++
3 1 file changed, 10 insertions(+)
4
5--- a/glanceclient/openstack/common/apiclient/client.py
6+++ b/glanceclient/openstack/common/apiclient/client.py
7@@ -90,6 +90,7 @@
8 self.user_agent = user_agent or self.user_agent
9
10 self.times = [] # [("item", starttime, endtime), ...]
11+ self.times_max_len = 200
12 self.timings = timings
13
14 # requests within the same session can reuse TCP connections from pool
15@@ -142,6 +143,12 @@
16 def reset_timings(self):
17 self.times = []
18
19+ def get_timings_max_len(self):
20+ return self.times_max_len
21+
22+ def set_timings_max_len(self, new_len):
23+ self.times_max_len = new_len
24+
25 def request(self, method, url, **kwargs):
26 """Send an http request with the specified characteristics.
27
28@@ -173,6 +180,9 @@
29 if self.timings:
30 self.times.append(("%s %s" % (method, url),
31 start_time, time.time()))
32+ # remove oldest items until we maintain max length
33+ while len(self.times) > self.times_max_len:
34+ del self.times[0]
35 self._http_log_resp(resp)
36
37 if resp.status_code >= 400:
diff --git a/meta-openstack/recipes-devtools/python/python-glanceclient_git.bb b/meta-openstack/recipes-devtools/python/python-glanceclient_git.bb
index 1d7a4d1..7777f99 100644
--- a/meta-openstack/recipes-devtools/python/python-glanceclient_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-glanceclient_git.bb
@@ -13,7 +13,10 @@ SRCREV = "23ad1d6db7ec8116afed7c8aca3832dac440930a"
13PV = "0.12.0+gitr${SRCREV}" 13PV = "0.12.0+gitr${SRCREV}"
14PR = "0" 14PR = "0"
15 15
16SRC_URI = "git://github.com/openstack/${PN}.git;protocol=https" 16SRC_URI = "\
17 git://github.com/openstack/${PN}.git;protocol=https \
18 file://fix_glanceclient_memory_leak.patch \
19 "
17 20
18S = "${WORKDIR}/git" 21S = "${WORKDIR}/git"
19 22
diff --git a/meta-openstack/recipes-devtools/python/python-hp3parclient/fix_hp3parclient_memory_leak.patch b/meta-openstack/recipes-devtools/python/python-hp3parclient/fix_hp3parclient_memory_leak.patch
new file mode 100644
index 0000000..ac196fd
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-hp3parclient/fix_hp3parclient_memory_leak.patch
@@ -0,0 +1,37 @@
1---
2 hp3parclient/http.py | 10 ++++++++++
3 1 file changed, 10 insertions(+)
4
5--- a/hp3parclient/http.py
6+++ b/hp3parclient/http.py
7@@ -61,6 +61,7 @@
8 self.set_debug_flag(http_log_debug)
9
10 self.times = [] # [("item", starttime, endtime), ...]
11+ self.times_max_len = 200
12
13 # httplib2 overrides
14 self.force_exception_to_status_code = True
15@@ -141,6 +142,12 @@
16 """
17 self.times = []
18
19+ def get_timings_max_len(self):
20+ return self.times_max_len
21+
22+ def set_timings_max_len(self, new_len):
23+ self.times_max_len = new_len
24+
25 def _http_log_req(self, args, kwargs):
26 if not self.http_log_debug:
27 return
28@@ -205,6 +212,9 @@
29 resp, body = self.request(url, method, **kwargs)
30 self.times.append(("%s %s" % (method, url),
31 start_time, time.time()))
32+ # remove oldest items until we maintain max length
33+ while len(self.times) > self.times_max_len:
34+ del self.times[0]
35 return resp, body
36
37
diff --git a/meta-openstack/recipes-devtools/python/python-hp3parclient_2.0.0.bb b/meta-openstack/recipes-devtools/python/python-hp3parclient_2.0.0.bb
index 75ad641..9be086f 100644
--- a/meta-openstack/recipes-devtools/python/python-hp3parclient_2.0.0.bb
+++ b/meta-openstack/recipes-devtools/python/python-hp3parclient_2.0.0.bb
@@ -7,7 +7,10 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57"
7PR = "r0" 7PR = "r0"
8SRCNAME = "hp3parclient" 8SRCNAME = "hp3parclient"
9 9
10SRC_URI = "https://pypi.python.org/packages/source/h/${SRCNAME}/${SRCNAME}-${PV}.tar.gz" 10SRC_URI = "\
11 https://pypi.python.org/packages/source/h/${SRCNAME}/${SRCNAME}-${PV}.tar.gz \
12 file://fix_hp3parclient_memory_leak.patch \
13 "
11 14
12SRC_URI[md5sum] = "52cdcb930eb0dc81d93689abe169c502" 15SRC_URI[md5sum] = "52cdcb930eb0dc81d93689abe169c502"
13SRC_URI[sha256sum] = "bab78a3fa14236d7884af52271fd91d08d51ec99b7e2d6c6fb477bfdfb9ef259" 16SRC_URI[sha256sum] = "bab78a3fa14236d7884af52271fd91d08d51ec99b7e2d6c6fb477bfdfb9ef259"
diff --git a/meta-openstack/recipes-devtools/python/python-keystoneclient/fix_keystoneclient_memory_leak.patch b/meta-openstack/recipes-devtools/python/python-keystoneclient/fix_keystoneclient_memory_leak.patch
new file mode 100644
index 0000000..05a1d23
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-keystoneclient/fix_keystoneclient_memory_leak.patch
@@ -0,0 +1,37 @@
1---
2 keystoneclient/openstack/common/apiclient/client.py | 10 ++++++++++
3 1 file changed, 10 insertions(+)
4
5--- a/keystoneclient/openstack/common/apiclient/client.py
6+++ b/keystoneclient/openstack/common/apiclient/client.py
7@@ -90,6 +90,7 @@
8 self.user_agent = user_agent or self.user_agent
9
10 self.times = [] # [("item", starttime, endtime), ...]
11+ self.times_max_len = 200
12 self.timings = timings
13
14 # requests within the same session can reuse TCP connections from pool
15@@ -142,6 +143,12 @@
16 def reset_timings(self):
17 self.times = []
18
19+ def get_timings_max_len(self):
20+ return self.times_max_len
21+
22+ def set_timings_max_len(self, new_len):
23+ self.times_max_len = new_len
24+
25 def request(self, method, url, **kwargs):
26 """Send an http request with the specified characteristics.
27
28@@ -173,6 +180,9 @@
29 if self.timings:
30 self.times.append(("%s %s" % (method, url),
31 start_time, time.time()))
32+ # remove oldest items until we maintain max length
33+ while len(self.times) > self.times_max_len:
34+ del self.times[0]
35 self._http_log_resp(resp)
36
37 if resp.status_code >= 400:
diff --git a/meta-openstack/recipes-devtools/python/python-keystoneclient_git.bb b/meta-openstack/recipes-devtools/python/python-keystoneclient_git.bb
index be2395a..89d8a9a 100644
--- a/meta-openstack/recipes-devtools/python/python-keystoneclient_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-keystoneclient_git.bb
@@ -6,7 +6,10 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=4a4d0e932ffae1c0131528d30d419c55"
6 6
7PR = "r0" 7PR = "r0"
8 8
9SRC_URI = "git://github.com/openstack/python-keystoneclient.git;branch=master" 9SRC_URI = "\
10 git://github.com/openstack/python-keystoneclient.git;branch=master \
11 file://fix_keystoneclient_memory_leak.patch \
12 "
10 13
11PV="0.6.0+git${SRCPV}" 14PV="0.6.0+git${SRCPV}"
12SRCREV="a6b8e506740935498f5eba319c67b740d17752a2" 15SRCREV="a6b8e506740935498f5eba319c67b740d17752a2"
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.
diff --git a/meta-openstack/recipes-devtools/python/python-novaclient_git.bb b/meta-openstack/recipes-devtools/python/python-novaclient_git.bb
index 2884e0f..7ac9b34 100644
--- a/meta-openstack/recipes-devtools/python/python-novaclient_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-novaclient_git.bb
@@ -7,7 +7,10 @@ DEPENDS = "python-setuptools-git"
7 7
8PR = "r0" 8PR = "r0"
9 9
10SRC_URI = "git://github.com/openstack/python-novaclient.git;branch=master" 10SRC_URI = "\
11 git://github.com/openstack/python-novaclient.git;branch=master \
12 file://fix_novaclient_memory_leak.patch \
13 "
11 14
12PV="2.16.0+git${SRCPV}" 15PV="2.16.0+git${SRCPV}"
13SRCREV="64043442bbafa48f9042b669d30292b1db00db4f" 16SRCREV="64043442bbafa48f9042b669d30292b1db00db4f"