From 3e0ed18c3d124c934cf35c6bdf760a2173bebfe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Nussbaumer?= <rn@google.com> Date: Mon, 19 Mar 2012 08:55:58 +0100 Subject: [PATCH] EPO: Pass the no_remember parameter to preserve state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RenΓ© Nussbaumer <rn@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/client/gnt_cluster.py | 8 +++++--- qa/qa_cluster.py | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py index ad7d95cd4..2ac33dfaf 100644 --- a/lib/client/gnt_cluster.py +++ b/lib/client/gnt_cluster.py @@ -1002,12 +1002,13 @@ def _OobPower(opts, node_list, power): return True -def _InstanceStart(opts, inst_list, start): +def _InstanceStart(opts, inst_list, start, no_remember=False): """Puts the instances in the list to desired state. @param opts: The command line options selected by the user @param inst_list: The list of instances to operate on @param start: True if they should be started, False for shutdown + @param no_remember: If the instance state should be remembered @return: The success of the operation (none failed) """ @@ -1016,7 +1017,8 @@ def _InstanceStart(opts, inst_list, start): text_submit, text_success, text_failed = ("startup", "started", "starting") else: opcls = compat.partial(opcodes.OpInstanceShutdown, - timeout=opts.shutdown_timeout) + timeout=opts.shutdown_timeout, + no_remember=no_remember) text_submit, text_success, text_failed = ("shutdown", "stopped", "stopping") jex = JobExecutor(opts=opts) @@ -1196,7 +1198,7 @@ def _EpoOff(opts, node_list, inst_map): @return: The desired exit status """ - if not _InstanceStart(opts, inst_map.keys(), False): + if not _InstanceStart(opts, inst_map.keys(), False, no_remember=True): ToStderr("Please investigate and stop instances manually before continuing") return constants.EXIT_FAILURE diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py index a9381a9b8..3d5847abc 100644 --- a/qa/qa_cluster.py +++ b/qa/qa_cluster.py @@ -202,7 +202,8 @@ def TestClusterEpo(): # All instances should have been stopped now result_output = GetCommandOutput(master["primary"], "gnt-instance list --no-headers -o status") - AssertEqual(compat.all(status == "ADMIN_down" + # ERROR_down because the instance is stopped but not recorded as such + AssertEqual(compat.all(status == "ERROR_down" for status in result_output.splitlines()), True) # Now start everything again -- GitLab