Add another example similar ot that of commit f8d4db63d62e459,
however with more memory pressure and configured to allow generours
memory overcommitment. There, demonstrate that memory
utilisation can make the difference so that an instance is moved
as part of the balancing.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 Makefile.am                              |  2 +
 test/data/htools/dyn2.json               | 64 ++++++++++++++++++++++++++++++++
 test/data/htools/hbal-dyn2.data          | 15 ++++++++
 test/hs/shelltests/htools-balancing.test | 10 +++++
 4 files changed, 91 insertions(+)
 create mode 100644 test/data/htools/dyn2.json
 create mode 100644 test/data/htools/hbal-dyn2.data

diff --git a/Makefile.am b/Makefile.am
index d642c88..7e0e62e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1725,6 +1725,7 @@ TEST_FILES = \
        test/data/htools/clean-nonzero-score.data \
        test/data/htools/common-suffix.data \
        test/data/htools/dyn1.json \
+       test/data/htools/dyn2.json \
        test/data/htools/empty-cluster.data \
        test/data/htools/hail-alloc-dedicated-1.json \
        test/data/htools/hail-alloc-drbd.json \
@@ -1751,6 +1752,7 @@ TEST_FILES = \
        test/data/htools/hbal-desiredlocation-3.data \
        test/data/htools/hbal-desiredlocation-4.data \
        test/data/htools/hbal-dyn.data \
+       test/data/htools/hbal-dyn2.data \
        test/data/htools/hbal-evac.data \
        test/data/htools/hbal-excl-tags.data \
        test/data/htools/hbal-forth.data \
diff --git a/test/data/htools/dyn2.json b/test/data/htools/dyn2.json
new file mode 100644
index 0000000..3a8e2b4
--- /dev/null
+++ b/test/data/htools/dyn2.json
@@ -0,0 +1,64 @@
+[
+  {
+    "node": "node-01-000",
+    "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-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.3,
+          "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/data/htools/hbal-dyn2.data b/test/data/htools/hbal-dyn2.data
new file mode 100644
index 0000000..619a5d9
--- /dev/null
+++ b/test/data/htools/hbal-dyn2.data
@@ -0,0 +1,15 @@
+group-01|fake-uuid-01|preferred||
+
+node-01-000|552|0|40|3100|3100|32|M|fake-uuid-01|1
+node-01-001|552|0|40|3100|3100|32|N|fake-uuid-01|1
+
+inst-00|128|0|1|running|Y|node-01-000||ext||1
+inst-01|128|0|1|running|Y|node-01-000||ext||1
+inst-02|128|0|1|running|Y|node-01-000||ext||1
+inst-03|128|0|1|running|Y|node-01-000||ext||1
+inst-10|256|0|2|running|Y|node-01-001||ext||1
+inst-11|256|0|2|running|Y|node-01-001||ext||1
+
+
+|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|6.0
+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|6.0
diff --git a/test/hs/shelltests/htools-balancing.test 
b/test/hs/shelltests/htools-balancing.test
index ffc167b..8f9dafa 100644
--- a/test/hs/shelltests/htools-balancing.test
+++ b/test/hs/shelltests/htools-balancing.test
@@ -172,6 +172,16 @@ diff -u $T/simu-rebal-merged.tiered 
$T/simu-rebal.tiered.original
 >>>/Cluster is already well balanced/
 >>>=0
 
+# On an overcommitted cluster with small amount of memory, taking memory
+# usage into account can make a difference.
+./test/hs/hbal -t$TESTDATA_DIR/hbal-dyn2.data --idle-default --mond 
--mond-data=$TESTDATA_DIR/dyn2.json
+>>>/Solution length=0/
+>>>=0
+
+./test/hs/hbal -t$TESTDATA_DIR/hbal-dyn2.data --idle-default --mond 
--mond-data=$TESTDATA_DIR/dyn2.json --mond-kvm-rss -C
+>>>/gnt-instance migrate -f -n node-01-000 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

Reply via email to