def destroy_ram_fs( node_index ) : (mount_target,log_dir,tlf_dir,head_dir) = build_node_dir_names( node_names[node_index] ) if os.path.isdir(mount_target) and os.path.ismount(mount_target): cmd = ["sudo", "/bin/umount", mount_target] (rc,out,err) = X.run(cmd) if rc: raise Exception("cmd:%s failed (%s,%s,%s)" % (str(cmd), rc,out,err))
def mount_ram_fs ( node_index ) : (mount_target,log_dir,tlf_dir,head_dir) = Common.build_node_dir_names( Common.node_names[node_index] ) if X.fileExists( mount_target ) : Common.stopOne( Common.node_names[node_index] ) cmd = ["umount", mount_target] X.subprocess.check_call ( cmd ) X.removeDirTree( mount_target ) X.createDir ( mount_target ) if not os.path.isdir( mount_target ) : raise Exception( "%s is not valid mount target as it is not a directory") cmd = ["sudo", "mount", "-t", "tmpfs","-o","size=20m","tmpfs", mount_target] (rc,out,err) = X.run(cmd) if rc: logging.info("out=%s", out) logging.info("err = %s", err) raise Exception("Mounting failed (rc=%s)" % rc)