Search in sources :

Example 1 with OMConfigurationResponse

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerAdminProtocolProtos.OMConfigurationResponse 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)

Aggregations

ServiceException (com.google.protobuf.ServiceException)1 OMConfiguration (org.apache.hadoop.ozone.om.protocol.OMConfiguration)1 OMConfigurationResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerAdminProtocolProtos.OMConfigurationResponse)1 OMNodeInfo (org.apache.hadoop.ozone.protocol.proto.OzoneManagerAdminProtocolProtos.OMNodeInfo)1