You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "ashishkumar50 (via GitHub)" <gi...@apache.org> on 2023/08/02 03:54:57 UTC

[GitHub] [ozone] ashishkumar50 commented on a diff in pull request #5136: HDDS-9080. om roles CLI should provide Json output option

ashishkumar50 commented on code in PR #5136:
URL: https://github.com/apache/ozone/pull/5136#discussion_r1281355529


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/GetServiceRolesSubcommand.java:
##########
@@ -76,4 +90,24 @@ private void getOmServerRoles(List<ServiceInfo> serviceList) {
       }
     }
   }
+
+  private void getOmServerRolesAsJson(List<ServiceInfo> serviceList)
+      throws IOException {
+    List<Map<String, Map<String, String>>> omServiceList = new ArrayList<>();
+    for (ServiceInfo serviceInfo : serviceList) {
+      OMRoleInfo omRoleInfo = serviceInfo.getOmRoleInfo();
+      if (omRoleInfo != null &&
+          serviceInfo.getNodeType() == HddsProtos.NodeType.OM) {
+        Map<String, Map<String, String>> omService = new HashMap<>();
+        omService.put(serviceInfo.getOmRoleInfo().getNodeId(),

Review Comment:
   ```suggestion
           omService.put(omRoleInfo.getNodeId(),
   ```



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/GetServiceRolesSubcommand.java:
##########
@@ -76,4 +90,24 @@ private void getOmServerRoles(List<ServiceInfo> serviceList) {
       }
     }
   }
+
+  private void getOmServerRolesAsJson(List<ServiceInfo> serviceList)
+      throws IOException {
+    List<Map<String, Map<String, String>>> omServiceList = new ArrayList<>();
+    for (ServiceInfo serviceInfo : serviceList) {
+      OMRoleInfo omRoleInfo = serviceInfo.getOmRoleInfo();
+      if (omRoleInfo != null &&
+          serviceInfo.getNodeType() == HddsProtos.NodeType.OM) {
+        Map<String, Map<String, String>> omService = new HashMap<>();
+        omService.put(serviceInfo.getOmRoleInfo().getNodeId(),
+            new HashMap<String, String>() {{
+              put("serverRole", serviceInfo.getOmRoleInfo().getServerRole());

Review Comment:
   ```suggestion
                 put("serverRole", omRoleInfo.getServerRole());
   ```



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org