Commit a9e326d8 authored by Thomas Thrainer's avatar Thomas Thrainer
Browse files

Test parallel node-count instance creation



Test the parallel creation (and removal) of as many instances as there
are nodes in the cluster.
Signed-off-by: default avatarThomas Thrainer <thomasth@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent 5bb25194
......@@ -788,6 +788,7 @@ def RunMonitoringTests():
def RunPerformanceTests():
if qa_config.TestEnabled("jobqueue-performance"):
RunTest(qa_performance.TestParallelInstanceCreationPerformance)
RunTest(qa_performance.TestParallelNodeCountInstanceCreationPerformance)
def RunQa():
......
......@@ -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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment