Esempio n. 1
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(PARALLEL_TEST_DICT.keys())):
        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"])
Esempio n. 2
0
def RunCommonInstanceTests(instance, inst_nodes):
    """Runs a few tests that are common to all disk types.

  """
    RunTestIf("instance-shutdown", qa_instance.TestInstanceShutdown, instance)
    RunTestIf(["instance-shutdown", "instance-console", qa_rapi.Enabled],
              qa_rapi.TestRapiStoppedInstanceConsole, instance)
    RunTestIf(["instance-shutdown", "instance-modify"],
              qa_instance.TestInstanceStoppedModify, instance)
    RunTestIf("instance-shutdown", qa_instance.TestInstanceStartup, instance)

    # Test shutdown/start via RAPI
    RunTestIf(["instance-shutdown", qa_rapi.Enabled],
              qa_rapi.TestRapiInstanceShutdown, instance)
    RunTestIf(["instance-shutdown", qa_rapi.Enabled],
              qa_rapi.TestRapiInstanceStartup, instance)

    RunTestIf("instance-list", qa_instance.TestInstanceList)

    RunTestIf("instance-info", qa_instance.TestInstanceInfo, instance)

    RunTestIf("instance-modify", qa_instance.TestInstanceModify, instance)
    RunTestIf(["instance-modify", qa_rapi.Enabled],
              qa_rapi.TestRapiInstanceModify, instance)

    RunTestIf("instance-console", qa_instance.TestInstanceConsole, instance)
    RunTestIf(["instance-console", qa_rapi.Enabled],
              qa_rapi.TestRapiInstanceConsole, instance)

    RunTestIf("instance-device-names", qa_instance.TestInstanceDeviceNames,
              instance)
    DOWN_TESTS = qa_config.Either([
        "instance-reinstall",
        "instance-rename",
        "instance-grow-disk",
    ])

    # 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", qa_rapi.Enabled],
              qa_rapi.TestRapiInstanceReinstall, instance)

    if qa_config.TestEnabled("instance-rename"):
        tgt_instance = qa_config.AcquireInstance()
        try:
            rename_source = instance.name
            rename_target = tgt_instance.name
            # perform instance rename to the same name
            RunTest(qa_instance.TestInstanceRenameAndBack, rename_source,
                    rename_source)
            RunTestIf(qa_rapi.Enabled, 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(qa_rapi.Enabled,
                          qa_rapi.TestRapiInstanceRenameAndBack, rename_source,
                          rename_target)
        finally:
            tgt_instance.Release()

    RunTestIf(["instance-grow-disk"], qa_instance.TestInstanceGrowDisk,
              instance)

    # and now start the instance again
    RunTestIf(DOWN_TESTS, qa_instance.TestInstanceStartup, instance)

    RunTestIf("instance-reboot", qa_instance.TestInstanceReboot, instance)

    RunTestIf("tags", qa_tags.TestInstanceTags, instance)

    if instance.disk_template == constants.DT_DRBD8:
        RunTestIf("cluster-verify",
                  qa_cluster.TestClusterVerifyDisksBrokenDRBD, instance,
                  inst_nodes)
    RunTestIf("cluster-verify", qa_cluster.TestClusterVerify)

    RunTestIf(qa_rapi.Enabled, qa_rapi.TestInstance, instance)

    # Lists instances, too
    RunTestIf("node-list", qa_node.TestNodeList)

    # Some jobs have been run, let's test listing them
    RunTestIf("job-list", qa_job.TestJobList)