Search in sources :

Example 1 with OMConfiguration

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;
}
Also used : OMAdminProtocolClientSideImpl(org.apache.hadoop.ozone.om.protocolPB.OMAdminProtocolClientSideImpl) OMNodeDetails(org.apache.hadoop.ozone.om.helpers.OMNodeDetails) OMConfiguration(org.apache.hadoop.ozone.om.protocol.OMConfiguration)

Example 2 with OMConfiguration

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;
}
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 3 with OMConfiguration

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);
    }
}
Also used : OMAdminProtocolClientSideImpl(org.apache.hadoop.ozone.om.protocolPB.OMAdminProtocolClientSideImpl) OMNodeDetails(org.apache.hadoop.ozone.om.helpers.OMNodeDetails) OMConfiguration(org.apache.hadoop.ozone.om.protocol.OMConfiguration) ArrayList(java.util.ArrayList) CertificateSignRequest.getEncodedString(org.apache.hadoop.hdds.security.x509.certificates.utils.CertificateSignRequest.getEncodedString) IOException(java.io.IOException) UncheckedIOException(java.io.UncheckedIOException) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap)

Aggregations

OMConfiguration (org.apache.hadoop.ozone.om.protocol.OMConfiguration)3 OMNodeDetails (org.apache.hadoop.ozone.om.helpers.OMNodeDetails)2 OMAdminProtocolClientSideImpl (org.apache.hadoop.ozone.om.protocolPB.OMAdminProtocolClientSideImpl)2 ServiceException (com.google.protobuf.ServiceException)1 IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 CertificateSignRequest.getEncodedString (org.apache.hadoop.hdds.security.x509.certificates.utils.CertificateSignRequest.getEncodedString)1 OMConfigurationResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerAdminProtocolProtos.OMConfigurationResponse)1 OMNodeInfo (org.apache.hadoop.ozone.protocol.proto.OzoneManagerAdminProtocolProtos.OMNodeInfo)1