When instance tests with exclusive_storage are enabled, the number of PVs on nodes are checked to see if it's suitable for those tests.
This fixes issue 437. Signed-off-by: Bernardo Dal Seno <[email protected]> --- qa/ganeti-qa.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index eeee935..12d7080 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -635,6 +635,30 @@ def TestIPolicyPlainInstance(): node.Release() +def IsExclusiveStorageInstanceTestEnabled(): + test_name = "exclusive-storage-instance-tests" + if qa_config.TestEnabled(test_name): + vgname = qa_config.get("vg-name", constants.DEFAULT_VG) + vgscmd = utils.ShellQuoteArgs([ + "vgs", "--noheadings", "-o", "pv_count", vgname, + ]) + nodes = qa_config.GetConfig()["nodes"] + for node in nodes: + try: + pvnum = int(qa_utils.GetCommandOutput(node.primary, vgscmd)) + except Exception, e: + msg = ("Cannot get the number of PVs on %s, needed by '%s': %s" % + (node.primary, test_name, e)) + raise qa_error.Error(msg) + if pvnum < 2: + raise qa_error.Error("Node %s has not enough PVs (%s) to run '%s'" % + (node.primary, pvnum, test_name)) + res = True + else: + res = False + return res + + def RunInstanceTests(): """Create and exercise instances.""" instance_tests = [ @@ -748,7 +772,7 @@ def RunQa(): config_list = [ ("default-instance-tests", lambda: None, lambda _: None), - ("exclusive-storage-instance-tests", + (IsExclusiveStorageInstanceTestEnabled, lambda: qa_cluster.TestSetExclStorCluster(True), qa_cluster.TestSetExclStorCluster), ] -- 1.8.2.1
