Esempio n. 1
0
        /// <summary>Add the volume of the passed-in directory to the list of volumes to check.
        ///     </summary>
        /// <remarks>
        /// Add the volume of the passed-in directory to the list of volumes to check.
        /// If <code>required</code> is true, and this volume is already present, but
        /// is marked redundant, it will be marked required. If the volume is already
        /// present but marked required then this method is a no-op.
        /// </remarks>
        /// <param name="directoryToCheck">The directory whose volume will be checked for available space.
        ///     </param>
        /// <exception cref="System.IO.IOException"/>
        private void AddDirToCheck(URI directoryToCheck, bool required)
        {
            FilePath dir = new FilePath(directoryToCheck.GetPath());

            if (!dir.Exists())
            {
                throw new IOException("Missing directory " + dir.GetAbsolutePath());
            }
            NameNodeResourceChecker.CheckedVolume newVolume = new NameNodeResourceChecker.CheckedVolume
                                                                  (this, dir, required);
            NameNodeResourceChecker.CheckedVolume volume = volumes[newVolume.GetVolume()];
            if (volume == null || !volume.IsRequired())
            {
                volumes[newVolume.GetVolume()] = newVolume;
            }
        }