Search in sources :

Example 1 with Result

use of org.apache.hadoop.hdfs.server.datanode.DiskBalancerWorkStatus.Result in project hadoop by apache.

the class ClientDatanodeProtocolTranslatorPB method queryDiskBalancerPlan.

/**
   * Gets the status of an executing diskbalancer Plan.
   */
@Override
public DiskBalancerWorkStatus queryDiskBalancerPlan() throws IOException {
    try {
        QueryPlanStatusRequestProto request = QueryPlanStatusRequestProto.newBuilder().build();
        QueryPlanStatusResponseProto response = rpcProxy.queryDiskBalancerPlan(NULL_CONTROLLER, request);
        DiskBalancerWorkStatus.Result result = Result.NO_PLAN;
        if (response.hasResult()) {
            result = DiskBalancerWorkStatus.Result.values()[response.getResult()];
        }
        return new DiskBalancerWorkStatus(result, response.hasPlanID() ? response.getPlanID() : null, response.hasPlanFile() ? response.getPlanFile() : null, response.hasCurrentStatus() ? response.getCurrentStatus() : null);
    } catch (ServiceException e) {
        throw ProtobufHelper.getRemoteException(e);
    }
}
Also used : Result(org.apache.hadoop.hdfs.server.datanode.DiskBalancerWorkStatus.Result) ServiceException(com.google.protobuf.ServiceException) QueryPlanStatusRequestProto(org.apache.hadoop.hdfs.protocol.proto.ClientDatanodeProtocolProtos.QueryPlanStatusRequestProto) DiskBalancerWorkStatus(org.apache.hadoop.hdfs.server.datanode.DiskBalancerWorkStatus) QueryPlanStatusResponseProto(org.apache.hadoop.hdfs.protocol.proto.ClientDatanodeProtocolProtos.QueryPlanStatusResponseProto)

Aggregations

ServiceException (com.google.protobuf.ServiceException)1 QueryPlanStatusRequestProto (org.apache.hadoop.hdfs.protocol.proto.ClientDatanodeProtocolProtos.QueryPlanStatusRequestProto)1 QueryPlanStatusResponseProto (org.apache.hadoop.hdfs.protocol.proto.ClientDatanodeProtocolProtos.QueryPlanStatusResponseProto)1 DiskBalancerWorkStatus (org.apache.hadoop.hdfs.server.datanode.DiskBalancerWorkStatus)1 Result (org.apache.hadoop.hdfs.server.datanode.DiskBalancerWorkStatus.Result)1