Test parallel node-count instance creation
authorThomas Thrainer <thomasth@google.com>
Mon, 5 May 2014 10:54:13 +0000 (12:54 +0200)
committerThomas Thrainer <thomasth@google.com>
Fri, 9 May 2014 07:24:30 +0000 (09:24 +0200)
Test the parallel creation (and removal) of as many instances as there
are nodes in the cluster.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>

qa/ganeti-qa.py
qa/qa_performance.py

index bf7930a..b44c3d7 100755 (executable)
@@ -788,6 +788,7 @@ def RunMonitoringTests():
 def RunPerformanceTests():
   if qa_config.TestEnabled("jobqueue-performance"):
     RunTest(qa_performance.TestParallelInstanceCreationPerformance)
+    RunTest(qa_performance.TestParallelNodeCountInstanceCreationPerformance)
 
 
 def RunQa():
index 462a8c2..37433fb 100644 (file)
@@ -23,8 +23,9 @@
 
 """
 
-import time
 import functools
+import itertools
+import time
 
 from ganeti import constants
 
@@ -176,6 +177,20 @@ def _AcquireAllInstances():
     pass
 
 
+def _AcquireAllNodes():
+  """Generator for acquiring all nodes in the QA config.
+
+  """
+  exclude = []
+  try:
+    while True:
+      node = qa_config.AcquireNode(exclude=exclude)
+      exclude.append(node)
+      yield node
+  except qa_error.OutOfNodesError:
+    pass
+
+
 def _SubmitInstanceCreationJob(instance):
   """Submit an instance creation job.
 
@@ -233,3 +248,24 @@ def TestParallelInstanceCreationPerformance():
                       success_fn=functools.partial(_CreateSuccessFn, instance))
 
   job_driver.WaitForCompletion()
+
+
+def TestParallelNodeCountInstanceCreationPerformance():
+  """PERFORMANCE: Parallel instance creation (instance count = node count).
+
+  """
+  job_driver = _JobQueueDriver()
+
+  def _CreateSuccessFn(instance, job_driver, _):
+    job_id = _SubmitInstanceRemoveJob(instance)
+    job_driver.AddJob(job_id)
+
+  nodes = list(_AcquireAllNodes())
+  instances = itertools.islice(_AcquireAllInstances(), len(nodes))
+  for instance in instances:
+    job_id = _SubmitInstanceCreationJob(instance)
+    job_driver.AddJob(
+      job_id, success_fn=functools.partial(_CreateSuccessFn, instance))
+
+  job_driver.WaitForCompletion()
+  qa_config.ReleaseManyNodes(nodes)