Commit e85be22a authored by Bernardo Dal Seno's avatar Bernardo Dal Seno

Add option to disable iallocator use in QA

By default some QA tests use iallocators. It is now possible to disable
iallocators in QA, so that QA doesn't force having iallocators set up.
The affected tests have now alternatives pathways.
Signed-off-by: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 8bd977e9
......@@ -164,7 +164,8 @@
"burnin-check-instances": false,
"burnin-rename": "xen-test-rename",
"burnin-reboot": true,
"reboot-types": ["soft", "hard", "full"]
"reboot-types": ["soft", "hard", "full"],
"use-iallocators": false
},
"# vim: set syntax=javascript :": null
......
......@@ -485,19 +485,23 @@ def TestReplaceDisks(instance, pnode, snode, othernode):
cmd.append(instance["name"])
return cmd
options = qa_config.get("options", {})
use_ialloc = options.get("use-iallocators", True)
for data in [
["-p"],
["-s"],
["--new-secondary=%s" % othernode["primary"]],
["-I", constants.DEFAULT_IALLOCATOR_SHORTCUT],
# A placeholder; the actual command choice depends on use_ialloc
None,
# Restore the original secondary
["--new-secondary=%s" % snode["primary"]],
]:
if data is None:
if use_ialloc:
data = ["-I", constants.DEFAULT_IALLOCATOR_SHORTCUT]
else:
data = ["--new-secondary=%s" % othernode["primary"]]
AssertCommand(buildcmd(data))
# Restore the original secondary, if needed
currsec = _GetInstanceInfo(instance)["nodes"][1]
if currsec != snode["primary"]:
AssertCommand(buildcmd(["--new-secondary=%s" % snode["primary"]]))
AssertCommand(buildcmd(["-a"]))
AssertCommand(["gnt-instance", "stop", instance["name"]])
AssertCommand(buildcmd(["-a"]), fail=True)
......@@ -541,22 +545,31 @@ def TestRecreateDisks(instance, pnode, snode, othernodes):
@param othernodes: list/tuple of nodes where to temporarily recreate disks
"""
options = qa_config.get("options", {})
use_ialloc = options.get("use-iallocators", True)
other_seq = ":".join([n["primary"] for n in othernodes])
orig_seq = pnode["primary"]
if snode:
orig_seq = orig_seq + ":" + snode["primary"]
# These fail because the instance is running
_AssertRecreateDisks(["-n", other_seq], instance, fail=True, destroy=False)
_AssertRecreateDisks(["-I", "hail"], instance, fail=True, destroy=False)
if use_ialloc:
_AssertRecreateDisks(["-I", "hail"], instance, fail=True, destroy=False)
else:
_AssertRecreateDisks(["-n", other_seq], instance, fail=True, destroy=False)
AssertCommand(["gnt-instance", "stop", instance["name"]])
# Disks exist: this should fail
_AssertRecreateDisks([], instance, fail=True, destroy=False)
# Recreate disks in place
_AssertRecreateDisks([], instance)
# Move disks away
_AssertRecreateDisks(["-I", "hail"], instance)
# Move disks somewhere else
_AssertRecreateDisks(["-I", constants.DEFAULT_IALLOCATOR_SHORTCUT], instance)
if use_ialloc:
_AssertRecreateDisks(["-I", "hail"], instance)
# Move disks somewhere else
_AssertRecreateDisks(["-I", constants.DEFAULT_IALLOCATOR_SHORTCUT],
instance)
else:
_AssertRecreateDisks(["-n", other_seq], instance)
# Move disks back
_AssertRecreateDisks(["-n", orig_seq], instance, check=False)
# This and InstanceCheck decoration check that the disks are working
......
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