Пример #1
0
def RunHardwareFailureTests(instance, inodes):
    """Test cluster internal hardware failure recovery.

  """
    RunTestIf("instance-failover", qa_instance.TestInstanceFailover, instance)
    RunTestIf(["instance-failover", qa_rapi.Enabled],
              qa_rapi.TestRapiInstanceFailover, instance)

    RunTestIf("instance-migrate", qa_instance.TestInstanceMigrate, instance)
    RunTestIf(["instance-migrate", qa_rapi.Enabled],
              qa_rapi.TestRapiInstanceMigrate, instance)

    if qa_config.TestEnabled("instance-replace-disks"):
        # We just need alternative secondary nodes, hence "- 1"
        othernodes = qa_config.AcquireManyNodes(len(inodes) - 1,
                                                exclude=inodes)
        try:
            RunTestIf(qa_rapi.Enabled, qa_rapi.TestRapiInstanceReplaceDisks,
                      instance)
            RunTest(qa_instance.TestReplaceDisks, instance, inodes, othernodes)
        finally:
            qa_config.ReleaseManyNodes(othernodes)
        del othernodes

    if qa_config.TestEnabled("instance-recreate-disks"):
        try:
            acquirednodes = qa_config.AcquireManyNodes(len(inodes),
                                                       exclude=inodes)
            othernodes = acquirednodes
        except qa_error.OutOfNodesError:
            if len(inodes) > 1:
                # If the cluster is not big enough, let's reuse some of the nodes, but
                # with different roles. In this way, we can test a DRBD instance even on
                # a 3-node cluster.
                acquirednodes = [qa_config.AcquireNode(exclude=inodes)]
                othernodes = acquirednodes + inodes[:-1]
            else:
                raise
        try:
            RunTest(qa_instance.TestRecreateDisks, instance, inodes,
                    othernodes)
        finally:
            qa_config.ReleaseManyNodes(acquirednodes)

    if len(inodes) >= 2:
        RunTestIf("node-evacuate", qa_node.TestNodeEvacuate, inodes[0],
                  inodes[1])
        RunTestIf("node-failover", qa_node.TestNodeFailover, inodes[0],
                  inodes[1])
        RunTestIf("node-migrate", qa_node.TestNodeMigrate, inodes[0],
                  inodes[1])
Пример #2
0
def RunPerformanceTests():
    if not qa_config.TestEnabled("performance"):
        ReportTestSkip("performance related tests", "performance")
        return

    # For reproducable performance, run performance tests with the watcher
    # paused.
    qa_utils.AssertCommand(["gnt-cluster", "watcher", "pause", "4h"])

    if qa_config.TestEnabled("jobqueue-performance"):
        RunTest(qa_performance.TestParallelMaxInstanceCreationPerformance)
        RunTest(
            qa_performance.TestParallelNodeCountInstanceCreationPerformance)

        instances = qa_performance.CreateAllInstances()

        RunTest(qa_performance.TestParallelModify, instances)
        RunTest(qa_performance.TestParallelInstanceOSOperations, instances)
        RunTest(qa_performance.TestParallelInstanceQueries, instances)

        qa_performance.RemoveAllInstances(instances)

        RunTest(qa_performance.TestJobQueueSubmissionPerformance)

    if qa_config.TestEnabled("parallel-performance"):
        if qa_config.IsTemplateSupported(constants.DT_DRBD8):
            RunTest(qa_performance.TestParallelDRBDInstanceCreationPerformance)
        if qa_config.IsTemplateSupported(constants.DT_PLAIN):
            RunTest(
                qa_performance.TestParallelPlainInstanceCreationPerformance)

    # Preparations need to be made only if some of these tests are enabled
    if qa_config.IsTemplateSupported(constants.DT_DRBD8) and \
       qa_config.TestEnabled(qa_config.Either(list(PARALLEL_TEST_DICT))):
        inodes = qa_config.AcquireManyNodes(2)
        try:
            instance = qa_instance.TestInstanceAddWithDrbdDisk(inodes)
            try:
                for (test_name, test_fn) in PARALLEL_TEST_DICT.items():
                    RunTestIf(test_name, test_fn, instance)
            finally:
                instance.Release()
            qa_instance.TestInstanceRemove(instance)
        finally:
            qa_config.ReleaseManyNodes(inodes)

    qa_utils.AssertCommand(["gnt-cluster", "watcher", "continue"])
Пример #3
0
def RunInstanceTests():
    """Create and exercise instances."""

    requested_conversions = qa_config.get("convert-disk-templates", [])
    supported_conversions = \
        set(requested_conversions).difference(constants.DTS_NOT_CONVERTIBLE_TO)
    for (test_name, templ, create_fun, num_nodes) in \
        qa_instance.available_instance_tests:
        if (qa_config.TestEnabled(test_name)
                and qa_config.IsTemplateSupported(templ)):
            inodes = qa_config.AcquireManyNodes(num_nodes)
            try:
                # run instance tests with default hvparams
                print(
                    _FormatHeader(
                        "Starting instance tests with default HVparams"))
                RunInstanceTestsFull(create_fun, inodes, supported_conversions,
                                     templ)

                # iterate through alternating hvparam values (if enabled)
                if qa_config.TestEnabled("instance-iterate-hvparams"):
                    hvparam_iterations = qa_cluster.PrepareHvParameterSets()
                    for param, test_data in hvparam_iterations.items():
                        for value in test_data["values"]:
                            print(
                                _FormatHeader(
                                    "Starting reduced number of instance tests "
                                    "with hypervisor parameter %s=%s" %
                                    (param, value)))
                            qa_cluster.AssertClusterHvParameterModify(
                                param, value)
                            RunInstanceTestsReduced(create_fun, inodes)

                        qa_cluster.AssertClusterHvParameterModify(
                            param, test_data["reset_value"])
                else:
                    test_desc = "Iterating through hypervisor parameter values"
                    ReportTestSkip(test_desc, "instance-iterate-hvparams")
            finally:
                qa_config.ReleaseManyNodes(inodes)
        else:
            test_desc = "Creating instances of template %s" % templ
            if not qa_config.TestEnabled(test_name):
                ReportTestSkip(test_desc, test_name)
            else:
                ReportTestSkip(test_desc, "disk template %s" % templ)
Пример #4
0
def RunInstanceTests():
    """Create and exercise instances."""

    requested_conversions = qa_config.get("convert-disk-templates", [])
    supported_conversions = \
        set(requested_conversions).difference(constants.DTS_NOT_CONVERTIBLE_TO)
    for (test_name, templ, create_fun, num_nodes) in \
        qa_instance.available_instance_tests:
        if (qa_config.TestEnabled(test_name)
                and qa_config.IsTemplateSupported(templ)):
            inodes = qa_config.AcquireManyNodes(num_nodes)
            try:
                instance = RunTest(create_fun, inodes)
                try:
                    RunTestIf("instance-user-down",
                              qa_instance.TestInstanceUserDown, instance)
                    RunTestIf("instance-communication",
                              qa_instance.TestInstanceCommunication, instance,
                              qa_config.GetMasterNode())
                    RunTestIf("cluster-epo", qa_cluster.TestClusterEpo)
                    RunDaemonTests(instance)
                    for node in inodes:
                        RunTestIf("haskell-confd", qa_node.TestNodeListDrbd,
                                  node, templ == constants.DT_DRBD8)
                    if len(inodes) > 1:
                        RunTestIf("group-rwops",
                                  qa_group.TestAssignNodesIncludingSplit,
                                  constants.INITIAL_NODE_GROUP_NAME,
                                  inodes[0].primary, inodes[1].primary)
                    # This test will run once but it will cover all the supported
                    # user-provided disk template conversions
                    if qa_config.TestEnabled("instance-convert-disk"):
                        if (len(supported_conversions) > 1
                                and instance.disk_template
                                in supported_conversions):
                            RunTest(qa_instance.TestInstanceShutdown, instance)
                            RunTest(
                                qa_instance.TestInstanceConvertDiskTemplate,
                                instance, supported_conversions)
                            RunTest(qa_instance.TestInstanceStartup, instance)
                            # At this point we clear the set because the requested conversions
                            # has been tested
                            supported_conversions.clear()
                        else:
                            test_desc = "Converting instance of template %s" % templ
                            ReportTestSkip(test_desc, "conversion feature")
                    RunTestIf("instance-modify-disks",
                              qa_instance.TestInstanceModifyDisks, instance)
                    RunCommonInstanceTests(instance, inodes)
                    if qa_config.TestEnabled("instance-modify-primary"):
                        othernode = qa_config.AcquireNode()
                        RunTest(qa_instance.TestInstanceModifyPrimaryAndBack,
                                instance, inodes[0], othernode)
                        othernode.Release()
                    RunGroupListTests()
                    RunExportImportTests(instance, inodes)
                    RunHardwareFailureTests(instance, inodes)
                    RunRepairDiskSizes()
                    RunTestIf(["rapi", "instance-data-censorship"],
                              qa_rapi.TestInstanceDataCensorship, instance,
                              inodes)
                    RunTest(qa_instance.TestInstanceRemove, instance)
                finally:
                    instance.Release()
                del instance
            finally:
                qa_config.ReleaseManyNodes(inodes)
            qa_cluster.AssertClusterVerify()
        else:
            test_desc = "Creating instances of template %s" % templ
            if not qa_config.TestEnabled(test_name):
                ReportTestSkip(test_desc, test_name)
            else:
                ReportTestSkip(test_desc, "disk template %s" % templ)