Merge branch 'devel-2.5'
[ganeti-local] / qa / qa_cluster.py
index a9381a9..233cacb 100644 (file)
@@ -58,6 +58,20 @@ def _CheckFileOnAllNodes(filename, content):
     AssertEqual(qa_utils.GetCommandOutput(node["primary"], cmd), content)
 
 
+# data for testing failures due to bad keys/values for disk parameters
+_FAIL_PARAMS = ["nonexistent:resync-rate=1",
+                "drbd:nonexistent=1",
+                "drbd:resync-rate=invalid",
+                ]
+
+
+def TestClusterInitDisk():
+  """gnt-cluster init -D"""
+  name = qa_config.get("name")
+  for param in _FAIL_PARAMS:
+    AssertCommand(["gnt-cluster", "init", "-D", param, name], fail=True)
+
+
 def TestClusterInit(rapi_user, rapi_secret):
   """gnt-cluster init"""
   master = qa_config.GetMasterNode()
@@ -85,6 +99,14 @@ def TestClusterInit(rapi_user, rapi_secret):
   cmd.append("--primary-ip-version=%d" %
              qa_config.get("primary_ip_version", 4))
 
+  for spec_type in ("mem-size", "disk-size", "disk-count", "cpu-count",
+                    "nic-count"):
+    for spec_val in ("min", "max", "std"):
+      spec = qa_config.get("ispec_%s_%s" %
+                           (spec_type.replace('-', '_'), spec_val), None)
+      if spec:
+        cmd.append("--specs-%s=%s=%d" % (spec_type, spec_val, spec))
+
   if master.get("secondary", None):
     cmd.append("--secondary-ip=%s" % master["secondary"])
 
@@ -98,10 +120,10 @@ def TestClusterInit(rapi_user, rapi_secret):
     cmd.append("--enabled-hypervisors=%s" % htype)
 
   cmd.append(qa_config.get("name"))
-
   AssertCommand(cmd)
 
   cmd = ["gnt-cluster", "modify"]
+
   # hypervisor parameter modifications
   hvp = qa_config.get("hypervisor-parameters", {})
   for k, v in hvp.items():
@@ -226,6 +248,14 @@ def TestJobqueue():
   AssertCommand(["gnt-debug", "test-jobqueue"])
 
 
+def TestDelay(node):
+  """gnt-debug delay"""
+  AssertCommand(["gnt-debug", "delay", "1"])
+  AssertCommand(["gnt-debug", "delay", "--no-master", "1"])
+  AssertCommand(["gnt-debug", "delay", "--no-master",
+                 "-n", node["primary"], "1"])
+
+
 def TestClusterReservedLvs():
   """gnt-cluster reserved lvs"""
   for fail, cmd in [
@@ -246,15 +276,27 @@ def TestClusterReservedLvs():
     AssertCommand(cmd, fail=fail)
 
 
+def TestClusterModifyDisk():
+  """gnt-cluster modify -D"""
+  for param in _FAIL_PARAMS:
+    AssertCommand(["gnt-cluster", "modify", "-D", param], fail=True)
+
+
 def TestClusterModifyBe():
   """gnt-cluster modify -B"""
   for fail, cmd in [
-    # mem
-    (False, ["gnt-cluster", "modify", "-B", "memory=256"]),
-    (False, ["sh", "-c", "gnt-cluster info|grep '^ *memory: 256$'"]),
-    (True, ["gnt-cluster", "modify", "-B", "memory=a"]),
-    (False, ["gnt-cluster", "modify", "-B", "memory=128"]),
-    (False, ["sh", "-c", "gnt-cluster info|grep '^ *memory: 128$'"]),
+    # max/min mem
+    (False, ["gnt-cluster", "modify", "-B", "maxmem=256"]),
+    (False, ["sh", "-c", "gnt-cluster info|grep '^ *maxmem: 256$'"]),
+    (False, ["gnt-cluster", "modify", "-B", "minmem=256"]),
+    (False, ["sh", "-c", "gnt-cluster info|grep '^ *minmem: 256$'"]),
+    (True, ["gnt-cluster", "modify", "-B", "maxmem=a"]),
+    (False, ["sh", "-c", "gnt-cluster info|grep '^ *maxmem: 256$'"]),
+    (True, ["gnt-cluster", "modify", "-B", "minmem=a"]),
+    (False, ["sh", "-c", "gnt-cluster info|grep '^ *minmem: 256$'"]),
+    (False, ["gnt-cluster", "modify", "-B", "maxmem=128,minmem=128"]),
+    (False, ["sh", "-c", "gnt-cluster info|grep '^ *maxmem: 128$'"]),
+    (False, ["sh", "-c", "gnt-cluster info|grep '^ *minmem: 128$'"]),
     # vcpus
     (False, ["gnt-cluster", "modify", "-B", "vcpus=4"]),
     (False, ["sh", "-c", "gnt-cluster info|grep '^ *vcpus: 4$'"]),
@@ -388,6 +430,8 @@ def TestClusterBurnin():
       # Run burnin
       cmd = [script,
              "--os=%s" % qa_config.get("os"),
+             "--minmem-size=%s" % qa_config.get(constants.BE_MINMEM),
+             "--maxmem-size=%s" % qa_config.get(constants.BE_MAXMEM),
              "--disk-size=%s" % ",".join(qa_config.get("disk")),
              "--disk-growth=%s" % ",".join(qa_config.get("disk-growth")),
              "--disk-template=%s" % disk_template]