Commit 23610ff8 authored by Bernardo Dal Seno's avatar Bernardo Dal Seno
Browse files

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: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent efd58d99
......@@ -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",
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment