def sync_smr_memlog(smr_base_port): puts(magenta("Sync SMR memlog. PORT:%d" % smr_base_port)) # Check memlog if exist_smr_memlog(smr_base_port) == False: warn(red("[%s] SMR memlog doesn't exist. Aborting..." % env.host_string)) return False # Sync memlog smr_log_path = util.make_smr_log_path_str(smr_base_port) if smr_logutil("synclog %s" % smr_log_path) == False: warn("[%s] Sync memlog fail. Aborting..." % env.host_string) return False return True
def exist_smr_memlog(smr_base_port): puts(magenta("Does SMR memlog exist?")) # Check smr log path smr_log_path = util.make_smr_log_path_str(smr_base_port) if path_exist(smr_log_path) == False: warn("[%s] SMR log path doesn't exist. Aborting..." % env.host_string) return False # Check memlog file_path = smr_log_path + "/" + "master-log" if exists(file_path) == True: puts("SMR memlog exists.\n") return True else: puts("SMR memlog doesn't exist.\n") return False
def remove_smr_memlog(smr_base_port): puts(magenta("Remove SMR memlog. PORT:%d" % smr_base_port)) # Chec smr log path smr_log_path = util.make_smr_log_path_str(smr_base_port) if path_exist(smr_log_path) == False: warn("[%s] SMR log path does not exist. Aborting..." % env.host_string) return False # Delete memlog if smr_logutil("deletelog %s" % smr_log_path) == False: warn("[%s] Delete memlog fail. Aborting..." % env.host_string) return False # Check memlog if exist_smr_memlog(smr_base_port) == True: warn(red("[%s] Delete smr memlog fail. Aborting...") % env.host_string) return False return True
def create_smr_memlog(smr_base_port): puts(magenta("Create SMR memlog. PORT:%d" % smr_base_port)) # Check smr log path smr_log_path = util.make_smr_log_path_str(smr_base_port) if path_exist(smr_log_path) == False: warn("[%s] SMR log path doesn't exist. Aborting..." % env.host_string) return False # Create memlog if smr_logutil("createlog %s" % smr_log_path) == False: warn("[%s] Create memlog fail. Aborting..." % env.host_string) return False # Check memlog if exist_smr_memlog(smr_base_port) == False: warn(red("[%s] Create smr memlog fail. Aborting..." % env.host_string)) return False return True