From 23610ff803d5496517d2c0e9d44bb25cec3250c3 Mon Sep 17 00:00:00 2001 From: Bernardo Dal Seno <bdalseno@google.com> Date: Wed, 30 Jan 2013 22:44:24 +0100 Subject: [PATCH] QA: Added constants for LVM volumes The LVM volume group becomes a configurable parameter, and a prefix for logical volume names used in tests is introduced as a constant. Signed-off-by: Bernardo Dal Seno <bdalseno@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- qa/qa-sample.json | 2 ++ qa/qa_cluster.py | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/qa/qa-sample.json b/qa/qa-sample.json index 4c47a62fc..087ee6ced 100644 --- a/qa/qa-sample.json +++ b/qa/qa-sample.json @@ -19,6 +19,8 @@ "# Dict of OS name and value dict of hypervisor parameters": null, "os-hvp": {}, "primary_ip_version": 4, + "# Name of the LVM group for the cluster": null, + "vg-name": "xenvg", "# Network interface for master role": null, "#master-netdev": "xen-br0", diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py index 6811d74d8..1960acd72 100644 --- a/qa/qa_cluster.py +++ b/qa/qa_cluster.py @@ -39,6 +39,9 @@ import qa_error from qa_utils import AssertEqual, AssertCommand, GetCommandOutput +# Prefix for LVM volumes created by QA code during tests +_QA_LV_PREFIX = "qa-" + #: cluster verify command _CLUSTER_VERIFY = ["gnt-cluster", "verify"] @@ -185,6 +188,10 @@ def TestClusterInit(rapi_user, rapi_secret): if master.get("secondary", None): cmd.append("--secondary-ip=%s" % master["secondary"]) + vgname = qa_config.get("vg-name", None) + if vgname: + cmd.append("--vg-name=%s" % vgname) + master_netdev = qa_config.get("master-netdev", None) if master_netdev: cmd.append("--master-netdev=%s" % master_netdev) @@ -334,19 +341,23 @@ def TestDelay(node): def TestClusterReservedLvs(): """gnt-cluster reserved lvs""" + vgname = qa_config.get("vg-name", constants.DEFAULT_VG) + lvname = _QA_LV_PREFIX + "test" + lvfullname = "/".join([vgname, lvname]) for fail, cmd in [ (False, _CLUSTER_VERIFY), (False, ["gnt-cluster", "modify", "--reserved-lvs", ""]), - (False, ["lvcreate", "-L1G", "-nqa-test", "xenvg"]), + (False, ["lvcreate", "-L1G", "-n", lvname, vgname]), (True, _CLUSTER_VERIFY), (False, ["gnt-cluster", "modify", "--reserved-lvs", - "xenvg/qa-test,.*/other-test"]), + "%s,.*/other-test" % lvfullname]), (False, _CLUSTER_VERIFY), - (False, ["gnt-cluster", "modify", "--reserved-lvs", ".*/qa-.*"]), + (False, ["gnt-cluster", "modify", "--reserved-lvs", + ".*/%s.*" % _QA_LV_PREFIX]), (False, _CLUSTER_VERIFY), (False, ["gnt-cluster", "modify", "--reserved-lvs", ""]), (True, _CLUSTER_VERIFY), - (False, ["lvremove", "-f", "xenvg/qa-test"]), + (False, ["lvremove", "-f", lvfullname]), (False, _CLUSTER_VERIFY), ]: AssertCommand(cmd, fail=fail) -- GitLab