Skip to content
Snippets Groups Projects
Commit 8ccbbe4b authored by Guido Trotter's avatar Guido Trotter
Browse files

qa: use maximum and minimum memory


test modification of either parameter, but also both at once.

Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent f5a4b9ce
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,8 @@
"primary_ip_version": 4,
"os": "debian-etch",
"mem": "512M",
"maxmem": "1024M",
"minmem": "512M",
"# Lists of disk sizes": null,
"disk": ["1G", "512M"],
......
......@@ -257,12 +257,18 @@ def TestClusterReservedLvs():
def TestClusterModifyBe():
"""gnt-cluster modify -B"""
for fail, cmd in [
# mem
(False, ["gnt-cluster", "modify", "-B", "memory=256"]),
(False, ["sh", "-c", "gnt-cluster info|grep '^ *memory: 256$'"]),
(True, ["gnt-cluster", "modify", "-B", "memory=a"]),
(False, ["gnt-cluster", "modify", "-B", "memory=128"]),
(False, ["sh", "-c", "gnt-cluster info|grep '^ *memory: 128$'"]),
# max/min mem
(False, ["gnt-cluster", "modify", "-B", "maxmem=256"]),
(False, ["sh", "-c", "gnt-cluster info|grep '^ *maxmem: 256$'"]),
(False, ["gnt-cluster", "modify", "-B", "minmem=256"]),
(False, ["sh", "-c", "gnt-cluster info|grep '^ *minmem: 256$'"]),
(True, ["gnt-cluster", "modify", "-B", "maxmem=a"]),
(False, ["sh", "-c", "gnt-cluster info|grep '^ *maxmem: 256$'"]),
(True, ["gnt-cluster", "modify", "-B", "minmem=a"]),
(False, ["sh", "-c", "gnt-cluster info|grep '^ *minmem: 256$'"]),
(False, ["gnt-cluster", "modify", "-B", "maxmem=128,minmem=128"]),
(False, ["sh", "-c", "gnt-cluster info|grep '^ *maxmem: 128$'"]),
(False, ["sh", "-c", "gnt-cluster info|grep '^ *minmem: 128$'"]),
# vcpus
(False, ["gnt-cluster", "modify", "-B", "vcpus=4"]),
(False, ["sh", "-c", "gnt-cluster info|grep '^ *vcpus: 4$'"]),
......
......@@ -42,7 +42,11 @@ def _GetDiskStatePath(disk):
def _GetGenericAddParameters():
params = ["-B", "%s=%s" % (constants.BE_MEMORY, qa_config.get("mem"))]
params = ["-B"]
params.append("%s=%s,%s=%s" % (constants.BE_MINMEM,
qa_config.get(constants.BE_MINMEM),
constants.BE_MAXMEM,
qa_config.get(constants.BE_MAXMEM)))
for idx, size in enumerate(qa_config.get("disk")):
params.extend(["--disk", "%s:size=%s" % (idx, size)])
return params
......@@ -196,11 +200,14 @@ def TestInstanceModify(instance):
test_kernel = "/sbin/init"
test_initrd = test_kernel
orig_memory = qa_config.get("mem")
orig_maxmem = qa_config.get(constants.BE_MAXMEM)
orig_minmem = qa_config.get(constants.BE_MINMEM)
#orig_bridge = qa_config.get("bridge", "xen-br0")
args = [
["-B", "%s=128" % constants.BE_MEMORY],
["-B", "%s=%s" % (constants.BE_MEMORY, orig_memory)],
["-B", "%s=128" % constants.BE_MINMEM],
["-B", "%s=128" % constants.BE_MAXMEM],
["-B", "%s=%s,%s=%s" % (constants.BE_MINMEM, orig_minmem,
constants.BE_MAXMEM, orig_maxmem)],
["-B", "%s=2" % constants.BE_VCPUS],
["-B", "%s=1" % constants.BE_VCPUS],
["-B", "%s=%s" % (constants.BE_VCPUS, constants.VALUE_DEFAULT)],
......
......@@ -527,13 +527,13 @@ def TestRapiInstanceAdd(node, use_client):
"""Test adding a new instance via RAPI"""
instance = qa_config.AcquireInstance()
try:
memory = utils.ParseUnit(qa_config.get("mem"))
disk_sizes = [utils.ParseUnit(size) for size in qa_config.get("disk")]
disks = [{"size": size} for size in disk_sizes]
nics = [{}]
beparams = {
constants.BE_MEMORY: memory,
constants.BE_MAXMEM: utils.ParseUnit(qa_config.get(constants.BE_MAXMEM)),
constants.BE_MINMEM: utils.ParseUnit(qa_config.get(constants.BE_MINMEM)),
}
if use_client:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment