예제 #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"])
예제 #2
0
def postprocess_hostOS_vm_running(parser):
	"""
	postrocess vm become running
	"""
	if FTVM.is_running(parser["vm_name"], parser["HostOS_ip"]):
		FTVM.restart(parser["vm_name"], parser["HostOS_ip"])
	elif FTVM.is_shutoff(parser["vm_name"], parser["HostOS_ip"]):
		FTVM.start(parser["vm_name"], parser["HostOS_ip"])
	time.sleep(float(parser["pos_hostOS_VM_boot_time"]))
	if not FTVM.is_running(parser["vm_name"], parser["HostOS_ip"]):
		raise TA_error.Postprocess_Error("HostOS %s can not start" % parser["vm_name"])
예제 #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()
예제 #4
0
def vm_start(parser):
    """
	normaly start 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.start(parser["vm_name"], parser["PrimaryOS_ip"], ssh)

    ssh.close()
예제 #5
0
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()
예제 #6
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()
예제 #7
0
def vm_start(parser):
	"""
	normaly start vm
	"""
	FTVM.start(parser["vm_name"], parser["HostOS_ip"])