Ejemplo n.º 1
0
def SetupCluster(rapi_user):
    """Initializes the cluster.

  @param rapi_user: Login user for RAPI
  @return: Login secret for RAPI

  """
    rapi_secret = utils.GenerateSecret()
    RunTestIf("create-cluster", qa_cluster.TestClusterInit, rapi_user,
              rapi_secret)
    if not qa_config.TestEnabled("create-cluster"):
        # If the cluster is already in place, we assume that exclusive-storage is
        # already set according to the configuration
        qa_config.SetExclusiveStorage(qa_config.get("exclusive-storage",
                                                    False))
        if qa_rapi.Enabled():
            # To support RAPI on an existing cluster we have to find out the secret
            rapi_secret = qa_rapi.LookupRapiSecret(rapi_user)

    qa_group.ConfigureGroups()

    # Test on empty cluster
    RunTestIf("node-list", qa_node.TestNodeList)
    RunTestIf("instance-list", qa_instance.TestInstanceList)
    RunTestIf("job-list", qa_job.TestJobList)

    RunTestIf("create-cluster", qa_node.TestNodeAddAll)
    if not qa_config.TestEnabled("create-cluster"):
        # consider the nodes are already there
        qa_node.MarkNodeAddedAll()

    RunTestIf("test-jobqueue", qa_cluster.TestJobqueue)
    RunTestIf("test-jobqueue", qa_job.TestJobCancellation)

    # enable the watcher (unconditionally)
    RunTest(qa_daemon.TestResumeWatcher)

    RunTestIf("node-list", qa_node.TestNodeList)

    # Test listing fields
    RunTestIf("node-list", qa_node.TestNodeListFields)
    RunTestIf("instance-list", qa_instance.TestInstanceListFields)
    RunTestIf("job-list", qa_job.TestJobListFields)
    RunTestIf("instance-export", qa_instance.TestBackupListFields)

    RunTestIf("node-info", qa_node.TestNodeInfo)

    return rapi_secret
Ejemplo n.º 2
0
def SetupCluster():
    """Initializes the cluster.

  """

    RunTestIf("create-cluster", qa_cluster.TestClusterInit)
    if not qa_config.TestEnabled("create-cluster"):
        # If the cluster is already in place, we assume that exclusive-storage is
        # already set according to the configuration
        qa_config.SetExclusiveStorage(qa_config.get("exclusive-storage",
                                                    False))

    qa_rapi.SetupRapi()

    qa_group.ConfigureGroups()

    # Test on empty cluster
    RunTestIf("node-list", qa_node.TestNodeList)
    RunTestIf("instance-list", qa_instance.TestInstanceList)
    RunTestIf("job-list", qa_job.TestJobList)

    RunTestIf("create-cluster", qa_node.TestNodeAddAll)
    if not qa_config.TestEnabled("create-cluster"):
        # consider the nodes are already there
        qa_node.MarkNodeAddedAll()

    RunTestIf("test-jobqueue", qa_cluster.TestJobqueue)
    RunTestIf("test-jobqueue", qa_job.TestJobCancellation)

    # enable the watcher (unconditionally)
    RunTest(qa_daemon.TestResumeWatcher)

    RunTestIf("node-list", qa_node.TestNodeList)

    # Test listing fields
    RunTestIf("node-list", qa_node.TestNodeListFields)
    RunTestIf("instance-list", qa_instance.TestInstanceListFields)
    RunTestIf("job-list", qa_job.TestJobListFields)
    RunTestIf("instance-export", qa_instance.TestBackupListFields)

    RunTestIf("node-info", qa_node.TestNodeInfo)