public static void writeSnapshotInfo(SnapshotDescription snapshot, Path workingDir, FileSystem fs)
    throws IOException {
    FsPermission perms =
      CommonFSUtils.getFilePermissions(fs, fs.getConf(), HConstants.DATA_FILE_UMASK_KEY);
    Path snapshotInfo = new Path(workingDir, SnapshotDescriptionUtils.SNAPSHOTINFO_FILE);
    try (FSDataOutputStream out = CommonFSUtils.create(fs, snapshotInfo, perms, true)) {
      snapshot.writeTo(out);
    } catch (IOException e) {
      // if we get an exception, try to remove the snapshot info
      if (!fs.delete(snapshotInfo, false)) {
        String msg = "Couldn't delete snapshot info file: " + snapshotInfo;
        LOG.error(msg);
        throw new IOException(msg);
      }
    }
  }
Write the snapshot description into the working directory of a snapshot
@param snapshot   description of the snapshot being taken
@param workingDir working directory of the snapshot
@param fs         {@link FileSystem} on which the snapshot should be taken
@throws IOException if we can't reach the filesystem and the file cannot be cleaned up on
                    failure
hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDescriptionUtils.java