Example #1
0
def run(check_timeout=300):
    ipmi_manager = IPMIManager()
    result = ipmi_manager.rebootNode(HOST)
    print "wait to %s boot up" % HOST
    time.sleep(150)  # wait node to reboot
    response = _check_boot_up(check_timeout)
    print response
    if response == "OK" and result.code == "succeed":
        return True
    return False
Example #2
0
def run():
    ipmi_manager = IPMIManager()
    try:
        result = ipmi_manager.getPowerStatus(HOST)
        if result == "OK":
            return True
        else:
            return False
    except Exception as e:
        print "UT_Get_Power_Status Except:" + str(e)
        return False
Example #3
0
def run():
    ipmi_operator = Operator()
    ipmi_manager = IPMIManager()
    result = ipmi_manager.shutOffNode(HOST)
    time.sleep(20)
    if result.code != "succeed":
        print "shutoff node fail"
    try:
        result = ipmi_operator.startNode(HOST)
        if result.code == "succeed":
            return True
        return False
    except Exception as e:
        print "UT_Start_Node Except:" + str(e)
        return False
Example #4
0
def run(check_timeout=60):
    ipmi_manager = IPMIManager()
    try:
        result = ipmi_manager.shutOffNode(HOST)

        while check_timeout > 0:
            power_status = ipmi_manager.getPowerStatus(HOST)
            if power_status == "Error" and result.code == "succeed":
                time.sleep(60)
                return True
            check_timeout -= 1
            time.sleep(1)
        return False
    except Exception as e:
        print "UT_ShutOff_Node Except:" + str(e)
        return False
Example #5
0
def run():
    ipmi_operator = Operator()
    ipmi_manager = IPMIManager()

    try:
        result = ipmi_operator.shutOffNode(HOST)
        time.sleep(20)
        if result.code == "succeed":
            print "boot node"
            result = ipmi_manager.startNode(HOST)
            if result.code == "succeed":
                print "boot node successfully"
            else:
                print "boot node fail"
            return True
        return False
    except Exception as e:
        print "UT_ShutOff_Node Except:" + str(e)
        return False
import subprocess
import sys
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: