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()
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"])
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"])