The “RunTestIf” uses an AND association between the passed test names,
so the instance would be be shut down if both rename and reinstall were
enabled. Since this is not necessarily the case, OR must be used.
---
 qa/ganeti-qa.py |   53 +++++++++++++++++++++++++++--------------------------
 1 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py
index 91cd506..d35ebd6 100755
--- a/qa/ganeti-qa.py
+++ b/qa/ganeti-qa.py
@@ -252,36 +252,37 @@ def RunCommonInstanceTests(instance):
   RunTestIf(["instance-console", "rapi"],
             qa_rapi.TestRapiInstanceConsole, instance)
 
-  DOWN_TESTS = ["instance-reinstall", "instance-rename"]
-  # shutdown instance for any 'down' tests
-  RunTestIf(DOWN_TESTS, qa_instance.TestInstanceShutdown, instance)
-
-  # now run the 'down' state tests
-  RunTestIf("instance-reinstall", qa_instance.TestInstanceReinstall, instance)
-  RunTestIf(["instance-reinstall", "rapi"],
-            qa_rapi.TestRapiInstanceReinstall, instance)
-  # RAPI reinstall will leave the instance up by default, so we have
-  # to stop it again
-  RunTestIf(["instance-reinstall", "rapi"],
-            qa_rapi.TestRapiInstanceShutdown, instance)
-
-  if qa_config.TestEnabled("instance-rename"):
-    rename_source = instance["name"]
-    rename_target = qa_config.get("rename", None)
-    # perform instance rename to the same name
-    RunTest(qa_instance.TestInstanceRenameAndBack,
-            rename_source, rename_source)
-    RunTestIf("rapi", qa_rapi.TestRapiInstanceRenameAndBack,
-              rename_source, rename_source)
-    if rename_target is not None:
-      # perform instance rename to a different name, if we have one configured
+  if (qa_config.TestEnabled("instance-reinstall") or
+      qa_config.TestEnabled("instance-rename")):
+    # shutdown instance for any 'down' tests
+    RunTest(qa_instance.TestInstanceShutdown, instance)
+
+    # now run the 'down' state tests
+    RunTestIf("instance-reinstall", qa_instance.TestInstanceReinstall, 
instance)
+    RunTestIf(["instance-reinstall", "rapi"],
+              qa_rapi.TestRapiInstanceReinstall, instance)
+    # RAPI reinstall will leave the instance up by default, so we have
+    # to stop it again
+    RunTestIf(["instance-reinstall", "rapi"],
+              qa_rapi.TestRapiInstanceShutdown, instance)
+
+    if qa_config.TestEnabled("instance-rename"):
+      rename_source = instance["name"]
+      rename_target = qa_config.get("rename", None)
+      # perform instance rename to the same name
       RunTest(qa_instance.TestInstanceRenameAndBack,
-              rename_source, rename_target)
+              rename_source, rename_source)
       RunTestIf("rapi", qa_rapi.TestRapiInstanceRenameAndBack,
+                rename_source, rename_source)
+      if rename_target is not None:
+        # perform instance rename to a different name, if we have one 
configured
+        RunTest(qa_instance.TestInstanceRenameAndBack,
                 rename_source, rename_target)
+        RunTestIf("rapi", qa_rapi.TestRapiInstanceRenameAndBack,
+                  rename_source, rename_target)
 
-  # and now start the instance again
-  RunTestIf(DOWN_TESTS, qa_instance.TestInstanceStartup, instance)
+    # Start the instance again
+    RunTest(qa_instance.TestInstanceStartup, instance)
 
   RunTestIf("instance-reboot", qa_instance.TestInstanceReboot, instance)
 
-- 
1.7.6

Reply via email to