From 638a7266d210e35e41b45e99e1dad41d9c4cc2aa Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 7 Oct 2010 11:56:12 +0200 Subject: [PATCH] Try again to fix the inter-cluster move QA test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This time, we re-establish the old pri/sec nodes corretly. Unfortunately this will require now a 3-node cluster at least for drbd instances, hence it's somewhat suboptimal, but⦠The other option would be to move it simply from p:s to s:p and then back to p:s, without involving a third node (for DRBD case), but I think that moving it to a completely separate node is slightly better for testing. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- qa/ganeti-qa.py | 20 ++++++++++++++------ qa/qa_rapi.py | 17 ++++++++++++----- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index b06155f35..34e4787a5 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -203,9 +203,13 @@ def RunCommonInstanceTests(instance): RunTest(qa_rapi.TestInstance, instance) -def RunExportImportTests(instance, pnode): +def RunExportImportTests(instance, pnode, snode): """Tries to export and import the instance. + @param pnode: current primary node of the instance + @param snode: current secondary node of the instance, if any, + otherwise None + """ if qa_config.TestEnabled('instance-export'): RunTest(qa_instance.TestInstanceExportNoTarget, instance) @@ -231,12 +235,16 @@ def RunExportImportTests(instance, pnode): qa_config.TestEnabled("inter-cluster-instance-move")): newinst = qa_config.AcquireInstance() try: - pnode2 = qa_config.AcquireNode(exclude=pnode) + if snode is None: + excl = [pnode] + else: + excl = [pnode, snode] + tnode = qa_config.AcquireNode(exclude=excl) try: RunTest(qa_rapi.TestInterClusterInstanceMove, instance, newinst, - pnode, pnode2) + pnode, snode, tnode) finally: - qa_config.ReleaseNode(pnode2) + qa_config.ReleaseNode(tnode) finally: qa_config.ReleaseInstance(newinst) @@ -360,7 +368,7 @@ def main(): if qa_config.TestEnabled('instance-add-plain-disk'): instance = RunTest(qa_instance.TestInstanceAddWithPlainDisk, pnode) RunCommonInstanceTests(instance) - RunExportImportTests(instance, pnode) + RunExportImportTests(instance, pnode, None) RunDaemonTests(instance, pnode) RunTest(qa_instance.TestInstanceRemove, instance) del instance @@ -380,7 +388,7 @@ def main(): RunTest(qa_instance.TestInstanceShutdown, instance) RunTest(qa_instance.TestInstanceConvertDisk, instance, snode) RunTest(qa_instance.TestInstanceStartup, instance) - RunExportImportTests(instance, pnode) + RunExportImportTests(instance, pnode, snode) RunHardwareFailureTests(instance, pnode, snode) RunTest(qa_instance.TestInstanceRemove, instance) del instance diff --git a/qa/qa_rapi.py b/qa/qa_rapi.py index add87e405..df01788d1 100644 --- a/qa/qa_rapi.py +++ b/qa/qa_rapi.py @@ -396,7 +396,8 @@ def TestRapiInstanceModify(instance): }) -def TestInterClusterInstanceMove(src_instance, dest_instance, pnode, snode): +def TestInterClusterInstanceMove(src_instance, dest_instance, + pnode, snode, tnode): """Test tools/move-instance""" master = qa_config.GetMasterNode() @@ -406,12 +407,18 @@ def TestInterClusterInstanceMove(src_instance, dest_instance, pnode, snode): # TODO: Run some instance tests before moving back - # note: pnode is the *current* primary node, so we move it first to - # snode, then back + if snode is None: + # instance is not redundant, but we still need to pass a node + # (which will be ignored) + fsec = tnode + else: + fsec = snode + # note: pnode:snode are the *current* nodes, so we move it first to + # tnode:pnode, then back to pnode:snode for si, di, pn, sn in [(src_instance["name"], dest_instance["name"], - snode["primary"], pnode["primary"]), + tnode["primary"], pnode["primary"]), (dest_instance["name"], src_instance["name"], - pnode["primary"], snode["primary"])]: + pnode["primary"], fsec["primary"])]: cmd = [ "../tools/move-instance", "--verbose", -- GitLab