[
https://issues.apache.org/jira/browse/HDDS-1540?focusedWorklogId=251224&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-251224
]
ASF GitHub Bot logged work on HDDS-1540:
----------------------------------------
Author: ASF GitHub Bot
Created on: 30/May/19 18:30
Start Date: 30/May/19 18:30
Worklog Time Spent: 10m
Work Description: xiaoyuyao commented on pull request #874: HDDS-1540.
Implement addAcl,removeAcl,setAcl,getAcl for Bucket. Contributed by Ajay Kumar.
URL: https://github.com/apache/hadoop/pull/874#discussion_r289115495
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/BucketManagerImpl.java
##########
@@ -423,4 +428,205 @@ private void commitDeleteBucketInfoToOMDB(String
dbBucketKey)
volumeName, startBucket, bucketPrefix, maxNumOfBuckets);
}
+
+ /**
+ * Add acl for Ozone object. Return true if acl is added successfully else
+ * false.
+ *
+ * @param obj Ozone object for which acl should be added.
+ * @param acl ozone acl top be added.
+ * @throws IOException if there is error.
+ */
+ @Override
+ public boolean addAcl(OzoneObj obj, OzoneAcl acl) throws IOException {
+ Objects.requireNonNull(obj);
+ Objects.requireNonNull(acl);
+ if (!obj.getResourceType().equals(OzoneObj.ResourceType.BUCKET)) {
+ throw new IllegalArgumentException("Unexpected argument passed to " +
+ "BucketManager. OzoneObj type:" + obj.getResourceType());
+ }
+ String volume = obj.getVolumeName();
+ String bucket = obj.getBucketName();
+ metadataManager.getLock().acquireBucketLock(volume, bucket);
+ try {
+ String dbBucketKey = metadataManager.getBucketKey(volume, bucket);
+ OmBucketInfo bucketInfo =
+ metadataManager.getBucketTable().get(dbBucketKey);
+ if (bucketInfo == null) {
+ LOG.debug("Bucket:{}/{} does not exist", volume, bucket);
+ throw new OMException("Bucket " + bucket + " is not found",
+ BUCKET_NOT_FOUND);
+ }
+ List<OzoneAcl> list = bucketInfo.getAcls();
+ list.add(acl);
+ OmBucketInfo updatedBucket = OmBucketInfo.newBuilder()
+ .setVolumeName(bucketInfo.getVolumeName())
+ .setBucketName(bucketInfo.getBucketName())
+ .setStorageType(bucketInfo.getStorageType())
+ .setIsVersionEnabled(bucketInfo.getIsVersionEnabled())
+ .setCreationTime(bucketInfo.getCreationTime())
+ .setBucketEncryptionKey(bucketInfo.getEncryptionKeyInfo())
+ .addAllMetadata(bucketInfo.getMetadata())
+ .setAcls(list)
+ .build();
+
+ metadataManager.getBucketTable().put(dbBucketKey, updatedBucket);
Review comment:
Local DB put may not work with OM HA. cc: @bharatviswa504 for additional
comments on the proper way to commit OM metadata changes via Ratis.
----------------------------------------------------------------
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 251224)
Time Spent: 1h (was: 50m)
> Implement addAcl,removeAcl,setAcl,getAcl for Bucket
> ----------------------------------------------------
>
> Key: HDDS-1540
> URL: https://issues.apache.org/jira/browse/HDDS-1540
> Project: Hadoop Distributed Data Store
> Issue Type: Sub-task
> Reporter: Ajay Kumar
> Assignee: Ajay Kumar
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Implement addAcl,removeAcl,setAcl,getAcl for Bucket
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]