Esempio n. 1
0
def postprocess_nodes(parser):
    if parser["pos_check_primaryOS_status"] == "yes":
        if not FTOS.OS_is_running(parser["PrimaryOS_ip"], parser):
            postprocess_primaryOS_running(parser)
    if parser["pos_check_backupOS_status"] == "yes":
        if not FTOS.OS_is_running(parser["BackupOS_ip"], parser):
            postprocess_backupOS_running(parser)
    if parser["pos_check_slaveOS_status"] == "yes":
        if not FTOS.OS_is_running(parser["SlaveOS_ip"], parser):
            postprocess_slaveOS_running(parser)
Esempio n. 2
0
def postprocess_NFS_OS_reboot(parser):
    """
	when test case done , Host OS reboot
	:param parser: is a dict, get from Test config file
	"""

    ssh = shell_server.get_ssh(parser["NFS_ip"], parser["NFS_usr"],
                               parser["NFS_pwd"])  #獲得ssh
    if FTOS.OS_is_running(parser["NFS_ip"], parser):
        FTOS.reboot(ssh)
Esempio n. 3
0
def preprocess_NFS_OS(parser):
    if FTOS.OS_is_running(parser["NFS_ip"], parser) == False:
        #FTOS.L1_boot(parser["NFS_NetworkAdaptor"])
        if FTOS.OS_is_running(parser["NFS_ip"], parser) == False:
            raise TA_error.Preprocess_Error("NFS node can not start")
    if FTOS.ssh_is_ready(parser["NFS_ip"], parser["NFS_usr"],
                         parser["NFS_pwd"], parser) == False:
        raise TA_error.Preprocess_Error("NFS node ssh can not access")

    ssh = shell_server.get_ssh(parser["NFS_ip"], parser["NFS_usr"],
                               parser["NFS_pwd"])  #獲得ssh
Esempio n. 4
0
def preprocess_hostOS_OS_shutdown(parser):
    """
  preprocess hostOS OS shutdown
  """
    if not FTOS.is_shutdown(parser["HostOS_name"]):
        if FTOS.is_running(parser["HostOS_name"]):
            status = FTOS.shutdown(parser["HostOS_name"])
            if status != "success":
                raise TA_error.Preprocess_Error("HostOS OS shutdown command fail")
        time.sleep(float(parser["pre_hostOS_shutdown_time"]))
        if not FTOS.is_shutdown(parser["HostOS_name"]):
            raise TA_error.Preprocess_Error("HostOS OS can not shutdown")
Esempio n. 5
0
def preprocess_backupOS_OS_boot(parser):
    """
  preprocess backupOS OS boot
  """
    if not FTOS.is_running(parser["BackupOS_name"]):
        if FTOS.is_shutdown(parser["BackupOS_name"]):
            status = FTOS.boot(parser["BackupOS_name"])
            if status != "success":
                raise TA_error.Preprocess_Error("BackupOS OS boot command fail")
        time.sleep(float(parser["pre_backupOS_boot_time"]))
        if not FTOS.is_running(parser["BackupOS_name"]):
            raise TA_error.Preprocess_Error("BackupOS OS can not boot")
Esempio n. 6
0
def postprocess_Host_OS_reboot(parser):
    """
	post process host os part
	:param parser: is a dict, get from Test config file
	"""

    ssh = shell_server.get_ssh(parser["PrimaryOS_ip"], parser["PrimaryOS_usr"],
                               parser["PrimaryOS_pwd"])  #獲得ssh
    if not FTVM.is_shutoff(parser["vm_name"], parser["PrimaryOS_ip"], ssh):
        raise TA_error.Postprocess_Error(
            "vm %s in PrimaryOS cannot shutdown " % parser["vm_name"])
    if parser["pos_hostOS_restart"] == "yes":
        if FTOS.OS_is_running(parser["PrimaryOS_ip"], parser):
            FTOS.reboot(ssh)
Esempio n. 7
0
def preprocess_backupOS_OS_boot(parser):
    """
    preprocess backupOS OS boot

    :called func: preprocess_hostOS_OS
    :param parser: is a dict, get from Test config file
    """
    if not FTOS.is_running(parser["BackupOS_name"]):
        if FTOS.is_shutdown(parser["BackupOS_name"]):
            status = FTOS.boot(parser["BackupOS_name"])
            if status != "success":
                raise TA_error.Preprocess_Error(
                    "BackupOS OS boot command fail")
        time.sleep(float(parser["pre_backupOS_boot_time"]))
        if not FTOS.is_running(parser["BackupOS_name"]):
            raise TA_error.Preprocess_Error("BackupOS OS can not boot")
Esempio n. 8
0
def preprocess_hostOS_OS_shutdown(parser):
    """
    preprocess hostOS OS shutdown part

    :called func: preprocess_hostOS_OS
    :param parser: is a dict, get from Test config file
    """
    if not FTOS.is_shutdown(parser["PrimaryOS_name"]):  #若host不為關機狀態
        if FTOS.is_running(parser["PrimaryOS_name"]):
            status = FTOS.shutdown(parser["PrimaryOS_name"])
            if status != "success":
                raise TA_error.Preprocess_Error(
                    "PrimaryOS OS shutdown command fail")
        time.sleep(float(parser["pre_hostOS_shutdown_time"]))
        if not FTOS.is_shutdown(parser["PrimaryOS_name"]):
            raise TA_error.Preprocess_Error("PrimaryOS OS can not shutdown")
Esempio n. 9
0
def preprocess_slave_OS(parser):
    """
    preprocess  , Host os part , check slave node is booted
    :param parser : is a dict , get from test config file
    """
    if FTOS.OS_is_running(parser["SlaveOS_ip"], parser) == False:
        if parser["IPMI_supported"] == "yes":
            ssh = shell_server.get_ssh(parser["PrimaryOS_ip"],
                                       parser["PrimaryOS_usr"],
                                       parser["PrimaryOS_pwd"])  #獲得ssh
            FTOS.IPMI_boot(parser["SlaveOS_ipmb"], ssh)
            ssh.close()
        elif parser["IPMI_supported"] == "no":
            FTOS.L1_boot(parser["SlaveOS_NetworkAdaptor"])
    if FTOS.OS_is_running(parser["SlaveOS_ip"], parser) == False:
        raise TA_error.Preprocess_Error("SlaveOS node cannot boot")
    if FTOS.ssh_is_ready(parser["SlaveOS_ip"], parser["SlaveOS_usr"],
                         parser["SlaveOS_pwd"], parser) == False:
        raise TA_error.Preprocess_Error("Slave node ssh can not access")
Esempio n. 10
0
def postprocess_slaveOS_running(parser):
    """
	postrocess slave OS become running

	:called func: postprocess_hostOS
	:param parser: is a dict, get from Test config file
	"""
    if parser["pos_check_slaveOS_status"] == "yes":
        if parser["IPMI_supported"] == "yes":
            ssh = shell_server.get_ssh(parser["PrimaryOS_ip"],
                                       parser["PrimaryOS_usr"],
                                       parser["PrimaryOS_pwd"])  #獲得ssh
            FTOS.IPMI_boot(parser["SlaveOS_ipmb"], ssh)
            ssh.close()
        elif parser["IPMI_supported"] == "no":
            FTOS.L1_boot(parser["SlaveOS_NetworkAdaptor"])
    if FTOS.OS_is_running(parser["SlaveOS_ip"], parser):
        return True
    raise TA_error.Postprocess_Error("slave OS can not boot")