Search in sources :

Example 6 with DatanodeStorageReport

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);
        }
    }
}
Also used : StorageGroup(org.apache.hadoop.hdfs.server.balancer.Dispatcher.DDatanode.StorageGroup) StorageType(org.apache.hadoop.fs.StorageType) DatanodeStorageReport(org.apache.hadoop.hdfs.server.protocol.DatanodeStorageReport)

Example 7 with DatanodeStorageReport

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;
}
Also used : DatanodeStorageReport(org.apache.hadoop.hdfs.server.protocol.DatanodeStorageReport) LinkedList(java.util.LinkedList) DiskBalancerDataNode(org.apache.hadoop.hdfs.server.diskbalancer.datamodel.DiskBalancerDataNode)

Example 8 with DatanodeStorageReport

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");
    }
}
Also used : DatanodeDescriptor(org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor) DatanodeManager(org.apache.hadoop.hdfs.server.blockmanagement.DatanodeManager) DatanodeInfoBuilder(org.apache.hadoop.hdfs.protocol.DatanodeInfo.DatanodeInfoBuilder) DatanodeStorageReport(org.apache.hadoop.hdfs.server.protocol.DatanodeStorageReport)

Aggregations

DatanodeStorageReport (org.apache.hadoop.hdfs.server.protocol.DatanodeStorageReport)8 StorageType (org.apache.hadoop.fs.StorageType)3 DatanodeInfo (org.apache.hadoop.hdfs.protocol.DatanodeInfo)2 StorageGroup (org.apache.hadoop.hdfs.server.balancer.Dispatcher.DDatanode.StorageGroup)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 DatanodeInfoBuilder (org.apache.hadoop.hdfs.protocol.DatanodeInfo.DatanodeInfoBuilder)1 Dispatcher (org.apache.hadoop.hdfs.server.balancer.Dispatcher)1 DDatanode (org.apache.hadoop.hdfs.server.balancer.Dispatcher.DDatanode)1 Source (org.apache.hadoop.hdfs.server.balancer.Dispatcher.Source)1 DatanodeDescriptor (org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor)1 DatanodeManager (org.apache.hadoop.hdfs.server.blockmanagement.DatanodeManager)1 DataNode (org.apache.hadoop.hdfs.server.datanode.DataNode)1 DiskBalancerDataNode (org.apache.hadoop.hdfs.server.diskbalancer.datamodel.DiskBalancerDataNode)1 StorageReport (org.apache.hadoop.hdfs.server.protocol.StorageReport)1