def run():
    ClusterManager.init()
    ClusterManager.createCluster(CLUSTER_NAME, write_DB=False)
    cluster_id = "wrong"
    try:
        result = ClusterManager.deleteCluster(cluster_id)
        if result.code == "failed":
            return True
        else:
            return False
    except Exception as e:
        print "UT_Delete_Wrong_Cluster Except:" + str(e)
        return False
示例#2
0
def run():
    ClusterManager.init()
    ClusterManager.createCluster(CLUSTER_NAME, write_DB=False)

    try:
        result = ClusterManager.listCluster()
        if len(result) >= 1:
            return True
        else:
            return False
    except Exception as e:
        print "UT_List_Cluster Except:" + str(e)
        return False
def run():
    try:
        ClusterManager.init()
        result = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False)
        if result.code == "succeed":
            dup_result = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False)
            if dup_result.code == "succeed":
                return False
            else:
                return True
        else:
            return False
    except Exception as e:
        print "UT_Create_Duplicate_Cluster Except:" + str(e)
        return False
示例#4
0
def run():
    ClusterManager.init()
    instance_id = Preprocess.create_with_provider_instance()
    cluster = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False)
    cluster_id = cluster.data.get("cluster_id")
    ClusterManager.addNode(cluster_id, NODE_NAME, write_DB=False)
    ClusterManager.addInstance(cluster_id,
                               instance_id,
                               write_DB=False,
                               send_flag=False)
    try:
        result = ClusterManager.deleteInstance(cluster_id,
                                               instance_id,
                                               write_DB=False,
                                               send_flag=False)
        if result.code == "succeed":
            return True
        else:
            return False
    except Exception as e:
        print "UT_Delete_Instance Except:" + str(e)
        return False
    finally:
        ClusterManager.deleteNode(cluster_id, NODE_NAME[0], write_DB=False)
        Postprocess.deleteInstance()
def run():
    ClusterManager.init()
    cluster_id = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False)
    cluster_id = cluster_id.data.get("cluster_id")
    ClusterManager.addNode(cluster_id, NODE_NAME, write_DB=False)

    try:
        result = ClusterManager.listNode(cluster_id)
        node_list = result.data.get("node_list")
        print node_list
        check = False
        for node in node_list:
            node_name = node[0]
            ipmi_status = node[2]
            if node_name == "compute2":
                if ipmi_status:
                    check = True
            if node_name == "compute1":
                if not ipmi_status:
                    check = True
        return check
    except Exception as e:
        print "UT_LIst_Node_IPMI_Status Except:" + str(e)
        return False
    finally:
        for node_name in NODE_NAME:
            ClusterManager.deleteNode(cluster_id, node_name, write_DB=False)
示例#6
0
def run():
    ClusterManager.init()
    cluster_result = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False)
    cluster_id = cluster_result.data.get("cluster_id")
    print cluster_id
    try:
        result = ClusterManager.deleteCluster(cluster_id)
        if result.code == "succeed":
            return True
        else:
            return False
    except Exception as e:
        print "UT_Delete_Cluster Except:" + str(e)
        return False
示例#7
0
def run():
    ClusterManager.init()
    cluster_id = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False)
    cluster_id = cluster_id.data.get("cluster_id")
    try:
        result = ClusterManager.addNode(cluster_id, NODE_NAME, write_DB=False)
        if result.code == "succeed":
            return True
        else:
            return False
    except Exception as e:
        print "UT_Add_Node Except:" + str(e)
        return False
    finally:
        ClusterManager.deleteNode(cluster_id, NODE_NAME[0], write_DB=False)
def run():
    ClusterManager.init()
    cluster_id = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False)
    cluster_id = cluster_id.data.get("cluster_id")
    ClusterManager.addNode(cluster_id, NODE_NAME, write_DB=False)

    wrong_cluster_id = "wrong id"
    try:
        result = ClusterManager.listNode(wrong_cluster_id)
        if result.code == "succeed":
            return False
        return True
    except Exception as e:
        print "UT_List_Node_Wrong_Cluster_ID Except:" + str(e)
        return False
    finally:
        ClusterManager.deleteNode(cluster_id, NODE_NAME[0], write_DB=False)
def run():
    ClusterManager.init()
    cluster_id = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False)
    cluster_id = cluster_id.data.get("cluster_id")
    ClusterManager.addNode(cluster_id, NODE_NAME, write_DB=False)
    ipmi_operator = Operator()

    try:
        result = ipmi_operator.shutOffNode(HOST)
        if result.code == "succeed":
            return False
        else:
            return True
    except Exception as e:
        print "UT_ShutOff_Node_In_Cluster Except:" + str(e)
        return False
    finally:
        ClusterManager.deleteNode(cluster_id, NODE_NAME[0], write_DB=False)
示例#10
0
def run():
    ClusterManager.init()
    cluster = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False)
    cluster_id = cluster.data.get("cluster_id")
    ClusterManager.addNode(cluster_id, NODE_NAME, write_DB=False)

    try:
        result = ClusterManager.addInstance(cluster_id,
                                            WRONG_INSTANCE_ID,
                                            write_DB=False,
                                            send_flag=False)
        if result.code == "succeed":
            return False
        else:
            return True
    except Exception as e:
        print "UT_Add_Wrong_Instance Except:" + str(e)
        return False
示例#11
0
def run():
    ClusterManager.init()
    cluster_id = ClusterManager.createCluster(CLUSTER_NAME, write_DB=False)
    cluster_id = cluster_id.data.get("cluster_id")
    ClusterManager.addNode(cluster_id, NODE_NAME, write_DB=False)

    try:
        result = ClusterManager.listNode(cluster_id)
        node_list = result.data.get("node_list")

        if len(node_list) == 1:
            return True
        else:
            return False
    except Exception as e:
        print "UT_List_Node Except:" + str(e)
        return False
    finally:
        ClusterManager.deleteNode(cluster_id, NODE_NAME[0], write_DB=False)