Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.hadoop.ozone.recon.api;

import org.apache.hadoop.hdds.protocol.DatanodeDetails;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeOperationalState;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeState;
import org.apache.hadoop.hdds.scm.container.placement.metrics.SCMNodeStat;
import org.apache.hadoop.hdds.scm.node.states.NodeNotFoundException;
Expand Down Expand Up @@ -85,6 +86,7 @@ public Response getDatanodes() {
} catch (NodeNotFoundException e) {
LOG.warn("Cannot get nodeState for datanode {}", datanode, e);
}
final NodeOperationalState nodeOpState = datanode.getPersistedOpState();
String hostname = datanode.getHostName();
Set<PipelineID> pipelineIDs = nodeManager.getPipelines(datanode);
List<DatanodePipeline> pipelines = new ArrayList<>();
Expand Down Expand Up @@ -123,6 +125,7 @@ public Response getDatanodes() {
.withDatanodeStorageReport(storageReport)
.withLastHeartbeat(nodeManager.getLastHeartbeat(datanode))
.withState(nodeState)
.withOperationalState(nodeOpState)
.withPipelines(pipelines)
.withLeaderCount(leaderCount.get())
.withUUid(datanode.getUuidString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.hadoop.ozone.recon.api.types;

import com.google.common.base.Preconditions;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeOperationalState;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeState;

import javax.xml.bind.annotation.XmlAccessType;
Expand All @@ -40,6 +41,9 @@ public final class DatanodeMetadata {
@XmlElement(name = "state")
private NodeState state;

@XmlElement(name = "opState")
private NodeOperationalState opState;

@XmlElement(name = "lastHeartbeat")
private long lastHeartbeat;

Expand Down Expand Up @@ -71,6 +75,7 @@ private DatanodeMetadata(Builder builder) {
this.hostname = builder.hostname;
this.uuid = builder.uuid;
this.state = builder.state;
this.opState = builder.opState;
this.lastHeartbeat = builder.lastHeartbeat;
this.datanodeStorageReport = builder.datanodeStorageReport;
this.pipelines = builder.pipelines;
Expand All @@ -90,6 +95,10 @@ public NodeState getState() {
return state;
}

public NodeOperationalState getOperationalState() {
return opState;
}

public long getLastHeartbeat() {
return lastHeartbeat;
}
Expand Down Expand Up @@ -147,6 +156,7 @@ public static final class Builder {
private String hostname;
private String uuid;
private NodeState state;
private NodeOperationalState opState;
private long lastHeartbeat;
private DatanodeStorageReport datanodeStorageReport;
private List<DatanodePipeline> pipelines;
Expand All @@ -172,6 +182,11 @@ public Builder withState(NodeState state) {
return this;
}

public Builder withOperationalState(NodeOperationalState opState) {
this.opState = opState;
return this;
}

public Builder withLastHeartbeat(long lastHeartbeat) {
this.lastHeartbeat = lastHeartbeat;
return this;
Expand Down
Loading