[Pkg-ganeti-devel] [ganeti] 39/165: Add a test for allocation on dedicated clusters

Apollon Oikonomopoulos apoikos at moszumanska.debian.org
Tue Aug 11 13:53:11 UTC 2015


This is an automated email from the git hooks/post-receive script.

apoikos pushed a commit to branch master
in repository ganeti.

commit b30dde8890b8e25167482ee15f119dcbf883683b
Author: Klaus Aehlig <aehlig at google.com>
Date:   Thu Jan 22 11:56:28 2015 +0100

    Add a test for allocation on dedicated clusters
    
    In this example, the policy allows instances sizes that are
    full, half, and quarter nodes. There are nodes which are half
    filled, quarter filled, and empty. We verify that the correct
    node is chosen for a dedicated scenario.
    
    Signed-off-by: Klaus Aehlig <aehlig at google.com>
    Reviewed-by: Petr Pudlak <pudlak at google.com>
---
 Makefile.am                                  |   1 +
 test/data/htools/hail-alloc-dedicated-1.json | 260 +++++++++++++++++++++++++++
 test/hs/shelltests/htools-hail.test          |   5 +
 3 files changed, 266 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 4a929d8..d888052 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1650,6 +1650,7 @@ TEST_FILES = \
 	test/data/htools/clean-nonzero-score.data \
 	test/data/htools/common-suffix.data \
 	test/data/htools/empty-cluster.data \
+	test/data/htools/hail-alloc-dedicated-1.json \
 	test/data/htools/hail-alloc-drbd.json \
 	test/data/htools/hail-alloc-invalid-network.json \
 	test/data/htools/hail-alloc-invalid-twodisks.json \
diff --git a/test/data/htools/hail-alloc-dedicated-1.json b/test/data/htools/hail-alloc-dedicated-1.json
new file mode 100644
index 0000000..a4885be
--- /dev/null
+++ b/test/data/htools/hail-alloc-dedicated-1.json
@@ -0,0 +1,260 @@
+{
+  "cluster_tags": [],
+  "instances": {
+    "instance2-quarter": {
+      "disk_space_total": 10240,
+      "disk_template": "plain",
+      "disks": [
+        {
+          "mode": "rw",
+          "size": 10240,
+          "spindles": 1
+        }
+      ],
+      "memory": 1024,
+      "nics": [],
+      "nodes": [
+        "node2-quarter"
+      ],
+      "spindle_use": 1,
+      "tags": [],
+      "vcpus": 1
+    },
+    "instance3-half": {
+      "disk_space_total": 20480,
+      "disk_template": "plain",
+      "disks": [
+        {
+          "mode": "rw",
+          "size": 20480,
+          "spindles": 2
+        }
+      ],
+      "memory": 2048,
+      "nics": [],
+      "nodes": [
+        "node3-half"
+      ],
+      "spindle_use": 2,
+      "tags": [],
+      "vcpus": 2
+    },
+    "instance4-full": {
+      "disk_space_total": 40960,
+      "disk_template": "plain",
+      "disks": [
+        {
+          "mode": "rw",
+          "size": 40960,
+          "spindles": 4
+        }
+      ],
+      "memory": 4096,
+      "nics": [],
+      "nodes": [
+        "node4-full"
+      ],
+      "spindle_use": 4,
+      "tags": [],
+      "vcpus": 4
+    }
+  },
+  "nodegroups": {
+    "uuid-group-1": {
+      "alloc_policy": "preferred",
+      "ipolicy": {
+        "disk-templates": [
+          "plain"
+        ],
+        "minmax": [
+          {
+            "max": {
+              "cpu-count": 1,
+              "disk-count": 1,
+              "disk-size": 10240,
+              "memory-size": 1024,
+              "nic-count": 1,
+              "spindle-use": 1
+            },
+            "min": {
+              "cpu-count": 1,
+              "disk-count": 1,
+              "disk-size": 10220,
+              "memory-size": 1022,
+              "nic-count": 1,
+              "spindle-use": 1
+            }
+          },
+          {
+            "max": {
+              "cpu-count": 2,
+              "disk-count": 2,
+              "disk-size": 20480,
+              "memory-size": 2048,
+              "nic-count": 1,
+              "spindle-use": 2
+            },
+            "min": {
+              "cpu-count": 2,
+              "disk-count": 2,
+              "disk-size": 20460,
+              "memory-size": 2046,
+              "nic-count": 1,
+              "spindle-use": 2
+            }
+          },
+          {
+            "max": {
+              "cpu-count": 4,
+              "disk-count": 4,
+              "disk-size": 40960,
+              "memory-size": 4096,
+              "nic-count": 1,
+              "spindle-use": 4
+            },
+            "min": {
+              "cpu-count": 4,
+              "disk-count": 4,
+              "disk-size": 40940,
+              "memory-size": 4094,
+              "nic-count": 1,
+              "spindle-use": 4
+            }
+          }
+        ],
+        "spindle-ratio": 1.0,
+        "std": {
+          "cpu-count": 1,
+          "disk-count": 1,
+          "disk-size": 10240,
+          "memory-size": 1024,
+          "nic-count": 1,
+          "spindle-use": 1
+        },
+        "vcpu-ratio": 1.0
+      },
+      "name": "default",
+      "networks": [],
+      "tags": []
+    }
+  },
+  "nodes": {
+    "node1-empty": {
+      "drained": false,
+      "free_disk": 40960,
+      "free_memory": 4096,
+      "free_spindles": 4,
+      "group": "uuid-group-1",
+      "master_candidate": true,
+      "master_capable": true,
+      "ndparams": {
+        "exclusive_storage": true,
+        "spindle_count": 1
+      },
+      "offline": false,
+      "primary_ip": "192.0.2.1",
+      "reserved_cpus": 0,
+      "reserved_memory": 0,
+      "secondary_ip": "198.51.100.1",
+      "tags": [],
+      "total_cpus": 5,
+      "total_disk": 40960,
+      "total_memory": 4096,
+      "total_spindles": 5,
+      "vm_capable": true
+    },
+    "node2-quarter": {
+      "drained": false,
+      "free_disk": 30720,
+      "free_memory": 3072,
+      "free_spindles": 3,
+      "group": "uuid-group-1",
+      "master_candidate": true,
+      "master_capable": true,
+      "ndparams": {
+        "exclusive_storage": true,
+        "spindle_count": 1
+      },
+      "offline": false,
+      "primary_ip": "192.0.2.2",
+      "reserved_cpus": 0,
+      "reserved_memory": 0,
+      "secondary_ip": "198.51.100.2",
+      "tags": [],
+      "total_cpus": 5,
+      "total_disk": 40960,
+      "total_memory": 4096,
+      "total_spindles": 5,
+      "vm_capable": true
+    },
+    "node3-half": {
+      "drained": false,
+      "free_disk": 20480,
+      "free_memory": 2048,
+      "free_spindles": 2,
+      "group": "uuid-group-1",
+      "master_candidate": true,
+      "master_capable": true,
+      "ndparams": {
+        "exclusive_storage": true,
+        "spindle_count": 1
+      },
+      "offline": false,
+      "primary_ip": "192.0.2.3",
+      "reserved_cpus": 0,
+      "reserved_memory": 0,
+      "secondary_ip": "198.51.100.3",
+      "tags": [],
+      "total_cpus": 5,
+      "total_disk": 40960,
+      "total_memory": 4096,
+      "total_spindles": 5,
+      "vm_capable": true
+    },
+    "node4-full": {
+      "drained": false,
+      "free_disk": 0,
+      "free_memory": 0,
+      "free_spindles": 0,
+      "group": "uuid-group-1",
+      "master_candidate": true,
+      "master_capable": true,
+      "ndparams": {
+        "exclusive_storage": true,
+        "spindle_count": 1
+      },
+      "offline": false,
+      "primary_ip": "192.0.2.4",
+      "reserved_cpus": 0,
+      "reserved_memory": 0,
+      "secondary_ip": "198.51.100.4",
+      "tags": [],
+      "total_cpus": 5,
+      "total_disk": 40960,
+      "total_memory": 4096,
+      "total_spindles": 5,
+      "vm_capable": true
+    }
+  },
+  "request": {
+    "disk_space_total": 10230,
+    "disk_template": "plain",
+    "disks": [
+      {
+        "mode": "rw",
+        "size": 10230,
+        "spindles": 1
+      }
+    ],
+    "hypervisor": "xen-pvm",
+    "memory": 1023,
+    "name": "instance-new-quarter",
+    "nics": [],
+    "os": "instance-debootstrap",
+    "required_nodes": 1,
+    "spindle_use": 1,
+    "tags": [],
+    "type": "allocate",
+    "vcpus": 1
+  }
+}
diff --git a/test/hs/shelltests/htools-hail.test b/test/hs/shelltests/htools-hail.test
index 45e813b..198458d 100644
--- a/test/hs/shelltests/htools-hail.test
+++ b/test/hs/shelltests/htools-hail.test
@@ -171,3 +171,8 @@ cat $TESTDATA_DIR/hail-alloc-invalid-network.json | grep -v -e '"network":"uuid-
 ./test/hs/hail --ignore-soft-errors $TESTDATA_DIR/hail-alloc-plain-tags.json
 >>> /"success":true/
 >>>= 0
+
+# Verify dedicated allocation
+./test/hs/hail $TESTDATA_DIR/hail-alloc-dedicated-1.json
+>>> /"success":true.*"result":\["node2-quarter"\]/
+>>>= 0

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ganeti/ganeti.git



More information about the Pkg-ganeti-devel mailing list