use of org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.StartMaintenanceNodesRequestProto in project ozone by apache.
the class StorageContainerLocationProtocolClientSideTranslatorPB method startMaintenanceNodes.
/**
* Attempts to put the list of nodes into maintenance mode.
*
* @param nodes The list of hostnames or hostname:ports to put into
* maintenance
* @param endInHours A number of hours from now where the nodes will be taken
* out of maintenance automatically. Passing zero will
* allow the nodes to stay in maintenance indefinitely
* @throws IOException
*/
@Override
public List<DatanodeAdminError> startMaintenanceNodes(List<String> nodes, int endInHours) throws IOException {
Preconditions.checkNotNull(nodes);
StartMaintenanceNodesRequestProto request = StartMaintenanceNodesRequestProto.newBuilder().addAllHosts(nodes).setEndInHours(endInHours).build();
StartMaintenanceNodesResponseProto response = submitRequest(Type.StartMaintenanceNodes, builder -> builder.setStartMaintenanceNodesRequest(request)).getStartMaintenanceNodesResponse();
List<DatanodeAdminError> errors = new ArrayList<>();
for (DatanodeAdminErrorResponseProto e : response.getFailedHostsList()) {
errors.add(new DatanodeAdminError(e.getHost(), e.getError()));
}
return errors;
}
Aggregations