/** * Dynamically remove volume in the list. * @param storageLocation {@link StorageLocation} of the volume to be removed. * @param clearFailure set true to remove failure info for this volume. */ void removeVolume(StorageLocation storageLocation, boolean clearFailure) { for (FsVolumeImpl fsVolume : volumes) { StorageLocation baseLocation = fsVolume.getStorageLocation(); if (baseLocation.equals(storageLocation)) { removeVolume(fsVolume); } } if (clearFailure) { removeVolumeFailureInfo(storageLocation); } }
private void addVolumeFailureInfo(FsVolumeImpl vol) { addVolumeFailureInfo(new VolumeFailureInfo( vol.getStorageLocation(), Time.now(), vol.getCapacity())); }
/** * Dynamically add new volumes to the existing volumes that this DN manages. * * @param ref a reference to the new FsVolumeImpl instance. */ void addVolume(FsVolumeReference ref) { FsVolumeImpl volume = (FsVolumeImpl) ref.getVolume(); volumes.add(volume); if (blockScanner != null) { blockScanner.addVolumeScanner(ref); } else { // If the volume is not put into a volume scanner, it does not need to // hold the reference. IOUtils.cleanup(null, ref); } // If the volume is used to replace a failed volume, it needs to reset the // volume failure info for this volume. removeVolumeFailureInfo(volume.getStorageLocation()); FsDatasetImpl.LOG.info("Added new volume: " + volume.getStorageID()); }