/** * Get next volume. * * @param blockSize free space needed on the volume * @param storageType the desired {@link StorageType} * @param storageId the storage id which may or may not be used by * the VolumeChoosingPolicy. * @return next volume to store the block in. */ FsVolumeReference getNextVolume(StorageType storageType, String storageId, long blockSize) throws IOException { final List<FsVolumeImpl> list = new ArrayList<>(volumes.size()); for(FsVolumeImpl v : volumes) { if (v.getStorageType() == storageType) { list.add(v); } } return chooseVolume(list, blockSize, storageId); }
VolumeInfo(FsVolumeImpl v, long usedSpace, long freeSpace) { this.directory = v.toString(); this.usedSpace = usedSpace; this.freeSpace = freeSpace; this.reservedSpace = v.getReserved(); this.reservedSpaceForReplicas = v.getReservedForReplicas(); this.numBlocks = v.getNumBlocks(); this.storageType = v.getStorageType(); } }
/** * Get next volume. * * @param blockSize free space needed on the volume * @param storageType the desired {@link StorageType} * @return next volume to store the block in. */ FsVolumeReference getNextVolume(StorageType storageType, long blockSize) throws IOException { // Get a snapshot of currently available volumes. final FsVolumeImpl[] curVolumes = volumes.get(); final List<FsVolumeImpl> list = new ArrayList<>(curVolumes.length); for(FsVolumeImpl v : curVolumes) { if (v.getStorageType() == storageType) { list.add(v); } } return chooseVolume(list, blockSize); }
/** * Get next volume. * * @param blockSize free space needed on the volume * @param storageType the desired {@link StorageType} * @return next volume to store the block in. */ FsVolumeReference getNextVolume(StorageType storageType, long blockSize) throws IOException { // Get a snapshot of currently available volumes. final FsVolumeImpl[] curVolumes = volumes.get(); final List<FsVolumeImpl> list = new ArrayList<>(curVolumes.length); for(FsVolumeImpl v : curVolumes) { if (v.getStorageType() == storageType) { list.add(v); } } return chooseVolume(list, blockSize); }
private void setVolumeFull(DataNode dn, StorageType type) { List<? extends FsVolumeSpi> volumes = dn.getFSDataset().getVolumes(); for (FsVolumeSpi v : volumes) { FsVolumeImpl volume = (FsVolumeImpl) v; if (volume.getStorageType() == type) { LOG.info("setCapacity to 0 for [" + volume.getStorageType() + "]" + volume.getStorageID()); volume.setCapacityForTesting(0); } } }
/** * Stores the information related to a namenode in the cluster */ public static class NameNodeInfo { final NameNode nameNode; final Configuration conf; final String nameserviceId; final String nnId; StartupOption startOpt; NameNodeInfo(NameNode nn, String nameserviceId, String nnId, StartupOption startOpt, Configuration conf) { this.nameNode = nn; this.nameserviceId = nameserviceId; this.nnId = nnId; this.startOpt = startOpt; this.conf = conf; } public void setStartOpt(StartupOption startOpt) { this.startOpt = startOpt; } }