/// <summary>Create empty block pool directories</summary>
 /// <returns>array of block pool directories</returns>
 /// <exception cref="System.IO.IOException"/>
 public static string[] CreateEmptyBPDirs(string[] baseDirs, string bpid)
 {
     string[] bpDirs = new string[baseDirs.Length];
     for (int i = 0; i < baseDirs.Length; i++)
     {
         bpDirs[i] = MiniDFSCluster.GetBPDir(new FilePath(baseDirs[i]), bpid);
     }
     CreateEmptyDirs(bpDirs);
     return(bpDirs);
 }
        /// <summary>
        /// Simulate the
        /// <see cref="DFSConfigKeys.DfsDatanodeDataDirKey"/>
        /// of a
        /// populated DFS filesystem.
        /// This method populates for each parent directory, <code>parent/dirName</code>
        /// with the content of block pool storage directory that comes from a singleton
        /// datanode master (that contains version and block files). If the destination
        /// directory does not exist, it will be created.  If the directory already
        /// exists, it will first be deleted.
        /// </summary>
        /// <param name="parents">
        /// parent directory where
        /// <paramref name="dirName"/>
        /// is created
        /// </param>
        /// <param name="dirName">directory under which storage directory is created</param>
        /// <param name="bpid">block pool id for which the storage directory is created.</param>
        /// <returns>the array of created directories</returns>
        /// <exception cref="System.Exception"/>
        public static FilePath[] CreateBlockPoolStorageDirs(string[] parents, string dirName
                                                            , string bpid)
        {
            FilePath[] retVal   = new FilePath[parents.Length];
            Path       bpCurDir = new Path(MiniDFSCluster.GetBPDir(datanodeStorage, bpid, Storage.StorageDirCurrent
                                                                   ));

            for (int i = 0; i < parents.Length; i++)
            {
                FilePath newDir = new FilePath(parents[i] + "/current/" + bpid, dirName);
                CreateEmptyDirs(new string[] { newDir.ToString() });
                LocalFileSystem localFS = FileSystem.GetLocal(new HdfsConfiguration());
                localFS.CopyToLocalFile(bpCurDir, new Path(newDir.ToString()), false);
                retVal[i] = newDir;
            }
            return(retVal);
        }