In this example, there is one big instance (.75 of a node) and
otherwise small instances (.25 of a node). One node is only
used to 25% whereas the rest to 75%. Nevertheless, the mostly
empty node cannot be used for allocating a new instance, as
that would prevent the big instance from being evacuated should
its node fail. Note that the mostly empty node would be the most
balanced allocation.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 test/data/htools/hail-alloc-ext.json        | 25 +++++++++++++++++++++++++
 test/data/htools/shared-n1-restriction.data | 18 ++++++++++++++++++
 test/hs/shelltests/htools-hail.test         |  9 +++++++++
 3 files changed, 52 insertions(+)
 create mode 100644 test/data/htools/hail-alloc-ext.json
 create mode 100644 test/data/htools/shared-n1-restriction.data

diff --git a/test/data/htools/hail-alloc-ext.json 
b/test/data/htools/hail-alloc-ext.json
new file mode 100644
index 0000000..c95a2dc
--- /dev/null
+++ b/test/data/htools/hail-alloc-ext.json
@@ -0,0 +1,25 @@
+{
+  "cluster_tags": [], 
+  "instances": {}, 
+  "nodegroups": {}, 
+  "nodes": {}, 
+  "request": {
+    "disk_space_total": 0, 
+    "disk_template": "ext", 
+    "disks": [
+      {
+        "size": 1024
+      }
+    ], 
+    "hypervisor": "xen-pvm", 
+    "memory": 1000, 
+    "name": "instance-new", 
+    "nics": [], 
+    "os": "instance-debootstrap", 
+    "required_nodes": 1, 
+    "spindle_use": 1, 
+    "tags": [], 
+    "type": "allocate", 
+    "vcpus": 1
+  }
+}
diff --git a/test/data/htools/shared-n1-restriction.data 
b/test/data/htools/shared-n1-restriction.data
new file mode 100644
index 0000000..03715bf
--- /dev/null
+++ b/test/data/htools/shared-n1-restriction.data
@@ -0,0 +1,18 @@
+group-01|fake-uuid-01|preferred||
+
+nodeA|4096|0|3096|200|200|4|M|fake-uuid-01|4
+nodeB|4096|0|1096|200|200|4|N|fake-uuid-01|4
+nodeC|4096|0|1096|200|200|4|N|fake-uuid-01|4
+nodeD|4096|0|1096|200|200|4|N|fake-uuid-01|4
+
+instA1|1000|0|1|running|Y|nodeA||ext||1
+instB1|1000|0|1|running|Y|nodeB||ext||1
+instB2|1000|0|1|running|Y|nodeB||ext||1
+instB3|1000|0|1|running|Y|nodeB||ext||1
+instC1|3000|0|3|running|Y|nodeC||ext||3
+instD1|1000|0|1|running|Y|nodeD||ext||1
+instD2|1000|0|1|running|Y|nodeD||ext||1
+instD3|1000|0|1|running|Y|nodeD||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
+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
diff --git a/test/hs/shelltests/htools-hail.test 
b/test/hs/shelltests/htools-hail.test
index 3ad375a..0dbff16 100644
--- a/test/hs/shelltests/htools-hail.test
+++ b/test/hs/shelltests/htools-hail.test
@@ -181,3 +181,12 @@ cat $TESTDATA_DIR/hail-alloc-invalid-network.json | grep 
-v -e '"network":"uuid-
 ./test/hs/hail $TESTDATA_DIR/hail-multialloc-dedicated.json
 >>> /"success":true.*"result":\[\[\[.*\["node2-quarter"\]/
 >>>= 0
+
+# Verify that global N+1 redundancy is honored, unless requested not to
+./test/hs/hail -t $TESTDATA_DIR/shared-n1-restriction.data 
$TESTDATA_DIR/hail-alloc-ext.json
+>>> /"success":true.*"result":\["node[BCD]"\]/
+>>>= 0
+
+./test/hs/hail -t $TESTDATA_DIR/shared-n1-restriction.data 
$TESTDATA_DIR/hail-alloc-ext.json --no-capacity-checks
+>>> /"success":true.*"result":\["nodeA"\]/
+>>>= 0
-- 
2.2.0.rc0.207.ga3a616c

Reply via email to