Exemple #1
0
def vm_is_login_in_slaveOS(parser):
    """
	vm is login in hostOS or not
	:param parser: config
	:return: True/raise exception
	"""

    if FTVM.is_login(parser["vm_name"], parser["TA_ip"],
                     parser["TA_msg_sock_port"],
                     int(parser["ast_vm_login_wait_time"]
                         )):  #若回傳VM登入完成,則test oracle通過,否則raise exception
        return True
    else:
        ssh = shell_server.get_ssh(parser["GuestOS_ip_S"],
                                   parser["GuestOS_usr"],
                                   parser["GuestOS_pwd"])  #獲得ssh

        cmd = "sudo %s" % parser["login_reply_path"]
        #print cmd
        s_stdin, s_stdout, s_stderr = ssh.exec_command(cmd)  #透過ssh執行指令
        if FTVM.is_login(parser["vm_name"], parser["TA_ip"],
                         parser["TA_msg_sock_port"],
                         int(parser["ast_vm_login_wait_time"]
                             )):  #若回傳VM登入完成,則test oracle通過,否則raise exception
            return True
        ssh.close()
    raise TA_error.Assert_Error("VM (name : %s) is not login in backupOS" %
                                parser["vm_name"])
Exemple #2
0
def preprocess_hostOS_vm_running(parser):
    """
    preprocess vm become running

    :called func: preprocess_hostOS_vm
    :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 FTVM.is_running(parser["vm_name"], parser["PrimaryOS_ip"], ssh):
        print 59
        if "pre_hostOS_VM_restart" in parser.keys(
        ) and parser["pre_hostOS_VM_restart"] == "yes":  #根據參數若VM需重新啟動
            print 54
            prepocess_hostOS_vm_restart(parser)
            print 55
            time.sleep(float(parser["pre_hostOS_VM_boot_time"]))
    elif FTVM.is_shutoff(parser["vm_name"], parser["PrimaryOS_ip"], ssh):
        print 56
        prepocess_hostOS_vm_start(parser)
        print 57
        time.sleep(float(parser["pre_hostOS_VM_boot_time"]))
    print 58
    if not FTVM.is_running(parser["vm_name"], parser["PrimaryOS_ip"], ssh):
        ssh.close()
        raise TA_error.Preprocess_Error("PrimaryOS VM: %s can not start" %
                                        parser["vm_name"])

    ssh.close()
Exemple #3
0
def vm_running_in_slaveOS(parser):
    """
	vm is running in SlaveOS or not

	:param parser: config
	:return: True/raise exception
	"""

    ssh = shell_server.get_ssh(parser["SlaveOS_ip"], parser["SlaveOS_usr"],
                               parser["SlaveOS_pwd"])  #獲得ssh

    t_end = time.time()
    if "ast_vm_running_wait_time" in parser.keys(
    ):  #若參數ast_vm_running_wait_time存在於parser,則進入
        t_end = time.time() + float(
            parser["ast_vm_running_wait_time"])  #計算出等待之時間,並存於t_end
    while time.time() < t_end:  #超過t_end則跳出迴圈
        #每sleep一秒就詢問一次狀態
        time.sleep(1)
        if FTVM.is_running(parser["vm_name"], parser["SlaveOS_ip"],
                           ssh):  #狀態為running就跳出迴圈
            break
    if FTVM.is_running(parser["vm_name"], parser["SlaveOS_ip"],
                       ssh):  #若回傳之狀態是running,則test oracle通過,否則raise exception
        ssh.close()
        return True
    ssh.close()
    raise TA_error.Assert_Error("VM (name : %s) is not running in SlaveOS" %
                                parser["vm_name"])
Exemple #4
0
def prepocess_hostOS_vm_restart(parser):
    """
  according to fault tolerant level, preprocess vm restart
  """
    if parser["level"] == "0":
        FTVM.restart(parser["vm_name"], parser["HostOS_ip"])
    else:
        FTVM.ftrestart(parser["vm_name"], parser["HostOS_ip"], parser["level"])
Exemple #5
0
def preprocess_hostOS_vm_running(parser):
    """
  preprocess vm become running
  """
    if FTVM.is_running(parser["vm_name"], parser["HostOS_ip"]):
        prepocess_hostOS_vm_restart(parser)
        time.sleep(float(parser["pre_hostOS_VM_boot_time"]))
    elif FTVM.is_shutoff(parser["vm_name"], parser["HostOS_ip"]):
        prepocess_hostOS_vm_start(parser)
        time.sleep(float(parser["pre_hostOS_VM_boot_time"]))
    if not FTVM.is_running(parser["vm_name"], parser["HostOS_ip"]):
        raise TA_error.Preprocess_Error("HostOS %s can not start" % parser["vm_name"])
Exemple #6
0
def detect_rm_non_running_ftvm(parser):
    ssh = shell_server.get_ssh(parser["PrimaryOS_ip"], parser["PrimaryOS_usr"],
                               parser["PrimaryOS_pwd"])  #獲得ssh
    if FTVM.is_running(parser["vm_name"], parser["PrimaryOS_ip"], ssh):
        raise TA_error.Assert_Error("VM : %s running in PrimaryOS" %
                                    parser["vm_name"])
    if FTVM.is_shutoff(parser["vm_name"], parser["PrimaryOS_ip"], ssh):
        out = HAagent.remove_ftvm(parser["vm_name"], parser, ssh)
        expected = HAagent_terminal.Vm_not_exist

        success = (out == expected)
        if success:
            return True
        raise TA_error.Assert_Error("rm non running vm fail")
Exemple #7
0
def host_vm_ftstart(parser):
    """
	ftstart vm

	: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 "pro_wait_time_start" in parser.keys():
        time.sleep(int(parser["pro_wait_time_start"]))
    FTVM.ftstart(parser["PrimaryOS_name"], parser["vm_name"],
                 parser["PrimaryOS_ip"], ssh)  #執行開啟容錯機制之開機
    ssh.close()
Exemple #8
0
def slave_vm_ftshutdown(parser):
    """
	slave ftshutdown vm

	:param parser: is a dict, get from Test config file
	"""
    ssh = shell_server.get_ssh(parser["BackupOS_ip"], parser["BackupOS_usr"],
                               parser["BackupOS_pwd"])  #獲得ssh

    if "pro_wait_time_shutdown" in parser.keys():
        time.sleep(int(parser["pro_wait_time_shutdown"]))

    FTVM.ftshutdown(parser["vm_name"], parser["BackupOS_ip"], ssh)
    ssh.close()
Exemple #9
0
def preprocess_backupOS_vm_running(parser):
    """
    according to fault tolerant level, preprocess vm start

    :called func: preprocess_hostOS_vm_running
    :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 parser["level"] == "0":  #若為不開啟容錯機制之開機,則進入
        FTVM.start(parser["vm_name"], parser["BackupOS_ip"], ssh)
    else:
        FTVM.ftstart(parser["BackupOS_name"], parser["vm_name"],
                     parser["BackupOS_ip"], ssh)
    ssh.close()
Exemple #10
0
def postprocess_backupOS_vm_shutdown(parser):
	"""
	postprocess backupOS vm shutdown
	"""
	if FTVM.is_running(parser["vm_name"], parser["backupOS_ip"]):
		FTVM.shutdown(parser["vm_name"], parser["backupOS_ip"])
	elif FTVM.is_paused(parser["vm_name"], parser["backupOS_ip"]):
		FTVM.resume(parser["vm_name"], parser["backupOS_ip"])
		FTVM.shutdown(parser["vm_name"], parser["backupOS_ip"])
	time.sleep(float(parser["pos_backupOS_VM_shutdown_time"]))
	if not FTVM.is_shutoff(parser["vm_name"], parser["backupOS_ip"]):
		raise TA_error.Postprocess_Error("backupOS %s can not shutdown" % parser["vm_name"])
Exemple #11
0
def preprocess_hostOS_vm_shutdown(parser):
    """
  preprocess hostOS vm become shutdown
  """
    if FTVM.is_running(parser["vm_name"], parser["HostOS_ip"]):
        FTVM.shutdown(parser["vm_name"], parser["HostOS_ip"])
        time.sleep(float(parser["pre_hostOS_VM_shutdown_time"]))
    elif FTVM.is_paused(parser["vm_name"], parser["HostOS_ip"]):
        FTVM.resume(parser["vm_name"], parser["HostOS_ip"])
        FTVM.shutdown(parser["vm_name"], parser["HostOS_ip"])
        time.sleep(float(parser["pre_hostOS_VM_shutdown_time"]))
    if not FTVM.is_shutoff(parser["vm_name"], parser["HostOS_ip"]):
        raise TA_error.Preprocess_Error("HostOS %s can not shutdown" % parser["vm_name"])
Exemple #12
0
def vm_shudown_in_hostOS(parser):
	"""
	vm is running in hostOS or not

	return True/raise exception
	"""
	if FTVM.is_shutoff(parser["vm_name"], parser["HostOS_ip"]):
		return True
	raise TA_error.Assert_Error("VM (name : %s) is not shutdown on hostOS" % parser["vm_name"])
def postprocess_slaveOS_vm_running(parser):
    """
	Slave OS vm become running
	"""
    ssh = shell_server.get_ssh(parser["SlaveOS_ip"], parser["SlaveOS_usr"],
                               parser["SlaveOS_pwd"])

    if FTVM.is_running(parser["vm_name"], parser["SlaveOS_ip"], ssh):
        print 59
    elif FTVM.is_shutoff(parser["vm_name"], parser["SlaveOS_ip"], ssh):
        print 56
        postprocess_slaveOS_vm_start(parser)
        print 57
        time.sleep(float(parser["pos_slaveOS_VM_boot_time"]))
    if not FTVM.is_running(parser["vm_name"], parser["SlaveOS_ip"], ssh):
        ssh.close()
        raise TA_error.Postprocess_Error("SlaveOS VM: %s can not start" %
                                         parser["vm_name"])
    ssh.close()
def postprocess_slaveOS_vm_start(parser):
    """
	according to fault tolerant level, postprocess vm start
	:called func: postprocess_hostOS_vm_running
	:param parser: is a dict, get from Test config file
	"""

    ssh = shell_server.get_ssh(parser["SlaveOS_ip"], parser["SlaveOS_usr"],
                               parser["SlaveOS_pwd"])  #獲得ssh

    if parser["level"] == "0":  #若為不開啟容錯機制之開機,則進入
        #print 58
        FTVM.start(parser["vm_name"], parser["SlaveOS_ip"], ssh)
        #print 58.5
    else:
        #print parser["level"]
        FTVM.ftstart(parser["vm_name"], parser["SlaveOS_ip"], parser["level"],
                     ssh)
        #print 59
    ssh.close()
Exemple #15
0
def kill_vm_process(parser):
	"""
	kill vm process on hostOS
	"""
	ssh = shell_server.get_ssh(parser["HostOS_ip"]
                              , parser["HostOS_usr"]
                              , parser["HostOS_pwd"])
	pid = FTVM.get_pid(parser["vm_name"], parser["HostOS_ip"], ssh)
	cmd = cmd_kill.kill_cmd(pid, 9)
	s_stdin, s_stdout, s_stderr = ssh.exec_command("sudo "+cmd)
	ssh.close()
Exemple #16
0
def rm_non_running_ftvm(parser):
    """
	detect remove non running ftvm
	:param parser: config
	:return: True/raise exception
	"""
    ssh = shell_server.get_ssh(parser["PrimaryOS_ip"], parser["PrimaryOS_usr"],
                               parser["PrimaryOS_pwd"])  #獲得ssh
    if FTVM.is_running(parser["vm_name"], parser["PrimaryOS_ip"], ssh):
        raise TA_error.Assert_Error("VM : %s already in running" %
                                    parser["vm_name"])
    if FTVM.is_shutoff(parser["vm_name"], parser["PrimaryOS_ip"], ssh):
        out = FTVM.ftshutdown(parser["vm_name"], parser["PrimaryOS_ip"], ssh)
        expected = HAagent_terminal.Vm_not_exist

        success = (out == expected)
        if success:
            return True
    raise TA_error.Assert_Error("remove non running ftvm : %s fail" %
                                parser["vm_name"])
Exemple #17
0
def vm_running_in_backupOS(parser):
	"""
	vm is running in backupOS or not

	return True/False
	"""
	if "ast_vm_running_wait_time" in parser.keys():
		time.sleep(int(parser["ast_vm_running_wait_time"]))
	if FTVM.is_running(parser["vm_name"], parser["backupOS_ip"]):
		return True
	raise TA_error.Assert_Error("VM (name : %s) is not running on backupOS" % parser["vm_name"])
Exemple #18
0
def non_primary_rm_ftvm(parser):
    """
	detect non primary remove ftvm
	:param parser: config
	:return: True/raise exception
	"""
    ssh = shell_server.get_ssh(parser["BackupOS_ip"], parser["BackupOS_usr"],
                               parser["BackupOS_pwd"])  #獲得ssh
    if FTVM.is_shutoff(parser["vm_name"], parser["BackupOS_ip"], ssh):
        raise TA_error.Assert_Error("VM : %s shutoff" % parser["vm_name"])
    if FTVM.is_running(parser["vm_name"], parser["BackupOS_ip"], ssh):
        out = FTVM.ftshutdown(parser["vm_name"], parser["BackupOS_ip"], ssh)
        expected = HAagent_terminal.Not_primary

        success = (out == expected) and FTVM.is_running(
            parser["vm_name"], parser["BackupOS_ip"],
            ssh)  #shell message and FTVM running
        if success:
            return True
    raise TA_error.Assert_Error("remove non running ftvm : %s fail" %
                                parser["vm_name"])
Exemple #19
0
def preprocess_hostOS_vm_login(parser):
    """
    preprocess check hostOS vm is login

    :called func: preprocess_hostOS_OS_vm
    :param parser: is a dict, get from Test config file
    """
    if not FTVM.is_login(parser["vm_name"], parser["TA_ip"],
                         parser["TA_msg_sock_port"],
                         int(parser["pre_hostOS_VM_login_time"])):
        raise TA_error.Preprocess_Error("PrimaryOS %s is not login" %
                                        parser["vm_name"])
Exemple #20
0
def vm_running_in_hostOS(parser):
	"""
	vm is running in hostOS or not

	cfg var: ast_vm_running_wait_time

	return True/raise exception
	"""
	if "ast_vm_running_wait_time" in parser.keys():
		time.sleep(int(parser["ast_vm_running_wait_time"]))
	if FTVM.is_running(parser["vm_name"], parser["HostOS_ip"]):
		return True
	raise TA_error.Assert_Error("VM (name : %s) is not running on hostOS" % parser["vm_name"])
Exemple #21
0
def vm_shudown_in_SlaveOS(parser):
    """
	vm is running in SlaveOS or not
	:param parser: config
	:return: True/raise exception
	"""
    ssh = shell_server.get_ssh(parser["SlaveOS_ip"], parser["SlaveOS_usr"],
                               parser["SlaveOS_pwd"])  #獲得ssh
    if FTVM.is_shutoff(parser["vm_name"], parser["SlaveOS_ip"],
                       ssh):  #若回傳之狀態是shut off,則test oracle通過,否則raise exception
        return True
    raise TA_error.Assert_Error("VM (name : %s) is not shutdown in SlaveOS" %
                                parser["vm_name"])
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)
Exemple #23
0
def non_primary_start_ftvm(parser):
    """
	check non primary node(backup node) can start ftvm or not
	:param parser: config
	:return: True/raise exception
	"""
    ssh = shell_server.get_ssh(parser["BackupOS_ip"], parser["BackupOS_usr"],
                               parser["BackupOS_pwd"])  #獲得ssh
    if FTVM.is_running(parser["vm_name"], parser["BackupOS_ip"], ssh):
        raise TA_error.Assert_Error("VM : %s already in running" %
                                    parser["vm_name"])
    if FTVM.is_shutoff(parser["vm_name"], parser["BackupOS_ip"], ssh):
        out = FTVM.ftstart(parser["BackupOS_name"], parser["vm_name"],
                           parser["BackupOS_ip"], ssh)
        expected = HAagent_terminal.Not_primary

        success = (out == expected) and FTVM.is_shutoff(
            parser["vm_name"], parser["BackupOS_ip"],
            ssh)  # shell message and FTVM shutoff
        if success:
            return True
    raise TA_error.Assert_Error("non primary start ftvm : %s fail" %
                                parser["vm_name"])
Exemple #24
0
def preprocess_slaveOS_vm_running(parser):
    """
    preprocess vm become running

    :called func: preprocess_slaveOS_vm
    :param parser: is a dict, get from Test config file
    """
    ssh = shell_server.get_ssh(parser["SlaveOS_ip"], parser["SlaveOS_usr"],
                               parser["SlaveOS_pwd"])  #獲得ssh

    if FTVM.is_running(parser["vm_name"], parser["SlaveOS_ip"], ssh):
        pass
        print 59
    elif FTVM.is_shutoff(parser["vm_name"], parser["SlaveOS_ip"], ssh):
        print 56
        prepocess_slaveOS_vm_start(parser)
        print 57
        time.sleep(float(parser["pre_slaveOS_VM_boot_time"]))
    print 58
    if not FTVM.is_running(parser["vm_name"], parser["SlaveOS_ip"], ssh):
        ssh.close()
        raise TA_error.Preprocess_Error("SlaveOS VM: %s can not start" %
                                        parser["vm_name"])
    ssh.close()
Exemple #25
0
def vm_duplicate_start(parser):
    """
	check vm can duplicate start or not
	:param parser: config
	:return: True/raise exception
	"""
    ssh = shell_server.get_ssh(parser["PrimaryOS_ip"], parser["PrimaryOS_usr"],
                               parser["PrimaryOS_pwd"])  #獲得ssh

    if FTVM.is_shutoff(parser["vm_name"], parser["PrimaryOS_ip"], ssh):
        raise TA_error.Assert_Error("VM name : %s is shut off in PrimaryOS")
    if FTVM.is_running(parser["vm_name"], parser["PrimaryOS_ip"], ssh):

        out = FTVM.duplicate_ftstart(parser["PrimaryOS_name"],
                                     parser["vm_name"], parser["PrimaryOS_ip"],
                                     ssh)
        expected = HAagent_terminal.Startvm_addVM_failed % (
            HAagent_terminal.Vm_has_exist)
        success = (out == expected)

        if success:
            return True
        raise TA_error.Assert_Error("vm : %s duplicate start fail" %
                                    parser["vm_name"])
Exemple #26
0
def preprocess_slaveOS_vm_shutdown(parser):
    """
    preprocess backupOS vm become shutdown

    :called func: preprocess_backupOS_vm
    :param parser: is a dict, get from Test config file
    """
    ssh = shell_server.get_ssh(parser["SlaveOS_ip"], parser["SlaveOS_usr"],
                               parser["SlaveOS_pwd"])  #獲得ssh
    if FTVM.is_running(parser["vm_name"], parser["SlaveOS_ip"], ssh):
        FTVM.destroy(parser["vm_name"], parser["SlaveOS_ip"], ssh)
        time.sleep(float(parser["pre_slaveOS_VM_shutdown_time"]))
    elif FTVM.is_paused(parser["vm_name"], parser["SlaveOS_ip"], ssh):
        FTVM.resume(parser["vm_name"], parser["SlaveOS_ip"], ssh)
        FTVM.destroy(parser["vm_name"], parser["SlaveOS_ip"], ssh)
        time.sleep(float(parser["pre_slaveOS_VM_shutdown_time"]))
    if not FTVM.is_shutoff(parser["vm_name"], parser["SlaveOS_ip"], ssh):
        ssh.close()
        raise TA_error.Preprocess_Error("SlaveOS %s can not shutdown" %
                                        parser["vm_name"])
    ssh.close()
def postprocess_hostOS_ATCA_OS_running(parser):

    if parser["pos_boot_ATCA_hostOS"] == "yes":
        cmd = "ssh 172.16.33.222 'clia activate %s 0'" % (
            parser["PrimaryOS_ipmc_name"])

        ssh = shell_server.get_ssh(parser["BackupOS_ip"],
                                   parser["BackupOS_usr"],
                                   parser["BackupOS_pwd"])  #獲得ssh

        s_stdin, s_stdout, s_stderr = ssh.exec_command("sudo " + cmd)
        ssh.close()

        if not FTVM.is_login(parser["PrimaryOS_name"], parser["TA_ip"],
                             parser["TA_msg_sock_port"],
                             int(parser["pos_hostOS_login_time"])):
            raise TA_error.Postprocess_Error("PrimaryOS %s is not login" %
                                             parser["PrimaryOS_name"])
Exemple #28
0
def kill_backup_vm_process(parser):
    """
	kill vm process on backupOS

	:param parser: is a dict, get from Test config file
	"""
    if "pro_wait_time_kill_vm_p" in parser.keys(
    ):  #若pro_wait_time_kill_vm_p存在於parser
        time.sleep(int(parser["pro_wait_time_kill_vm_p"]))
    #print "kill"

    ssh = shell_server.get_ssh(parser["BackupOS_ip"], parser["BackupOS_usr"],
                               parser["BackupOS_pwd"])  #獲得ssh
    pid = FTVM.get_pid(parser["vm_name"], parser["BackupOS_ip"],
                       ssh)  #獲得VM之pid
    cmd = cmd_kill.kill_cmd(pid, 9)  #獲得kill vm process之指令字串
    print cmd
    s_stdin, s_stdout, s_stderr = ssh.exec_command("sudo " + cmd)  #透過ssh執行指令
    ssh.close()
def postprocess_backupOS_vm_running(parser):
    """
	postrocess vm become running

	:called func: postprocess_BackupOS_vm
	:param parser: is a dict, get from Test config file
	"""
    ssh = shell_server.get_ssh(parser["BackupOS_ip"], parser["BackupOS_usr"],
                               parser["BackupOS_pwd"])  #獲得ssh
    if FTVM.is_running(parser["vm_name"], parser["BackupOS_ip"], ssh):
        FTVM.restart(parser["vm_name"], parser["BackupOS_ip"], ssh)
    elif FTVM.is_shutoff(parser["vm_name"], parser["BackupOS_ip"], ssh):
        FTVM.start(parser["vm_name"], parser["BackupOS_ip"], ssh)
    time.sleep(float(parser["pos_BackupOS_VM_boot_time"]))
    if not FTVM.is_running(parser["vm_name"], parser["BackupOS_ip"], ssh):
        ssh.close()
        raise TA_error.Postprocess_Error("BackupOS vm : %s can not start" %
                                         parser["vm_name"])
    ssh.close()
Exemple #30
0
def vm_shutdown(parser):
	"""
	shutdown vm
	"""
	FTVM.shutdown(parser["vm_name"], parser["HostOS_ip"])
Exemple #31
0
def vm_ftstart(parser):
	"""
	ftstart vm
	"""
	FTVM.ftstart(parser["vm_name"], parser["HostOS_ip"], parser["level"])
Exemple #32
0
def vm_start(parser):
	"""
	normaly start vm
	"""
	FTVM.start(parser["vm_name"], parser["HostOS_ip"])
def postprocess_slaveOS_vm_shutdown(parser):
    """
  	postprocess backupOS vm become shutdown

  	:called func: postprocess_backupOS_vm
  	:param parser: is a dict, get from Test config file
  	"""
    ssh = shell_server.get_ssh(parser["SlaveOS_ip"], parser["SlaveOS_usr"],
                               parser["SlaveOS_pwd"])  #獲得ssh
    if FTVM.is_running(parser["vm_name"], parser["SlaveOS_ip"], ssh):
        FTVM.destroy(parser["vm_name"], parser["SlaveOS_ip"], ssh)
        time.sleep(float(parser["pos_slaveOS_VM_shutdown_time"]))
    elif FTVM.is_paused(parser["vm_name"], parser["SlaveOS_ip"], ssh):
        FTVM.resume(parser["vm_name"], parser["SlaveOS_ip"], ssh)
        FTVM.destroy(parser["vm_name"], parser["SlaveOS_ip"], ssh)
        time.sleep(float(parser["pos_slaveOS_VM_shutdown_time"]))
    times = 0
    while times < 30:
        print "check slave os vm status"
        if FTVM.is_running(parser["vm_name"], parser["SlaveOS_ip"], ssh):
            print "destroy slave os vm "
            FTVM.destroy(parser["vm_name"], parser["SlaveOS_ip"], ssh)
            break
        time.sleep(float(1))
        times += 1
    if not FTVM.is_shutoff(parser["vm_name"], parser["SlaveOS_ip"], ssh):
        ssh.close()
        raise TA_error.Postprocess_Error("SlaveOS %s can not shutdown" %
                                         parser["vm_name"])
    ssh.close()