octachoron commented on code in PR #9611:
URL: https://github.com/apache/ozone/pull/9611#discussion_r2684386988


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/StorageContainerLocationProtocolClientSideTranslatorPB.java:
##########
@@ -870,6 +874,50 @@ public boolean forceExitSafeMode() throws IOException {
 
   }
 
+  @Override
+  public boolean inSafeModeForNode(String nodeId) throws IOException {
+    InSafeModeRequestProto request = 
InSafeModeRequestProto.getDefaultInstance();
+
+    try {
+      StorageContainerLocationProtocolPB proxy = fpp.getProxyForNode(nodeId);
+      ScmContainerLocationRequest wrapper = 
ScmContainerLocationRequest.newBuilder()
+          .setCmdType(Type.InSafeMode)
+          .setVersion(ClientVersion.CURRENT_VERSION)
+          .setTraceID(TracingUtil.exportCurrentSpan())
+          .setInSafeModeRequest(request)
+          .build();
+      ScmContainerLocationResponse response = 
proxy.submitRequest(NULL_RPC_CONTROLLER, wrapper);
+      return response.getInSafeModeResponse().getInSafeMode();
+    } catch (Exception e) {
+      throw new IOException("Failed to get safe mode status from SCM node " + 
nodeId, e);
+    }
+  }
+
+  @Override
+  public Map<String, Pair<Boolean, String>> 
getSafeModeRuleStatusesForNode(String nodeId) throws IOException {
+    GetSafeModeRuleStatusesRequestProto request = 
GetSafeModeRuleStatusesRequestProto.getDefaultInstance();
+
+    try {
+      StorageContainerLocationProtocolPB proxy = fpp.getProxyForNode(nodeId);
+      ScmContainerLocationRequest wrapper = 
ScmContainerLocationRequest.newBuilder()
+          .setCmdType(Type.GetSafeModeRuleStatuses)
+          .setVersion(ClientVersion.CURRENT_VERSION)
+          .setTraceID(TracingUtil.exportCurrentSpan())
+          .setGetSafeModeRuleStatusesRequest(request)
+          .build();
+      ScmContainerLocationResponse response = 
proxy.submitRequest(NULL_RPC_CONTROLLER, wrapper);

Review Comment:
   I think we have achieved exactly what we wanted to here. Thanks for the 
refactor!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to