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;
}
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();
}
Aggregations