From 3f3e61f148a5b426fea148bab4ddefd1177a8452 Mon Sep 17 00:00:00 2001 From: Daniel Badea Date: Fri, 10 May 2019 11:23:31 +0000 Subject: [PATCH] python-cephclient: delete finished requests ceph-mgr REST API supports synchronous and asynchronous requests. In asynchronous mode clients can run multiple requests in parallel then poll to get status of finished requests. ceph-mgr restful plugin keeps a list of requests that were initiated by the client and forwarded towards ceph-mgr. It expects the client to delete finished requests after retrieving current status. python-cephclient is making synchronous requests (using POST to "/request?wait=1") but the server is converting them asynchronus then polls for status on its side. So after getting a response back the client is still expected to DELETE "/request?id=..." Currently it's not doing that and ceph-mgr restful plugin is accumulating a list of all requests ever made by python-cephclient Change-Id: If8d5c8b27135fde45116e05bb04b655d9574c5ca Closes-Bug: 1828549 Signed-off-by: Daniel Badea --- .../python-cephclient/python-cephclient/cephclient/client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ceph/python-cephclient/python-cephclient/cephclient/client.py b/ceph/python-cephclient/python-cephclient/cephclient/client.py index 331e6536..0728fa77 100644 --- a/ceph/python-cephclient/python-cephclient/cephclient/client.py +++ b/ceph/python-cephclient/python-cephclient/cephclient/client.py @@ -190,7 +190,10 @@ class CephClient(object): verify=self.check_certificate, timeout=timeout).json() LOG.info('Result: {}'.format(result)) - if 'is_finished' not in result: + if 'is_finished' in result: + self.session.delete( + self.service_url + 'request?id=' + result['id']) + else: assert('message' in result) if 'auth: No such user' in result['message']: raise CephClientNoSuchUser(user=self.username)