This is an automated email from the ASF dual-hosted git repository.

adoroszlai 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 ba950741b3 HDDS-13107. Support limiting output of `ozone admin 
datanode list` (#8595)
ba950741b3 is described below

commit ba950741b3fe1d6238653fa7699aa96830c72339
Author: sreejasahithi <[email protected]>
AuthorDate: Tue Jun 10 21:22:51 2025 +0530

    HDDS-13107. Support limiting output of `ozone admin datanode list` (#8595)
---
 .../apache/hadoop/hdds/scm/cli/datanode/ListInfoSubcommand.java   | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git 
a/hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/ListInfoSubcommand.java
 
b/hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/ListInfoSubcommand.java
index 06bdaf7183..ad0f0a7ef9 100644
--- 
a/hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/ListInfoSubcommand.java
+++ 
b/hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/ListInfoSubcommand.java
@@ -31,6 +31,7 @@
 import org.apache.hadoop.hdds.scm.client.ScmClient;
 import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
 import org.apache.hadoop.hdds.server.JsonUtils;
+import org.apache.hadoop.ozone.shell.ListLimitOptions;
 import picocli.CommandLine;
 
 /**
@@ -77,6 +78,9 @@ public class ListInfoSubcommand extends ScmSubcommand {
        defaultValue = "false")
   private boolean json;
 
+  @CommandLine.Mixin
+  private ListLimitOptions listLimitOptions;
+
   private List<Pipeline> pipelines;
 
   @Override
@@ -115,6 +119,10 @@ public void execute(ScmClient scmClient) throws 
IOException {
           .compareToIgnoreCase(nodeState) == 0);
     }
 
+    if (!listLimitOptions.isAll()) {
+      allNodes = allNodes.limit(listLimitOptions.getLimit());
+    }
+    
     if (json) {
       List<DatanodeWithAttributes> datanodeList = allNodes.collect(
               Collectors.toList());


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to