Exemple #1
0
def run():
    novaClient = NovaClient.getInstance()
    instance_id = Preprocess.create_with_provider_instance()
    instance = Instance(instance_id, novaClient.getInstanceName(instance_id),
                        HOST, STATUS, NETWORK)
    time.sleep(20)
    fail_node = Node(HOST, CLUSTER_ID)
    # target_host = Node(TARGET_HOST, CLUSTER_ID)
    try:
        host = novaClient.liveMigrateVM(instance_id, TARGET_HOST)
        time.sleep(20)
        if host == TARGET_HOST:
            return True
        else:
            return False
    except Exception as e:
        print "UT_Live_Migration Except:" + str(e)
        return False
    finally:
        fail_node.undefineInstance(instance)
        Postprocess.deleteInstance()
Exemple #2
0
def run():
    novaClient = NovaClient.getInstance()
    instance_id = Preprocess.create_with_provider_instance()
    instance = Instance(instance_id, novaClient.getInstanceName(instance_id),
                        HOST, STATUS, NETWORK)
    time.sleep(20)
    fail_node = Node(HOST, CLUSTER_ID)
    target_host = Node(TARGET_HOST, CLUSTER_ID)
    try:
        novaClient.evacuate(instance, target_host, fail_node)
        time.sleep(20)
        if novaClient.getInstanceHost(instance_id) == TARGET_HOST:
            return True
        else:
            return False
    except Exception as e:
        print "UT_Evacuate Except:" + str(e)
        return False
    finally:
        fail_node.undefineInstance(instance)
        Postprocess.deleteInstance()
import time

import paramiko

sys.path.insert(0, '..')
from HASS.Node import Node
from HASS.IPMIModule import IPMIManager
from HASS.RecoveryManager import RecoveryManager

CLUSTER_ID = "clusterid"
HOST = "compute2"
PORT = 2468

ipmi_manager = IPMIManager()
recover = RecoveryManager()
node = Node(HOST, CLUSTER_ID)


def run():
    # shutoff
    try:
        recover.recoverNodeByShutoff(node)
        time.sleep(20)
        result = ipmi_manager.getPowerStatus(HOST)
        if result == "OK":
            return False
        else:
            return True
    except Exception as e:
        print "UT_Recover_Node_By_Shutoff Except:" + str(e)
        return False
Exemple #4
0
def _get_detect_result():
    node = Node(HOST, CLUSTER_ID)
    thread = node.detection_thread
    result = thread.detect()
    return result