In this example, all static values are perfectly balanced. Dynamic CPU load is higher on node 0 and dynamic memory load is higher on node 1. So, depending on the memory weight, instances are moved in either direction.
Signed-off-by: Klaus Aehlig <[email protected]> --- Makefile.am | 1 + test/data/htools/dyn3.json | 64 ++++++++++++++++++++++++++++++++ test/hs/shelltests/htools-balancing.test | 9 +++++ 3 files changed, 74 insertions(+) create mode 100644 test/data/htools/dyn3.json diff --git a/Makefile.am b/Makefile.am index 7e0e62e..b7fcfe8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1726,6 +1726,7 @@ TEST_FILES = \ test/data/htools/common-suffix.data \ test/data/htools/dyn1.json \ test/data/htools/dyn2.json \ + test/data/htools/dyn3.json \ test/data/htools/empty-cluster.data \ test/data/htools/hail-alloc-dedicated-1.json \ test/data/htools/hail-alloc-drbd.json \ diff --git a/test/data/htools/dyn3.json b/test/data/htools/dyn3.json new file mode 100644 index 0000000..e40c276 --- /dev/null +++ b/test/data/htools/dyn3.json @@ -0,0 +1,64 @@ +[ + { + "node": "node-01-000", + "reports": [ + { + "category": null, + "data": { + "cpu_number": 32, + "cpu_total": 2.0, + "cpus": [] + }, + "format_version": 1, + "kind": 0, + "name": "cpu-avg-load", + "timestamp": 1444910125282702000, + "version": "B" + }, + { + "category": null, + "data": { + "inst-00": 256, + "inst-01": 256, + "inst-02": 256, + "inst-03": 256 + }, + "format_version": 1, + "kind": 0, + "name": "kvm-inst-rss", + "timestamp": 1444910125282702000, + "version": "B" + } + ] + }, + { + "node": "node-01-001", + "reports": [ + { + "category": null, + "data": { + "cpu_number": 32, + "cpu_total": 0.1, + "cpus": [] + }, + "format_version": 1, + "kind": 0, + "name": "cpu-avg-load", + "timestamp": 1444910125282702000, + "version": "B" + }, + { + "category": null, + "data": { + "inst-10": 65536, + "inst-11": 65536 + }, + "format_version": 1, + "kind": 0, + "name": "kvm-inst-rss", + "timestamp": 1444910125282702000, + "version": "B" + } + ] + } +] diff --git a/test/hs/shelltests/htools-balancing.test b/test/hs/shelltests/htools-balancing.test index 8f9dafa..f6da27b 100644 --- a/test/hs/shelltests/htools-balancing.test +++ b/test/hs/shelltests/htools-balancing.test @@ -182,6 +182,15 @@ diff -u $T/simu-rebal-merged.tiered $T/simu-rebal.tiered.original >>>/gnt-instance migrate -f -n node-01-000 inst-1./ >>>=0 +# Depending on weight, instances can move in either direction +./test/hs/hbal -t$TESTDATA_DIR/hbal-dyn2.data --idle-default --mond --mond-data=$TESTDATA_DIR/dyn3.json --mond-kvm-rss -C --mem-weight=0.5 +>>>/ 1\. inst-0./ +>>>=0 + +./test/hs/hbal -t$TESTDATA_DIR/hbal-dyn2.data --idle-default --mond --mond-data=$TESTDATA_DIR/dyn3.json --mond-kvm-rss -C --mem-weight=3.0 +>>>/ 1\. inst-1./ +>>>=0 + # Test CPU speed is taken into account ./test/hs/hbal -t$TESTDATA_DIR/hbal-cpu-speed.data --ignore-dynu >>>/inst[12] node-slow:node-fast => node-fast:node-slow/ -- 2.6.0.rc2.230.g3dd15c0
