From 74ff8b41ea79f4088c1f793a008a80ccc75471d9 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 12 Jan 2020 16:00:49 -0500 Subject: [PATCH] Add prov warning to primary/secondary commands Warn the administrator if there are active provisioning jobs while adjusting the current primary node. This is the simplest, cleanest solution to #69 without trying to implement any hacks or blocking operations. The administrator can then decide to revert the action if needed, or will at least know how many jobs are running/queued and may need to be cancelled. --- client-cli/pvc.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client-cli/pvc.py b/client-cli/pvc.py index 20d4f986..932fce12 100755 --- a/client-cli/pvc.py +++ b/client-cli/pvc.py @@ -351,6 +351,11 @@ def node_secondary(node): Take NODE out of primary router mode. """ + task_retcode, task_retdata = pvc_provisioner.task_status(config, None) + if len(task_retdata) > 0: + click.echo("Note: There are currently {} active or queued provisioner jobs on the current primary node. These will continue executing, but job status will not be visible until the current node returns to primary state.".format(len(task_retdata)) + click.echo() + retcode, retmsg = pvc_node.node_coordinator_state(config, node, 'secondary') cleanup(retcode, retmsg) @@ -366,6 +371,11 @@ def node_primary(node): Put NODE into primary router mode. """ + task_retcode, task_retdata = pvc_provisioner.task_status(config, None) + if len(task_retdata) > 0: + click.echo("Note: There are currently {} active or queued provisioner jobs on the current primary node. These will continue executing, but job status will not be visible until the current node returns to primary state.".format(len(task_retdata)) + click.echo() + retcode, retmsg = pvc_node.node_coordinator_state(config, node, 'primary') cleanup(retcode, retmsg)