use of org.apache.hadoop.ozone.om.protocol.OMConfiguration in project ozone by apache.
the class DecommissionOMSubcommand method checkOMConfig.
/**
* Check whether the to be decommissioned node is added to the
* OZONE_OM_DECOMMISSIONED_NODES_KEY.<SERVICE_ID> config in ozone-site.xml
* of given OM.
*/
private boolean checkOMConfig(OMNodeDetails omNodeDetails) throws IOException {
try (OMAdminProtocolClientSideImpl omAdminProtocolClient = OMAdminProtocolClientSideImpl.createProxyForSingleOM(ozoneConf, user, omNodeDetails)) {
OMConfiguration omConfig = omAdminProtocolClient.getOMConfiguration();
OMNodeDetails decommNodeDetails = omConfig.getDecommissionedNodesInNewConf().get(decommNodeId);
if (decommNodeDetails == null) {
return false;
}
if (!decommNodeDetails.getRpcAddress().getAddress().equals(hostInetAddress)) {
return false;
}
}
return true;
}
use of org.apache.hadoop.ozone.om.protocol.OMConfiguration 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.om.protocol.OMConfiguration in project ozone by apache.
the class OzoneManager method checkConfigBeforeBootstrap.
private void checkConfigBeforeBootstrap() throws IOException {
List<OMNodeDetails> omsWihtoutNewConfig = new ArrayList<>();
for (Map.Entry<String, OMNodeDetails> entry : peerNodesMap.entrySet()) {
String remoteNodeId = entry.getKey();
OMNodeDetails remoteNodeDetails = entry.getValue();
try (OMAdminProtocolClientSideImpl omAdminProtocolClient = OMAdminProtocolClientSideImpl.createProxyForSingleOM(configuration, getRemoteUser(), entry.getValue())) {
OMConfiguration remoteOMConfiguration = omAdminProtocolClient.getOMConfiguration();
checkRemoteOMConfig(remoteNodeId, remoteOMConfiguration);
} catch (IOException ioe) {
LOG.error("Remote OM config check failed on OM {}", remoteNodeId, ioe);
omsWihtoutNewConfig.add(remoteNodeDetails);
}
}
if (!omsWihtoutNewConfig.isEmpty()) {
String errorMsg = OmUtils.getOMAddressListPrintString(omsWihtoutNewConfig) + " do not have or have incorrect information of the bootstrapping " + "OM. Update their ozone-site.xml before proceeding.";
exitManager.exitSystem(1, errorMsg, LOG);
}
}
Aggregations