use of org.apache.hadoop.hdfs.server.protocol.DatanodeStorageReport in project hadoop by apache.
the class Mover method init.
void init() throws IOException {
initStoragePolicies();
final List<DatanodeStorageReport> reports = dispatcher.init();
for (DatanodeStorageReport r : reports) {
final DDatanode dn = dispatcher.newDatanode(r.getDatanodeInfo());
for (StorageType t : StorageType.getMovableTypes()) {
final Source source = dn.addSource(t, Long.MAX_VALUE, dispatcher);
final long maxRemaining = getMaxRemaining(r, t);
final StorageGroup target = maxRemaining > 0L ? dn.addTarget(t, maxRemaining) : null;
storages.add(source, target);
}
}
}
use of org.apache.hadoop.hdfs.server.protocol.DatanodeStorageReport in project hadoop by apache.
the class DBNameNodeConnector method getNodes.
/**
* getNodes function returns a list of DiskBalancerDataNodes.
*
* @return Array of DiskBalancerDataNodes
*/
@Override
public List<DiskBalancerDataNode> getNodes() throws Exception {
Preconditions.checkNotNull(this.connector);
List<DiskBalancerDataNode> nodeList = new LinkedList<>();
DatanodeStorageReport[] reports = this.connector.getLiveDatanodeStorageReport();
for (DatanodeStorageReport report : reports) {
DiskBalancerDataNode datanode = getBalancerNodeFromDataNode(report.getDatanodeInfo());
getVolumeInfoFromStorageReports(datanode, report.getStorageReports());
nodeList.add(datanode);
}
return nodeList;
}
use of org.apache.hadoop.hdfs.server.protocol.DatanodeStorageReport in project hadoop by apache.
the class FSNamesystem method getDatanodeStorageReport.
DatanodeStorageReport[] getDatanodeStorageReport(final DatanodeReportType type) throws AccessControlException, StandbyException {
checkSuperuserPrivilege();
checkOperation(OperationCategory.UNCHECKED);
readLock();
try {
checkOperation(OperationCategory.UNCHECKED);
final DatanodeManager dm = getBlockManager().getDatanodeManager();
final List<DatanodeDescriptor> datanodes = dm.getDatanodeListForReport(type);
DatanodeStorageReport[] reports = new DatanodeStorageReport[datanodes.size()];
for (int i = 0; i < reports.length; i++) {
final DatanodeDescriptor d = datanodes.get(i);
reports[i] = new DatanodeStorageReport(new DatanodeInfoBuilder().setFrom(d).build(), d.getStorageReports());
}
return reports;
} finally {
readUnlock("getDatanodeStorageReport");
}
}
Aggregations