adoroszlai commented on a change in pull request #649: HDDS-3120. Freon work 
with OM HA.
URL: https://github.com/apache/hadoop-ozone/pull/649#discussion_r389926045
 
 

 ##########
 File path: 
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmBucketGenerator.java
 ##########
 @@ -46,24 +48,49 @@
       defaultValue = "vol1")
   private String volumeName;
 
+  @Option(
+      names = "--om-service-id",
+      description = "OM Service ID"
+  )
+  private String omServiceID = null;
+
   private OzoneManagerProtocol ozoneManagerClient;
 
   private Timer bucketCreationTimer;
 
   @Override
   public Void call() throws Exception {
 
-    init();
+    OzoneClient ozoneClient = null;
+    try {
+      init();
+
+      OzoneConfiguration ozoneConfiguration = createOzoneConfiguration();
+
+      ozoneManagerClient = createOmClient(ozoneConfiguration, omServiceID);
+
+      if (omServiceID != null) {
+        ozoneClient = OzoneClientFactory.getRpcClient(omServiceID,
+            ozoneConfiguration);
+      } else {
+        ozoneClient = OzoneClientFactory.getRpcClient(ozoneConfiguration);
+      }
+      ensureVolumeExists(ozoneClient, volumeName);
 
-    OzoneConfiguration ozoneConfiguration = createOzoneConfiguration();
+      bucketCreationTimer = getMetrics().timer("bucket-create");
 
-    ozoneManagerClient = createOmClient(ozoneConfiguration);
+      runTests(this::createBucket);
 
-    ensureVolumeExists(ozoneConfiguration, volumeName);
+    } finally {
 
-    bucketCreationTimer = getMetrics().timer("bucket-create");
+      if (ozoneClient != null) {
+        ozoneClient.close();
 
 Review comment:
   Can `ozoneClient` be closed right after creating volume?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to