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.
This commit is contained in:
Joshua Boniface 2019-06-18 21:53:30 -04:00
parent 537ad5de43
commit b50b2a827b
1 changed files with 12 additions and 2 deletions

View File

@ -791,7 +791,12 @@ def add_pool(zk_conn, name, pgs):
message = 'ERROR: Command ignored by node.'
success = False
# 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
# 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):