コード例 #1
0
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()
コード例 #2
0
ファイル: postprocess.py プロジェクト: vaporting/FTVM_TA
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"])
コード例 #3
0
ファイル: preprocess.py プロジェクト: vaporting/FTVM_TA
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"])
コード例 #4
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()