Check that creation of instances doesn't trigger any error.

Signed-off-by: Bernardo Dal Seno <[email protected]>
---
 qa/ganeti-qa.py   | 26 +++++++++++++++++++++++++-
 qa/qa-sample.json |  1 +
 qa/qa_cluster.py  | 15 +++++++++++++++
 3 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py
index 26c2407..93ab049 100755
--- a/qa/ganeti-qa.py
+++ b/qa/ganeti-qa.py
@@ -1,7 +1,7 @@
 #!/usr/bin/python -u
 #
 
-# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
+# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -457,6 +457,28 @@ def RunHardwareFailureTests(instance, pnode, snode):
             pnode, snode)
 
 
+def RunExclusiveStorageTests():
+  """Test exclusive storage."""
+  if not qa_config.TestEnabled("cluster-exclusive-storage"):
+    return
+
+  node = qa_config.AcquireNode()
+  try:
+    qa_cluster.TestSetExclStorCluster(True)
+    if qa_config.TestEnabled("instance-add-plain-disk"):
+      # Make sure that the cluster doesn't have any pre-existing problem
+      qa_cluster.AssertClusterVerify()
+      instance1 = qa_instance.TestInstanceAddWithPlainDisk(node)
+      instance2 = qa_instance.TestInstanceAddWithPlainDisk(node)
+      # cluster-verify checks that disks are allocated correctly
+      qa_cluster.AssertClusterVerify()
+      qa_instance.TestInstanceRemove(instance1)
+      qa_instance.TestInstanceRemove(instance2)
+    qa_cluster.TestSetExclStorCluster(False)
+  finally:
+    qa_config.ReleaseNode(node)
+
+
 def RunQa():
   """Main QA body.
 
@@ -587,6 +609,8 @@ def RunQa():
   finally:
     qa_config.ReleaseNode(pnode)
 
+  RunExclusiveStorageTests()
+
   RunTestIf("create-cluster", qa_node.TestNodeRemoveAll)
 
   RunTestIf("cluster-destroy", qa_cluster.TestClusterDestroy)
diff --git a/qa/qa-sample.json b/qa/qa-sample.json
index 9b96484..4c47a62 100644
--- a/qa/qa-sample.json
+++ b/qa/qa-sample.json
@@ -111,6 +111,7 @@
     "cluster-epo": true,
     "cluster-redist-conf": true,
     "cluster-repair-disk-sizes": true,
+    "cluster-exclusive-storage": true,
 
     "haskell-confd": true,
     "htools": true,
diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py
index f0e9890..30a2fd4 100644
--- a/qa/qa_cluster.py
+++ b/qa/qa_cluster.py
@@ -630,3 +630,18 @@ def TestClusterDestroy():
 def TestClusterRepairDiskSizes():
   """gnt-cluster repair-disk-sizes"""
   AssertCommand(["gnt-cluster", "repair-disk-sizes"])
+
+
+def TestSetExclStorCluster(newvalue):
+  """Set the exclusive_storage node parameter at the cluster level.
+
+  @type newvalue: bool
+  @param newvalue: New value of exclusive_storage
+
+  """
+  AssertCommand(["gnt-cluster", "modify", "--node-parameters",
+                 "exclusive_storage=%s" % newvalue])
+  effvalue = _GetBoolClusterField("exclusive_storage")
+  if effvalue != newvalue:
+    raise qa_error.Error("exclusive_storage has the wrong value: %s instead"
+                         " of %s" % (effvalue, newvalue))
-- 
1.8.1

-- 
You received this message because you are subscribed to the Google Groups 
"ganeti-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to