Search in sources :

Example 1 with OMNodeInfo

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerAdminProtocolProtos.OMNodeInfo in project ozone by apache.

the class OMAdminProtocolClientSideImpl method getOMConfiguration.

@Override
public OMConfiguration getOMConfiguration() throws IOException {
    try {
        OMConfigurationResponse getConfigResponse = rpcProxy.getOMConfiguration(NULL_RPC_CONTROLLER, OMConfigurationRequest.newBuilder().build());
        OMConfiguration.Builder omMedatataBuilder = new OMConfiguration.Builder();
        if (getConfigResponse.getSuccess()) {
            if (getConfigResponse.getNodesInMemoryCount() > 0) {
                for (OMNodeInfo omNodeInfo : getConfigResponse.getNodesInMemoryList()) {
                    omMedatataBuilder.addToNodesInMemory(OMNodeDetails.getFromProtobuf(omNodeInfo));
                }
            }
            if (getConfigResponse.getNodesInNewConfCount() > 0) {
                for (OMNodeInfo omNodeInfo : getConfigResponse.getNodesInNewConfList()) {
                    omMedatataBuilder.addToNodesInNewConf(OMNodeDetails.getFromProtobuf(omNodeInfo));
                }
            }
        }
        return omMedatataBuilder.build();
    } catch (ServiceException e) {
        LOG.error("Failed to retrieve configuration of OM {}", omPrintInfo, e);
    }
    return null;
}
Also used : ServiceException(com.google.protobuf.ServiceException) OMConfigurationResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerAdminProtocolProtos.OMConfigurationResponse) OMConfiguration(org.apache.hadoop.ozone.om.protocol.OMConfiguration) OMNodeInfo(org.apache.hadoop.ozone.protocol.proto.OzoneManagerAdminProtocolProtos.OMNodeInfo)

Example 2 with OMNodeInfo

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerAdminProtocolProtos.OMNodeInfo in project ozone by apache.

the class OMAdminProtocolServerSideImpl method getOMConfiguration.

@Override
public OMConfigurationResponse getOMConfiguration(RpcController controller, OMConfigurationRequest request) throws ServiceException {
    List<OMNodeDetails> oldOMNodesList = ozoneManager.getAllOMNodesInMemory();
    List<OMNodeDetails> newOMNodesList = ozoneManager.getAllOMNodesInNewConf();
    List<OMNodeInfo> omNodesInMemory = new ArrayList<>(oldOMNodesList.size());
    for (OMNodeDetails omNodeDetails : oldOMNodesList) {
        omNodesInMemory.add(omNodeDetails.getProtobuf());
    }
    List<OMNodeInfo> omNodesInNewConf = new ArrayList<>(newOMNodesList.size());
    for (OMNodeDetails omNodeDetails : newOMNodesList) {
        omNodesInNewConf.add(omNodeDetails.getProtobuf());
    }
    return OMConfigurationResponse.newBuilder().setSuccess(true).addAllNodesInMemory(omNodesInMemory).addAllNodesInNewConf(omNodesInNewConf).build();
}
Also used : OMNodeDetails(org.apache.hadoop.ozone.om.helpers.OMNodeDetails) ArrayList(java.util.ArrayList) OMNodeInfo(org.apache.hadoop.ozone.protocol.proto.OzoneManagerAdminProtocolProtos.OMNodeInfo)

Aggregations

OMNodeInfo (org.apache.hadoop.ozone.protocol.proto.OzoneManagerAdminProtocolProtos.OMNodeInfo)2 ServiceException (com.google.protobuf.ServiceException)1 ArrayList (java.util.ArrayList)1 OMNodeDetails (org.apache.hadoop.ozone.om.helpers.OMNodeDetails)1 OMConfiguration (org.apache.hadoop.ozone.om.protocol.OMConfiguration)1 OMConfigurationResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerAdminProtocolProtos.OMConfigurationResponse)1