From b50b2a827b918d82a0629b07b4951749bf3950d3 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 18 Jun 2019 21:53:30 -0400 Subject: [PATCH] Add forced delays after pool add/remove Prevents returning immediately to give the cluster some breathing room before the admin can do other commands. Keep the write lock as well to prevent other clients from attempting this as well. --- client-common/ceph.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/client-common/ceph.py b/client-common/ceph.py index 2e0f143a..d6189176 100644 --- a/client-common/ceph.py +++ b/client-common/ceph.py @@ -791,7 +791,12 @@ def add_pool(zk_conn, name, pgs): message = 'ERROR: Command ignored by node.' success = False - zkhandler.writedata(zk_conn, {'/ceph/cmd': ''}) + # Acquire a write lock to ensure things go smoothly + lock = zkhandler.writelock(zk_conn, '/ceph/cmd') + with lock: + time.sleep(3) + zkhandler.writedata(zk_conn, {'/ceph/cmd': ''}) + return success, message def remove_pool(zk_conn, name): @@ -818,7 +823,12 @@ def remove_pool(zk_conn, name): message = 'ERROR: Command ignored by node: {}'.format(e) success = False - zkhandler.writedata(zk_conn, {'/ceph/cmd': ''}) + # Acquire a write lock to ensure things go smoothly + lock = zkhandler.writelock(zk_conn, '/ceph/cmd') + with lock: + time.sleep(3) + zkhandler.writedata(zk_conn, {'/ceph/cmd': ''}) + return success, message def get_list_pool(zk_conn, limit):