* hbal test with memory ratio = 1 i.e. with over-commitment disabled * hbal test with memory ratio = 2 i.e. with over-commitment enabled * hail test with memory ratio = 32 in order to test rapi backend
Signed-off-by: Oleg Ponomarev <[email protected]> --- Makefile.am | 3 + .../htools/hail-alloc-memory-over-commitment.json | 204 +++++++++++++++++++++ .../data/htools/hbal-memory-over-commitment-2.data | 13 ++ test/data/htools/hbal-memory-over-commitment.data | 13 ++ test/hs/shelltests/htools-hail.test | 5 + test/hs/shelltests/htools-hbal.test | 8 + 6 files changed, 246 insertions(+) create mode 100644 test/data/htools/hail-alloc-memory-over-commitment.json create mode 100644 test/data/htools/hbal-memory-over-commitment-2.data create mode 100644 test/data/htools/hbal-memory-over-commitment.data diff --git a/Makefile.am b/Makefile.am index 62027fe..357775c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1732,6 +1732,7 @@ TEST_FILES = \ test/data/htools/hail-alloc-secondary.json \ test/data/htools/hail-alloc-spindles.json \ test/data/htools/hail-alloc-twodisks.json \ + test/data/htools/hail-alloc-memory-over-commitment.json \ test/data/htools/hail-change-group.json \ test/data/htools/hail-invalid-reloc.json \ test/data/htools/hail-node-evac.json \ @@ -1750,6 +1751,8 @@ TEST_FILES = \ test/data/htools/hbal-location-1.data \ test/data/htools/hbal-location-exclusion.data \ test/data/htools/hbal-location-2.data \ + test/data/htools/hbal-memory-over-commitment.data \ + test/data/htools/hbal-memory-over-commitment-2.data \ test/data/htools/hbal-migration-1.data \ test/data/htools/hbal-migration-2.data \ test/data/htools/hbal-migration-3.data \ diff --git a/test/data/htools/hail-alloc-memory-over-commitment.json b/test/data/htools/hail-alloc-memory-over-commitment.json new file mode 100644 index 0000000..58c3b5d --- /dev/null +++ b/test/data/htools/hail-alloc-memory-over-commitment.json @@ -0,0 +1,204 @@ +{ + "cluster_tags": [ + "htools:desiredlocation:power", + "htools:nlocation:power" + ], + "nodegroups": { + "uuid-group-1": { + "ipolicy": { + "std": { + "nic-count": 1, + "disk-size": 1024, + "disk-count": 1, + "memory-size": 128, + "cpu-count": 1, + "spindle-use": 1 + }, + "minmax": [ + { + "min": { + "nic-count": 1, + "disk-size": 128, + "disk-count": 1, + "memory-size": 128, + "cpu-count": 1, + "spindle-use": 1 + }, + "max": { + "nic-count": 8, + "disk-size": 1048576, + "disk-count": 16, + "memory-size": 32768, + "cpu-count": 8, + "spindle-use": 8 + } + } + ], + "vcpu-ratio": 4.0, + "disk-templates": [ + "sharedfile", + "diskless", + "plain", + "blockdev", + "drbd", + "file", + "rbd" + ], + "spindle-ratio": 32.0, + "memory-ratio": 2 + }, + "networks": [], + "alloc_policy": "preferred", + "tags": [], + "name": "default" + } + }, + "cluster_name": "cluster", + "instances": { + "instance1": { + "disks": [ + { + "spindles": 1, + "mode": "rw", + "size": 51200 + } + ], + "disk_space_total": 51200, + "hypervisor": "xen-pvm", + "tags": [ + "test:test" + ], + "nics": [ + { + "ip": null, + "mac": "aa:00:00:10:d2:01", + "link": "xen-br0", + "mode": "bridged", + "bridge": "xen-br0" + } + ], + "vcpus": 1, + "spindle_use": 1, + "admin_state": "up", + "admin_state_source": "admin", + "disk_template": "drbd", + "memory": 1024, + "nodes": [ + "node1", + "node2" + ], + "os": "instance-debootstrap" + }, + "instance2": { + "disks": [ + { + "spindles": 1, + "mode": "rw", + "size": 51200 + } + ], + "disk_space_total": 51200, + "hypervisor": "xen-pvm", + "tags": [ + "test:test" + ], + "nics": [ + { + "ip": null, + "mac": "aa:00:00:10:d2:01", + "link": "xen-br0", + "mode": "bridged", + "bridge": "xen-br0" + } + ], + "vcpus": 1, + "spindle_use": 1, + "admin_state": "up", + "admin_state_source": "admin", + "disk_template": "drbd", + "memory": 1024, + "nodes": [ + "node2", + "node1" + ], + "os": "instance-debootstrap" + } + }, + "nodes": { + "node1": { + "total_disk": 307200, + "total_cpus": 4, + "group": "uuid-group-1", + "i_pri_up_memory": 0, + "tags": [ + "power:a" + ], + "master_candidate": true, + "free_memory": 256, + "ndparams": { + "spindle_count": 1, + "oob_program": null, + "exclusive_storage": false + }, + "reserved_cpus": 1, + "master_capable": true, + "free_disk": 307200, + "drained": false, + "total_memory": 1280, + "i_pri_memory": 0, + "reserved_memory": 0, + "free_spindles": 12, + "total_spindles": 12, + "vm_capable": true, + "offline": false + }, + "node2": { + "total_disk": 307200, + "total_cpus": 4, + "group": "uuid-group-1", + "i_pri_up_memory": 0, + "tags": [ + "power:b" + ], + "master_candidate": true, + "free_memory": 256, + "ndparams": { + "spindle_count": 1, + "oob_program": null, + "exclusive_storage": false + }, + "reserved_cpus": 1, + "master_capable": true, + "free_disk": 307200, + "drained": false, + "total_memory": 1280, + "i_pri_memory": 0, + "reserved_memory": 0, + "free_spindles": 12, + "total_spindles": 12, + "vm_capable": true, + "offline": false + } + }, + "request": { + "disk_space_total": 0, + "disk_template": "drbd", + "disks": [ + { + "size": 1024 + } + ], + "hypervisor": "xen-pvm", + "memory": 256, + "name": "instance-new", + "nics": [], + "os": "instance-debootstrap", + "required_nodes": 2, + "spindle_use": 1, + "tags": [ + "power:a" + ], + "type": "allocate", + "vcpus": 1 + } +} diff --git a/test/data/htools/hbal-memory-over-commitment-2.data b/test/data/htools/hbal-memory-over-commitment-2.data new file mode 100644 index 0000000..d9cd6ea --- /dev/null +++ b/test/data/htools/hbal-memory-over-commitment-2.data @@ -0,0 +1,13 @@ +group-01|fake-uuid-01|preferred|| + +node-01|1024|0|0|409600|256000|16|N|fake-uuid-01|1|power:a +node-02|1280|0|128|409600|256000|16|N|fake-uuid-01|1|power:b + +inst1|1024|51200|1|running|Y|node-01|node-02|drbd|power:a|1 +inst2|1024|51200|1|running|Y|node-02|node-01|drbd|power:b|1 +inst3|128|51200|1|running|Y|node-02|node-01|drbd|power:a|1 + +htools:desiredlocation:power +htools:nlocation:power + +group-01|128,1,1024,1,1,1|128,1,1024,1,1,1;32768,8,1048576,16,8,12|diskless,file,sharedfile,plain,blockdev,drbd,rbd,ext|4.0|32.0|2.0 diff --git a/test/data/htools/hbal-memory-over-commitment.data b/test/data/htools/hbal-memory-over-commitment.data new file mode 100644 index 0000000..c307d8f --- /dev/null +++ b/test/data/htools/hbal-memory-over-commitment.data @@ -0,0 +1,13 @@ +group-01|fake-uuid-01|preferred|| + +node-01|1024|0|0|409600|256000|16|N|fake-uuid-01|1|power:a +node-02|1280|0|128|409600|256000|16|N|fake-uuid-01|1|power:b + +inst1|1024|51200|1|running|Y|node-01|node-02|drbd|power:a|1 +inst2|1024|51200|1|running|Y|node-02|node-01|drbd|power:b|1 +inst3|128|51200|1|running|Y|node-02|node-01|drbd|power:a|1 + +htools:desiredlocation:power +htools:nlocation:power + +group-01|128,1,1024,1,1,1|128,1,1024,1,1,1;32768,8,1048576,16,8,12|diskless,file,sharedfile,plain,blockdev,drbd,rbd,ext|4.0|32.0|1.0 diff --git a/test/hs/shelltests/htools-hail.test b/test/hs/shelltests/htools-hail.test index c1dccaa..b34a2b8 100644 --- a/test/hs/shelltests/htools-hail.test +++ b/test/hs/shelltests/htools-hail.test @@ -224,3 +224,8 @@ cat $TESTDATA_DIR/hail-alloc-invalid-network.json | grep -v -e '"network":"uuid- ./test/hs/hail $TESTDATA_DIR/hail-alloc-secondary.json >>> /successes 2, failures 0.*"result":"node-2-2"/ >>>= 0 + +# Memory over-commitment test +./test/hs/hail $TESTDATA_DIR/hail-alloc-memory-over-commitment.json +>>> /"success":true.*/ +>>>= 0 diff --git a/test/hs/shelltests/htools-hbal.test b/test/hs/shelltests/htools-hbal.test index e1a3c1e..f7ce274 100644 --- a/test/hs/shelltests/htools-hbal.test +++ b/test/hs/shelltests/htools-hbal.test @@ -100,3 +100,11 @@ ./test/hs/hbal -t $TESTDATA_DIR/hbal-avoid-disk-moves.data --avoid-disk-moves=5 >>>/Solution length=2/ >>>= 0 + +./test/hs/hbal -t $TESTDATA_DIR/hbal-memory-over-commitment.data +>>>/No solution found/ +>>>= 0 + +./test/hs/hbal -t $TESTDATA_DIR/hbal-memory-over-commitment-2.data +>>>/Solution length=1/ +>>>= 0 -- 2.6.0.rc2.230.g3dd15c0
