Exemplo n.º 1
0
def prepocess_hostOS_vm_start(parser):
    """
  according to fault tolerant level, preprocess vm start
  """
    if parser["level"] == "0":
        FTVM.start(parser["vm_name"], parser["HostOS_ip"])
    else:
        FTVM.ftstart(parser["vm_name"], parser["HostOS_ip"], parser["level"])
Exemplo n.º 2
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()
Exemplo n.º 3
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()
Exemplo n.º 4
0
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()
Exemplo n.º 5
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"])
Exemplo n.º 6
0
def vm_ftstart(parser):
	"""
	ftstart vm
	"""
	FTVM.ftstart(parser["vm_name"], parser["HostOS_ip"], parser["level"])