]> git-server-git.apps.pok.os.sepia.ceph.com Git - radosgw-agent.git/commitdiff
client: remove replica log entries using purge-all wip-8251
authorYehuda Sadeh <yehuda@inktank.com>
Mon, 12 May 2014 21:43:51 +0000 (14:43 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Mon, 12 May 2014 21:43:51 +0000 (14:43 -0700)
After we converted the old replica log entry we now purge it using purge-all,
so that next time we're not going to hit it.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
radosgw_agent/client.py

index 1ab63936ee855109bf70e9050e322636cca7f8d2..c1e9c83a59ec2339e91befb84b3a3375672320a6 100644 (file)
@@ -317,6 +317,23 @@ def del_worker_bound(connection, type_, daemon_id, id_, index_by_instance = True
         expect_json=False,
         )
 
+def purge_bounds(connection, type_, id_, index_by_instance = True):
+    key = _id_name(type_)
+    p ={
+        'type': type_,
+        key: id_,
+        'purge-all': 'true',
+    }
+    if not index_by_instance:
+        p['index-by-instance'] = 'false'
+
+    return request(
+        connection, 'delete', 'admin/replica_log',
+        params=p,
+        special_first_param='work_bound',
+        expect_json=False,
+        )
+
 def get_worker_bound(connection, type_, id_):
     key = _id_name(type_)
     try:
@@ -353,9 +370,8 @@ def get_worker_bound(connection, type_, id_):
 
             boto.log.debug('entities: %r', entities)
 
-            for e in entities:
-                boto.log.debug('removing entity: %r', e)
-                del_worker_bound(connection, type_, e, id_, index_by_instance = False)
+            boto.log.debug('purging all bounds for: %r', id_)
+            purge_bounds(connection, type_, id_, index_by_instance = False)
 
             raise