From c2a0947df72a46419fa7d5f28417251f4c6d8661 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 27 Jul 2011 18:45:16 +0200 Subject: [PATCH] Add a QA constant for cluster verify command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This seems to be used and reused multiple times, let's abstract it⦠Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- qa/qa_cluster.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py index ee12557bf..b531d5cce 100644 --- a/qa/qa_cluster.py +++ b/qa/qa_cluster.py @@ -37,6 +37,9 @@ import qa_error from qa_utils import AssertEqual, AssertCommand, GetCommandOutput +#: cluster verify command +_CLUSTER_VERIFY = ["gnt-cluster", "verify"] + def _RemoveFileFromAllNodes(filename): """Removes a file from all nodes. @@ -108,13 +111,11 @@ def TestClusterRename(): print qa_utils.FormatError('"rename" entry is missing') return - cmd_verify = ["gnt-cluster", "verify"] - for data in [ cmd + [rename_target], - cmd_verify, + _CLUSTER_VERIFY, cmd + [original_name], - cmd_verify, + _CLUSTER_VERIFY, ]: AssertCommand(data) @@ -123,12 +124,12 @@ def TestClusterOob(): """out-of-band framework""" oob_path_exists = "/tmp/ganeti-qa-oob-does-exist-%s" % utils.NewUUID() - AssertCommand(["gnt-cluster", "verify"]) + AssertCommand(_CLUSTER_VERIFY) AssertCommand(["gnt-cluster", "modify", "--node-parameters", "oob_program=/tmp/ganeti-qa-oob-does-not-exist-%s" % utils.NewUUID()]) - AssertCommand(["gnt-cluster", "verify"], fail=True) + AssertCommand(_CLUSTER_VERIFY, fail=True) AssertCommand(["touch", oob_path_exists]) AssertCommand(["chmod", "0400", oob_path_exists]) @@ -138,12 +139,12 @@ def TestClusterOob(): AssertCommand(["gnt-cluster", "modify", "--node-parameters", "oob_program=%s" % oob_path_exists]) - AssertCommand(["gnt-cluster", "verify"], fail=True) + AssertCommand(_CLUSTER_VERIFY, fail=True) AssertCommand(["chmod", "0500", oob_path_exists]) AssertCommand(["gnt-cluster", "copyfile", oob_path_exists]) - AssertCommand(["gnt-cluster", "verify"]) + AssertCommand(_CLUSTER_VERIFY) finally: AssertCommand(["gnt-cluster", "command", "rm", oob_path_exists]) @@ -191,7 +192,7 @@ def TestClusterEpo(): def TestClusterVerify(): """gnt-cluster verify""" - AssertCommand(["gnt-cluster", "verify"]) + AssertCommand(_CLUSTER_VERIFY) AssertCommand(["gnt-cluster", "verify-disks"]) @@ -202,21 +203,20 @@ def TestJobqueue(): def TestClusterReservedLvs(): """gnt-cluster reserved lvs""" - CVERIFY = ["gnt-cluster", "verify"] for fail, cmd in [ - (False, CVERIFY), + (False, _CLUSTER_VERIFY), (False, ["gnt-cluster", "modify", "--reserved-lvs", ""]), (False, ["lvcreate", "-L1G", "-nqa-test", "xenvg"]), - (True, CVERIFY), + (True, _CLUSTER_VERIFY), (False, ["gnt-cluster", "modify", "--reserved-lvs", "xenvg/qa-test,.*/other-test"]), - (False, CVERIFY), + (False, _CLUSTER_VERIFY), (False, ["gnt-cluster", "modify", "--reserved-lvs", ".*/qa-.*"]), - (False, CVERIFY), + (False, _CLUSTER_VERIFY), (False, ["gnt-cluster", "modify", "--reserved-lvs", ""]), - (True, CVERIFY), + (True, _CLUSTER_VERIFY), (False, ["lvremove", "-f", "xenvg/qa-test"]), - (False, CVERIFY), + (False, _CLUSTER_VERIFY), ]: AssertCommand(cmd, fail=fail) -- GitLab