Commit e0d15aae authored by Klaus Aehlig's avatar Klaus Aehlig

Add shelltests verifying hail applies disk ipolicy per disk

We test on two minimal examples, a positive and a negative one, where
the possibility to allocate a node depends on whether the disk policy
is checked on a per-disk level or on the total amount of disk space
requested.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 241cea1e
......@@ -959,6 +959,8 @@ TEST_FILES = \
test/data/htools/common-suffix.data \
test/data/htools/empty-cluster.data \
test/data/htools/hail-alloc-drbd.json \
test/data/htools/hail-alloc-invalid-twodisks.json \
test/data/htools/hail-alloc-twodisks.json \
test/data/htools/hail-change-group.json \
test/data/htools/hail-invalid-reloc.json \
test/data/htools/hail-node-evac.json \
......
{
"cluster_tags": [],
"instances": {},
"ipolicy": {
"max": {
"disk-size": 2048
},
"min": {
"disk-size": 1024
}
},
"nodegroups": {
"uuid-group-1": {
"alloc_policy": "preferred",
"ipolicy": {
"disk-templates": [
"file"
],
"max": {
"cpu-count": 2,
"disk-count": 8,
"disk-size": 2048,
"memory-size": 12800,
"nic-count": 8,
"spindle-use": 8
},
"min": {
"cpu-count": 1,
"disk-count": 1,
"disk-size": 1024,
"memory-size": 128,
"nic-count": 1,
"spindle-use": 1
},
"spindle-ratio": 32.0,
"std": {
"cpu-count": 1,
"disk-count": 1,
"disk-size": 1024,
"memory-size": 128,
"nic-count": 1,
"spindle-use": 1
},
"vcpu-ratio": 4.0
},
"name": "default",
"tags": []
}
},
"nodes": {
"node1": {
"drained": false,
"free_disk": 1377280,
"free_memory": 31389,
"group": "uuid-group-1",
"ndparams": {
"spindle_count": 1
},
"offline": false,
"reserved_memory": 1017,
"total_cpus": 4,
"total_disk": 1377280,
"total_memory": 32763
}
},
"request": {
"disk_space_total": 1536,
"disk_template": "file",
"disks": [
{
"size": 768
},
{
"size": 768
}
],
"memory": 1024,
"name": "instance1",
"required_nodes": 1,
"spindle_use": 2,
"tags": [],
"type": "allocate",
"vcpus": 1
},
"version": 2
}
{
"cluster_tags": [],
"instances": {},
"ipolicy": {
"max": {
"disk-size": 2048
},
"min": {
"disk-size": 1024
}
},
"nodegroups": {
"uuid-group-1": {
"alloc_policy": "preferred",
"ipolicy": {
"disk-templates": [
"file"
],
"max": {
"cpu-count": 2,
"disk-count": 8,
"disk-size": 2048,
"memory-size": 12800,
"nic-count": 8,
"spindle-use": 8
},
"min": {
"cpu-count": 1,
"disk-count": 1,
"disk-size": 1024,
"memory-size": 128,
"nic-count": 1,
"spindle-use": 1
},
"spindle-ratio": 32.0,
"std": {
"cpu-count": 1,
"disk-count": 1,
"disk-size": 1024,
"memory-size": 128,
"nic-count": 1,
"spindle-use": 1
},
"vcpu-ratio": 4.0
},
"name": "default",
"tags": []
}
},
"nodes": {
"node1": {
"drained": false,
"free_disk": 1377280,
"free_memory": 31389,
"group": "uuid-group-1",
"ndparams": {
"spindle_count": 1
},
"offline": false,
"reserved_memory": 1017,
"total_cpus": 4,
"total_disk": 1377280,
"total_memory": 32763
}
},
"request": {
"disk_space_total": 3072,
"disk_template": "file",
"disks": [
{
"size": 1536
},
{
"size": 1536
}
],
"memory": 1024,
"name": "instance1",
"required_nodes": 1,
"spindle_use": 2,
"tags": [],
"type": "allocate",
"vcpus": 1
},
"version": 2
}
......@@ -38,6 +38,15 @@ echo '{"request": 0}' | ./test/hs/hail -
>>> /"success":true,"info":"Request successful: 0 instances failed to move and 1 were moved successfully"/
>>>= 0
# check that hail correctly applies the disk policy on a per-disk basis
./test/hs/hail $TESTDATA_DIR/hail-alloc-twodisks.json
>>> /"success":true,.*,"result":\["node1"\]/
>>>= 0
./test/hs/hail $TESTDATA_DIR/hail-alloc-invalid-twodisks.json
>>> /"success":false,.*FailDisk: 1/
>>>= 0
# check that hail can use the simu backend
./test/hs/hail --simu p,8,8T,16g,16 $TESTDATA_DIR/hail-alloc-drbd.json
>>> /"success":true,/
......
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