Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ public enum ResultCodes {

PARTIAL_RENAME,

QUOTA_EXCEEDED
QUOTA_EXCEEDED,

QUOTA_ERROR

}
}
12 changes: 6 additions & 6 deletions hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ Test ozone shell
${result} = Execute ozone sh bucket list ${protocol}${server}/${volume}/ | jq -r '. | select(.name=="bb1") | .volumeName'
Should Be Equal ${result} ${volume}
Run Keyword Test key handling ${protocol} ${server} ${volume}
Execute ozone sh bucket clrquota --space-quota ${protocol}${server}/${volume}/bb1
${result} = Execute ozone sh bucket info ${protocol}${server}/${volume}/bb1 | jq -r '. | select(.name=="bb1") | .quotaInBytes'
Should Be Equal ${result} -1
Execute ozone sh bucket clrquota --namespace-quota ${protocol}${server}/${volume}/bb1
${result} = Execute ozone sh bucket info ${protocol}${server}/${volume}/bb1 | jq -r '. | select(.name=="bb1") | .quotaInNamespace'
Should Be Equal ${result} -1
Execute ozone sh volume clrquota --space-quota ${protocol}${server}/${volume}
${result} = Execute ozone sh volume info ${protocol}${server}/${volume} | jq -r '. | select(.name=="${volume}") | .quotaInBytes'
Should Be Equal ${result} -1
Execute ozone sh volume clrquota --namespace-quota ${protocol}${server}/${volume}
${result} = Execute ozone sh volume info ${protocol}${server}/${volume} | jq -r '. | select(.name=="${volume}") | .quotaInNamespace'
Should Be Equal ${result} -1
Execute ozone sh bucket clrquota --space-quota ${protocol}${server}/${volume}/bb1
${result} = Execute ozone sh bucket info ${protocol}${server}/${volume}/bb1 | jq -r '. | select(.name=="bb1") | .quotaInBytes'
Should Be Equal ${result} -1
Execute ozone sh bucket clrquota --namespace-quota ${protocol}${server}/${volume}/bb1
${result} = Execute ozone sh bucket info ${protocol}${server}/${volume}/bb1 | jq -r '. | select(.name=="bb1") | .quotaInNamespace'
Should Be Equal ${result} -1
Execute ozone sh bucket delete ${protocol}${server}/${volume}/bb1
Execute ozone sh volume delete ${protocol}${server}/${volume}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public void testVolumeSetOwner() throws IOException {
}

@Test
public void testSetAndClrQuota() throws IOException {
public void testSetAndClrQuota() throws Exception {
String volumeName = UUID.randomUUID().toString();
String bucketName = UUID.randomUUID().toString();
OzoneVolume volume = null;
Expand Down Expand Up @@ -314,6 +314,10 @@ public void testSetAndClrQuota() throws IOException {
ozoneBucket.getQuotaInBytes());
Assert.assertEquals(1000L, ozoneBucket.getQuotaInNamespace());

LambdaTestUtils.intercept(IOException.class, "Can not clear bucket" +
" spaceQuota because volume spaceQuota is not cleared.",
() -> ozoneBucket.clearSpaceQuota());

store.getVolume(volumeName).clearSpaceQuota();
store.getVolume(volumeName).clearNamespaceQuota();
OzoneVolume clrVolume = store.getVolume(volumeName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ enum Status {

QUOTA_EXCEEDED = 66;

QUOTA_ERROR = 67;

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,13 @@ public boolean checkQuotaBytesValid(OMMetadataManager metadataManager,
throws IOException {
long quotaInBytes = omBucketArgs.getQuotaInBytes();

if (quotaInBytes == OzoneConsts.QUOTA_RESET &&
omVolumeArgs.getQuotaInBytes() != OzoneConsts.QUOTA_RESET) {
throw new OMException("Can not clear bucket spaceQuota because" +
" volume spaceQuota is not cleared.",
OMException.ResultCodes.QUOTA_ERROR);
}

if (quotaInBytes == 0) {
return false;
}
Expand Down