You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "adoroszlai (via GitHub)" <gi...@apache.org> on 2023/07/20 19:57:27 UTC

[GitHub] [ozone] adoroszlai commented on a diff in pull request #5094: HDDS-9049. Use OM ServiceId from address in DeleteVolumeHandler.

adoroszlai commented on code in PR #5094:
URL: https://github.com/apache/ozone/pull/5094#discussion_r1269905442


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/DeleteVolumeHandler.java:
##########
@@ -92,16 +85,17 @@ protected void execute(OzoneClient client, OzoneAddress address)
     String volumeName = address.getVolumeName();
     try {
       if (bRecursive) {
-        Collection<String> serviceIds = getConf().getTrimmedStringCollection(
-            OZONE_OM_SERVICE_IDS_KEY);
-        if (Strings.isNullOrEmpty(omServiceId)) {
-          if (serviceIds.size() > 1) {
-            out().printf("OmServiceID not provided, provide using " +
-                "-id <OM_SERVICE_ID>%n");
-            return;
-          } else if (serviceIds.size() == 1) {
+        if (!Strings.isNullOrEmpty(address.getOmHost())) {
+          omServiceId = address.getOmHost();
+        } else {
+          Collection<String> serviceIds = getConf().getTrimmedStringCollection(
+              OZONE_OM_SERVICE_IDS_KEY);
+          if (serviceIds.size() == 1) {
             // Only one OM service ID configured, we can use that
+            // If more than 1, it will fail in createClient step itself
             omServiceId = serviceIds.iterator().next();
+          } else {
+            omServiceId = getConf().get(OZONE_OM_ADDRESS_KEY);
           }
         }

Review Comment:
   This is same logic as in `DeleteBucketHandler`.  Can you please extract and reuse?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org