Пример #1
0
def postprocess_hostOS_OS(parser):
	"""
	postprocess hostOS OS
	"""
	if parser["pos_hostOS_shutdown"] == "yes":
		if mmsh.statehost(parser["HostOS_name"]) != "shutdown":
			mmsh.stophost(parser["HostOS_name"])
			time.sleep(float(parser["pos_hostOS_shutdown_time"]))
	if mmsh.statehost(parser["HostOS_name"]) != "shutdown":
		raise TA_error.Postprocess_Error("HostOS can not shutdown")
Пример #2
0
def get_OS_status(OS_name):
	"""
	get OS status

	status : running / shutdown / initializing
	"""
	return mmsh.statehost(OS_name).rstrip()
Пример #3
0
def postprocess_hostOS_OS(parser):
    """
	postprocess hostOS OS part

	:called func: postprocess_hostOS
	:param parser: is a dict, get from Test config file
	"""
    if parser["pos_hostOS_shutdown"] == "yes":  #若pos_hostOS_shutdown為yes則進入
        if mmsh.statehost(
                parser["PrimaryOS_name"]
        ) != "shutdown":  #詢問mmsh,vm所在host的狀態,若不為shutdown 則進行關機之動作
            mmsh.stophost(parser["PrimaryOS_name"])
            time.sleep(float(parser["pos_hostOS_shutdown_time"]))
    if mmsh.statehost(parser["PrimaryOS_name"]
                      ) != "shutdown":  #若狀態不為shutdown則raise exception
        raise TA_error.Postprocess_Error("PrimaryOS can not shutdown")
Пример #4
0
def get_OS_status(OS_name):
	"""
	get OS status

	status : running / shutdown / initializing
	:param os_name: host OS name
	:return status : running / shutdown / initializing
	"""
	return mmsh.statehost(OS_name).rstrip()
Пример #5
0
def detect_primaryOS_crash(parser):
    ssh = shell_server.get_ssh(parser["BackupOS_ip"], parser["BackupOS_usr"],
                               parser["BackupOS_pwd"])  #獲得ssh
    if mmsh.statehost(
            parser["PrimaryOS_name"], ssh
    ) == "shutdown":  #若回傳之狀態是hardware shutdown,則test oracle通過,否則raise exception
        ssh.close()
        return True
    ssh.close()
    raise TA_error.Assert_Error(
        "Host (name : %s) has not detect host os crash " %
        parser["PrimaryOS_name"])
Пример #6
0
def hostOS_status_is_running(parser):
    """
	hostOS status is running or not
	:param parser: config 
	:return: True/raise exception
	"""
    if "ast_hostOS_running_wait_time" in parser.keys(
    ):  #若參數ast_hostOS_running_wait_time存在於parser,則進入
        time.sleep(int(parser["ast_hostOS_running_wait_time"]))
    #print mmsh.statehost(parser["PrimaryOS_name"])
    if mmsh.statehost(
            parser["PrimaryOS_name"]
    ) == "running":  #若回傳之狀態是running,則test oracle通過,否則raise exception
        return True
    raise TA_error.Assert_Error("Host (name : %s) status is not running" %
                                parser["PrimaryOS_name"])