This is an automated email from the ASF dual-hosted git repository.
zitadombi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new dd431cde68 HDDS-9303. Display leader in table and highlight current
node in OM web UI (#5311)
dd431cde68 is described below
commit dd431cde6856f8775af753f03109215883169435
Author: Smita <[email protected]>
AuthorDate: Wed Dec 6 17:33:15 2023 +0530
HDDS-9303. Display leader in table and highlight current node in OM web UI
(#5311)
---
.../src/main/resources/webapps/static/ozone.css | 4 +++
.../main/java/org/apache/hadoop/ozone/OmUtils.java | 36 ++++++++--------------
.../java/org/apache/hadoop/ozone/om/OMMXBean.java | 3 +-
.../org/apache/hadoop/ozone/om/OzoneManager.java | 16 +++++++---
.../webapps/ozoneManager/om-overview.html | 34 +++++++++++++++++---
5 files changed, 61 insertions(+), 32 deletions(-)
diff --git a/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.css
b/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.css
index 8b5ae508e4..373626e026 100644
--- a/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.css
+++ b/hadoop-hdds/framework/src/main/resources/webapps/static/ozone.css
@@ -87,3 +87,7 @@ body {
word-wrap: break-word;
table-layout: fixed;
}
+
+.om-roles-background {
+ background-color: #dcfbcd!important;
+}
diff --git
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java
index f5cddf6669..babeb30548 100644
--- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java
+++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java
@@ -813,39 +813,29 @@ public final class OmUtils {
public static boolean isBucketSnapshotIndicator(String key) {
return key.startsWith(OM_SNAPSHOT_INDICATOR) && key.split("/").length == 2;
}
-
- public static String format(List<ServiceInfo> nodes, int port,
- String leaderId) {
- StringBuilder sb = new StringBuilder();
+
+ public static List<List<String>> format(
+ List<ServiceInfo> nodes, int port, String leaderId) {
+ List<List<String>> omInfoList = new ArrayList<>();
// Ensuring OM's are printed in correct order
List<ServiceInfo> omNodes = nodes.stream()
.filter(node -> node.getNodeType() == HddsProtos.NodeType.OM)
.sorted(Comparator.comparing(ServiceInfo::getHostname))
.collect(Collectors.toList());
- int count = 0;
for (ServiceInfo info : omNodes) {
// Printing only the OM's running
if (info.getNodeType() == HddsProtos.NodeType.OM) {
- String role =
- info.getOmRoleInfo().getNodeId().equals(leaderId) ? "LEADER" :
- "FOLLOWER";
- sb.append(
- String.format(
- " { HostName: %s | Node-Id: %s | Ratis-Port : %d | Role: %s} ",
- info.getHostname(),
- info.getOmRoleInfo().getNodeId(),
- port,
- role
- ));
- count++;
+ String role = info.getOmRoleInfo().getNodeId().equals(leaderId)
+ ? "LEADER" : "FOLLOWER";
+ List<String> omInfo = new ArrayList<>();
+ omInfo.add(info.getHostname());
+ omInfo.add(info.getOmRoleInfo().getNodeId());
+ omInfo.add(String.valueOf(port));
+ omInfo.add(role);
+ omInfoList.add(omInfo);
}
}
- // Print Stand-alone if only one OM exists
- if (count == 1) {
- return "STANDALONE";
- } else {
- return sb.toString();
- }
+ return omInfoList;
}
/**
diff --git
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMXBean.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMXBean.java
index 791379bdc8..54e81f8825 100644
---
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMXBean.java
+++
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMXBean.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.ozone.om;
import org.apache.hadoop.hdds.annotation.InterfaceAudience;
import org.apache.hadoop.hdds.server.ServiceRuntimeInfo;
+import java.util.List;
/**
* This is the JMX management interface for OM information.
@@ -29,7 +30,7 @@ public interface OMMXBean extends ServiceRuntimeInfo {
String getRpcPort();
- String getRatisRoles();
+ List<List<String>> getRatisRoles();
String getRatisLogDirectory();
diff --git
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
index 5fb3872d88..b2ddec9585 100644
---
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
+++
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
@@ -3027,8 +3027,10 @@ public final class OzoneManager extends
ServiceRuntimeInfoImpl
}
@Override
- public String getRatisRoles() {
+ public List<List<String>> getRatisRoles() {
List<ServiceInfo> serviceList;
+ List<List<String>> resultList = new ArrayList<>();
+ List<String> messageException = new ArrayList<>();
int port = omNodeDetails.getRatisPort();
RaftPeer leaderId;
if (isRatisEnabled) {
@@ -3036,16 +3038,22 @@ public final class OzoneManager extends
ServiceRuntimeInfoImpl
leaderId = omRatisServer.getLeader();
if (leaderId == null) {
LOG.error("No leader found");
- return "Exception: Not a leader";
+ messageException.add("Exception: Not a Leader");
+ resultList.add(messageException);
+ return resultList;
}
serviceList = getServiceList();
} catch (IOException e) {
LOG.error("IO-Exception Occurred", e);
- return "Exception: " + e;
+ messageException.add("IO-Exception Occurred, " + e.getMessage());
+ resultList.add(messageException);
+ return resultList;
}
return OmUtils.format(serviceList, port, leaderId.getId().toString());
} else {
- return "Ratis-Disabled";
+ messageException.add("Ratis Disabled");
+ resultList.add(messageException);
+ return resultList;
}
}
diff --git
a/hadoop-ozone/ozone-manager/src/main/resources/webapps/ozoneManager/om-overview.html
b/hadoop-ozone/ozone-manager/src/main/resources/webapps/ozoneManager/om-overview.html
index 3e2eb17099..7a1aa67d82 100644
---
a/hadoop-ozone/ozone-manager/src/main/resources/webapps/ozoneManager/om-overview.html
+++
b/hadoop-ozone/ozone-manager/src/main/resources/webapps/ozoneManager/om-overview.html
@@ -26,10 +26,6 @@
<td>OM Id</td>
<td>{{$ctrl.role.Id}}</td>
</tr>
- <tr>
- <td>OM Roles (HA) </td>
- <td>{{$ctrl.overview.jmx.RatisRoles}}</td>
- </tr>
<tr>
<td>Current-Role</td>
<td>{{$ctrl.role.Role}}</td>
@@ -49,6 +45,36 @@
</tbody>
</table>
+<h2>OM Roles (HA)</h2>
+<h4 ng-show="$ctrl.overview.jmx.RatisRoles.length == 1 &&
$ctrl.overview.jmx.RatisRoles[0].length ==
1">{{$ctrl.overview.jmx.RatisRoles[0][0]}}</h4>
+<div ng-show="$ctrl.overview.jmx.RatisRoles.length > 1">
+ <table class="table table-striped table-bordered" class="col-md-6">
+ <thead>
+ <tr>
+ <th>Host Name</th>
+ <th>Node ID</th>
+ <th>Ratis Port</th>
+ <th>Role</th>
+ </tr>
+ </thead>
+ <tbody ng-repeat="roles in $ctrl.overview.jmx.RatisRoles">
+ <tr class="om-roles-background" ng-if="$ctrl.role.Id == roles[1]">
+ <td>{{roles[0]}}</td>
+ <td>{{roles[1]}}</td>
+ <td>{{roles[2]}}</td>
+ <td>{{roles[3]}}</td>
+ </tr>
+ <tr ng-if="$ctrl.role.Id != roles[1]">
+ <td>{{roles[0]}}</td>
+ <td>{{roles[1]}}</td>
+ <td>{{roles[2]}}</td>
+ <td>{{roles[3]}}</td>
+ </tr>
+ </tbody>
+ </table>
+</div>
+
+
<h2>Meta-Data Volume Information</h2>
<table class="table table-bordered table-striped" class="col-md-6">
<tbody>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]