Skip to content

Commit

Permalink
HDDS-11794. Display HostName in OM / SCM Overview. (apache#7482)
Browse files Browse the repository at this point in the history
  • Loading branch information
slfan1989 authored Dec 4, 2024
1 parent 0bde3a2 commit 65df308
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,11 @@ public interface SCMMXBean extends ServiceRuntimeInfo {
String getRatisLogDirectory();

String getRocksDbDirectory();

/**
* Gets the SCM hostname.
*
* @return the SCM hostname for the datanode.
*/
String getHostname();
}
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
private Clock systemClock;
private DNSToSwitchMapping dnsToSwitchMapping;

private String scmHostName;

/**
* Creates a new StorageContainerManager. Configuration will be
* updated with information on the actual listening addresses used
Expand Down Expand Up @@ -456,6 +458,7 @@ private StorageContainerManager(OzoneConfiguration conf,

// Emit initial safe mode status, as now handlers are registered.
scmSafeModeManager.emitSafeModeStatus();
scmHostName = HddsUtils.getHostName(conf);

registerMXBean();
registerMetricsSource(this);
Expand Down Expand Up @@ -2223,6 +2226,11 @@ public String getRocksDbDirectory() {
return String.valueOf(ServerUtils.getScmDbDir(configuration));
}

@Override
public String getHostname() {
return scmHostName;
}

public Collection<String> getScmAdminUsernames() {
return scmAdmins.getAdminUsernames();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ public interface OMMXBean extends ServiceRuntimeInfo {

String getRocksDbDirectory();

/**
* Gets the OM hostname.
*
* @return the OM hostname for the datanode.
*/
String getHostname();
}
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,8 @@ public final class OzoneManager extends ServiceRuntimeInfoImpl

private boolean fsSnapshotEnabled;

private String omHostName;

/**
* OM Startup mode.
*/
Expand Down Expand Up @@ -733,6 +735,7 @@ private OzoneManager(OzoneConfiguration conf, StartupOption startupOption)
}

bucketUtilizationMetrics = BucketUtilizationMetrics.create(metadataManager);
omHostName = HddsUtils.getHostName(conf);
}

public boolean isStopped() {
Expand Down Expand Up @@ -3136,6 +3139,11 @@ public String getRocksDbDirectory() {
return String.valueOf(OMStorage.getOmDbDir(configuration));
}

@Override
public String getHostname() {
return omHostName;
}

@VisibleForTesting
public OzoneManagerHttpServer getHttpServer() {
return httpServer;
Expand Down

0 comments on commit 65df308

Please sign in to comment.