From a9e326d8ea9a0dbabbe9e469673d6758fb64abaf Mon Sep 17 00:00:00 2001 From: Thomas Thrainer Date: Mon, 5 May 2014 12:54:13 +0200 Subject: [PATCH] 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: Thomas Thrainer Reviewed-by: Hrvoje Ribicic --- qa/ganeti-qa.py | 1 + qa/qa_performance.py | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index bf7930a..b44c3d7 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -788,6 +788,7 @@ def RunMonitoringTests(): def RunPerformanceTests(): if qa_config.TestEnabled("jobqueue-performance"): RunTest(qa_performance.TestParallelInstanceCreationPerformance) + RunTest(qa_performance.TestParallelNodeCountInstanceCreationPerformance) def RunQa(): diff --git a/qa/qa_performance.py b/qa/qa_performance.py index 462a8c2..37433fb 100644 --- a/qa/qa_performance.py +++ b/qa/qa_performance.py @@ -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) -- 1.7.10.4