From 77e215b0eb9a79afa05d83d9dae906d7b82b595d Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 27 Jun 2019 14:36:58 -0400 Subject: [PATCH] Don't queue flushes without --wait Don't try to queue up a flush when there is already a flush lock; direct the user to use --wait (which will actually wait before triggering the new action), or try again later. --- client-common/node.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client-common/node.py b/client-common/node.py index dc3989b7..68696cc6 100644 --- a/client-common/node.py +++ b/client-common/node.py @@ -150,7 +150,9 @@ def flush_node(zk_conn, node, wait): return False, 'ERROR: No node named "{}" is present in the cluster.'.format(node) if zkhandler.readdata(zk_conn, '/locks/flush_lock') == 'True': - retmsg = 'Flushing hypervisor {} of running VMs. A flush lock currently exists; flush will continue once the lock is freed.'.format(node) + retmsg = 'A lock currently exists; use --wait to wait for it, or try again later.'.format(node) + if not wait: + return False, retmsg lock_wait = True else: retmsg = 'Flushing hypervisor {} of running VMs.'.format(node) @@ -185,7 +187,9 @@ def ready_node(zk_conn, node, wait): return False, 'ERROR: No node named "{}" is present in the cluster.'.format(node) if zkhandler.readdata(zk_conn, '/locks/flush_lock') == 'True': - retmsg = 'Restoring hypervisor {} to active service. A flush lock currently exists; unflush will continue once the lock is freed.'.format(node) + retmsg = 'A lock currently exists; use --wait to wait for it, or try again later.'.format(node) + if not wait: + return False, retmsg lock_wait = True else: retmsg = 'Restoring hypervisor {} to active service.'.format(node)