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

sammichen pushed a commit to branch HDDS-5713
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/HDDS-5713 by this push:
     new b3cb562930 HDDS-12545. [DiskBalancer] Query status and report API 
doesn't require SCM admin privilege (#8112)
b3cb562930 is described below

commit b3cb56293070875681de2eab22deb7d9c27d7b5c
Author: Gargi Jaiswal <[email protected]>
AuthorDate: Fri Mar 21 13:45:07 2025 +0530

    HDDS-12545. [DiskBalancer] Query status and report API doesn't require SCM 
admin privilege (#8112)
---
 .../hdds/scm/server/SCMClientProtocolServer.java   | 16 ---------
 .../main/smoketest/admincli/testdiskbalancer.robot | 41 ++++++++++++++++++++++
 2 files changed, 41 insertions(+), 16 deletions(-)

diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
index f648d4f37b..62ee0f4659 100644
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
+++ 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
@@ -1342,14 +1342,6 @@ public List<ContainerInfo> getListOfContainers(
   @Override
   public List<HddsProtos.DatanodeDiskBalancerInfoProto> getDiskBalancerReport(
       int count, int clientVersion) throws IOException {
-    // check admin authorisation
-    try {
-      getScm().checkAdminAccess(getRemoteUser(), true);
-    } catch (IOException e) {
-      LOG.error("Authorization failed", e);
-      throw e;
-    }
-
     return scm.getDiskBalancerManager().getDiskBalancerReport(count,
         clientVersion);
   }
@@ -1359,14 +1351,6 @@ public List<HddsProtos.DatanodeDiskBalancerInfoProto> 
getDiskBalancerStatus(
       Optional<List<String>> hosts,
       Optional<HddsProtos.DiskBalancerRunningStatus> status,
       int clientVersion) throws IOException {
-    // check admin authorisation
-    try {
-      getScm().checkAdminAccess(getRemoteUser(), true);
-    } catch (IOException e) {
-      LOG.error("Authorization failed", e);
-      throw e;
-    }
-
     return scm.getDiskBalancerManager().getDiskBalancerStatus(hosts, status,
         clientVersion);
   }
diff --git 
a/hadoop-ozone/dist/src/main/smoketest/admincli/testdiskbalancer.robot 
b/hadoop-ozone/dist/src/main/smoketest/admincli/testdiskbalancer.robot
new file mode 100644
index 0000000000..007ca42edc
--- /dev/null
+++ b/hadoop-ozone/dist/src/main/smoketest/admincli/testdiskbalancer.robot
@@ -0,0 +1,41 @@
+# 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.
+
+*** Settings ***
+Documentation       Test ozone admin datanode diskbalancer command
+Library             OperatingSystem
+Resource            ../commonlib.robot
+
+** Test Cases ***
+Check failure with non-admin user to start, stop and update diskbalancer
+    Requires admin privilege     ozone admin datanode diskbalancer start -a
+    Requires admin privilege     ozone admin datanode diskbalancer stop -a
+    Requires admin privilege     ozone admin datanode diskbalancer update -t 
0.0002 -a
+
+Check success with admin user for start, stop and update diskbalancer
+    Run Keyword         Kinit test user                 testuser               
 testuser.keytab
+    ${result} =         Execute                         ozone admin datanode 
diskbalancer start -a
+                        Should Contain                  ${result}              
  Start DiskBalancer on datanode(s)
+    ${result} =         Execute                         ozone admin datanode 
diskbalancer stop -a
+                        Should Contain                  ${result}              
  Stopping DiskBalancer on datanode(s)
+    ${result} =         Execute                         ozone admin datanode 
diskbalancer update -t 0.0002 -a
+                        Should Contain                  ${result}              
  Update DiskBalancer Configuration on datanode(s)
+
+Check success with non-admin user for status and report diskbalancer
+    Run Keyword         Kinit test user                 testuser2              
 testuser2.keytab
+    ${result} =         Execute                         ozone admin datanode 
diskbalancer status
+                        Should Contain                  ${result}              
  Status result:
+    ${result} =         Execute                         ozone admin datanode 
diskbalancer report
+                        Should Contain                  ${result}              
  Report result:


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

Reply via email to