smengcl commented on a change in pull request #2857:
URL: https://github.com/apache/ozone/pull/2857#discussion_r755523411



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/volume/OMVolumeDeleteRequest.java
##########
@@ -100,6 +100,14 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager,
 
       OmVolumeArgs omVolumeArgs = getVolumeInfo(omMetadataManager, volume);
 
+      // Check reference count
+      if (omVolumeArgs.getRefCount() != 0L) {
+        LOG.debug("volume: {} has non-zero ref count. won't delete", volume);
+        throw new OMException("Volume is being used. Use " +
+            "`ozone tenant delete` CLI to delete the volume instead.",
+            OMException.ResultCodes.VOLUME_IN_USE);

Review comment:
       Maybe rename `VOLUME_IN_USE`.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to