-
Notifications
You must be signed in to change notification settings - Fork 587
HDDS-13101. Remove duplicate information in datanode list output #8523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5a8e7be
HDDS-13101. Remove duplicate information in datanode list output
fa2d29d
Updated robot test to support new json output format
0479427
fixed robot test
b7dda06
Using a centralized DatanodeDetails serializer
2d42ffb
Updated json output for single node
b435d66
Merge branch 'master' of github.com:apache/ozone into HDDS-13101
8f4ae43
Fixed TestListInfoSubcommand failure and reduced redundant datanodeDe…
249ecb4
Replace opState with persistedOpState and bypass DatanodeWithAttribut…
040c91d
Fixed datanode.robot test
9c5c5fa
Fixed testBalancer.robot test
a209c46
Included both opState and persistedOpState in json and updated tests
0d4ca66
Merge branch 'master' of github.com:apache/ozone into HDDS-13101
8bb2584
Used DatanodeDetails directly in BasicDatanodeInfo to avoid field copies
fa73f05
Used JsonProperty index, passed limit to server side when sorting, up…
aa3889b
Reverted to original limit flow
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
156 changes: 156 additions & 0 deletions
156
...one/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DatanodeInfoJson.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.hadoop.hdds.scm.cli.datanode; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import java.util.List; | ||
| import org.apache.hadoop.hdds.protocol.DatanodeDetails; | ||
|
|
||
| /** | ||
| * Represents filtered Datanode information for json use. | ||
| */ | ||
|
|
||
| public class DatanodeInfoJson { | ||
| private final String id; | ||
| private final String hostName; | ||
| private final String ipAddress; | ||
| private final List<DatanodeDetails.Port> ports; | ||
| private final long setupTime; | ||
| private final int currentVersion; | ||
| private final String opState; | ||
| private final long persistedOpStateExpiryEpochSec; | ||
| private final String healthState; | ||
| private final boolean decommissioned; | ||
| private final boolean maintenance; | ||
| private final int level; | ||
| private final int cost; | ||
| private final int numOfLeaves; | ||
| private final String networkFullPath; | ||
| private final String networkLocation; | ||
| private final String networkName; | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| private Long used = null; | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| private Long capacity = null; | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| private Double percentUsed = null; | ||
|
|
||
| DatanodeInfoJson(ListInfoSubcommand.DatanodeWithAttributes dna) { | ||
| DatanodeDetails dn = dna.getDatanodeDetails(); | ||
| this.id = dn.getUuid().toString(); | ||
| this.ports = dn.getPorts(); | ||
| this.opState = String.valueOf(dna.getOpState()); | ||
| this.healthState = String.valueOf(dna.getHealthState()); | ||
| this.hostName = dn.getHostName(); | ||
| this.ipAddress = dn.getIpAddress(); | ||
| this.persistedOpStateExpiryEpochSec = dn.getPersistedOpStateExpiryEpochSec(); | ||
| this.decommissioned = dn.isDecommissioned(); | ||
| this.maintenance = dn.isMaintenance(); | ||
| this.level = dn.getLevel(); | ||
| this.cost = dn.getCost(); | ||
| this.numOfLeaves = dn.getNumOfLeaves(); | ||
| this.networkFullPath = dn.getNetworkFullPath(); | ||
| this.networkLocation = dn.getNetworkLocation(); | ||
| this.networkName = dn.getNetworkName(); | ||
| this.setupTime = dn.getSetupTime(); | ||
| this.currentVersion = dn.getCurrentVersion(); | ||
| this.used = dna.getUsed(); | ||
| this.capacity = dna.getCapacity(); | ||
| this.percentUsed = dna.getPercentUsed(); | ||
| } | ||
|
|
||
| public String getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public List<DatanodeDetails.Port> getPorts() { | ||
| return ports; | ||
| } | ||
|
|
||
| public String getOpState() { | ||
errose28 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return opState; | ||
| } | ||
|
|
||
| public String getHealthState() { | ||
| return healthState; | ||
| } | ||
|
|
||
| public String getHostName() { | ||
| return hostName; | ||
| } | ||
|
|
||
| public String getIpAddress() { | ||
| return ipAddress; | ||
| } | ||
|
|
||
| public long getPersistedOpStateExpiryEpochSec() { | ||
| return persistedOpStateExpiryEpochSec; | ||
| } | ||
|
|
||
| public boolean isDecommissioned() { | ||
| return decommissioned; | ||
| } | ||
|
|
||
| public boolean isMaintenance() { | ||
| return maintenance; | ||
| } | ||
|
|
||
| public int getLevel() { | ||
| return level; | ||
| } | ||
|
|
||
| public int getCost() { | ||
| return cost; | ||
| } | ||
|
|
||
| public int getNumOfLeaves() { | ||
| return numOfLeaves; | ||
| } | ||
|
|
||
| public String getNetworkFullPath() { | ||
| return networkFullPath; | ||
| } | ||
|
|
||
| public String getNetworkLocation() { | ||
| return networkLocation; | ||
| } | ||
|
|
||
| public String getNetworkName() { | ||
| return networkName; | ||
| } | ||
|
|
||
| public long getSetupTime() { | ||
| return setupTime; | ||
| } | ||
|
|
||
| public int getCurrentVersion() { | ||
| return currentVersion; | ||
| } | ||
|
|
||
| public Long getUsed() { | ||
| return used; | ||
| } | ||
|
|
||
| public Long getCapacity() { | ||
| return capacity; | ||
| } | ||
|
|
||
| public Double getPercentUsed() { | ||
| return percentUsed; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.