Search in sources :

Example 1 with StorageDirType

use of org.apache.hadoop.hdfs.server.common.Storage.StorageDirType in project hadoop by apache.

the class FSNamesystem method getNameDirStatuses.

// NameNodeMXBean
@Override
public String getNameDirStatuses() {
    Map<String, Map<File, StorageDirType>> statusMap = new HashMap<String, Map<File, StorageDirType>>();
    Map<File, StorageDirType> activeDirs = new HashMap<File, StorageDirType>();
    for (Iterator<StorageDirectory> it = getFSImage().getStorage().dirIterator(); it.hasNext(); ) {
        StorageDirectory st = it.next();
        activeDirs.put(st.getRoot(), st.getStorageDirType());
    }
    statusMap.put("active", activeDirs);
    List<Storage.StorageDirectory> removedStorageDirs = getFSImage().getStorage().getRemovedStorageDirs();
    Map<File, StorageDirType> failedDirs = new HashMap<File, StorageDirType>();
    for (StorageDirectory st : removedStorageDirs) {
        failedDirs.put(st.getRoot(), st.getStorageDirType());
    }
    statusMap.put("failed", failedDirs);
    return JSON.toString(statusMap);
}
Also used : HashMap(java.util.HashMap) StorageDirType(org.apache.hadoop.hdfs.server.common.Storage.StorageDirType) StorageDirectory(org.apache.hadoop.hdfs.server.common.Storage.StorageDirectory) NameNodeFile(org.apache.hadoop.hdfs.server.namenode.NNStorage.NameNodeFile) File(java.io.File) Map(java.util.Map) TreeMap(java.util.TreeMap) ImmutableMap(com.google.common.collect.ImmutableMap) HashMap(java.util.HashMap)

Aggregations

ImmutableMap (com.google.common.collect.ImmutableMap)1 File (java.io.File)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 StorageDirType (org.apache.hadoop.hdfs.server.common.Storage.StorageDirType)1 StorageDirectory (org.apache.hadoop.hdfs.server.common.Storage.StorageDirectory)1 NameNodeFile (org.apache.hadoop.hdfs.server.namenode.NNStorage.NameNodeFile)1