xichen01 opened a new pull request, #4188: URL: https://github.com/apache/ozone/pull/4188
## What changes were proposed in this pull request? current support persists the owner info to DB and reads the owner info from DB, the owner will be the user that creates the Object, for `ozone fs` and `ozone sh key`, it will be the system user that executes the command, for `aws s3` it will be `AWS Access Key ID` ### supported command: #### write: support `ozone fs` and `ozone sh key` and `aws s3/s3api` related Object creation commands. will present owner info to DB when creating an object. #### read (support display real owner info): if the `owner `field is `null` will fall back to the old logic, use the OS login user to fill the `owner `field. This is possible during an upgrade from the previous version ``` ozone fs -ls ozone fs stat ozone sh key ls ozone sh key info aws s3api list-objects ``` `aws s3api get-object-acl` not support current, will be support next ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-7791 ## How was this patch tested? 1. create some key/file/dir through `ozone fs`, `ozone sh key`, `aws s3` environment ```shell [pony.chen@linux /root/ozone]% aws configure AWS Access Key ID [****************chen]: // xxxxxx [pony.chen@linux /root/ozone]% whoami pony.chen ``` ```shell [pony.chen@linux /root/ozone]% ozone sh key put /s3v/bucket1/putfile ~/testfile.img [pony.chen@linux /root/ozone]% ozone fs -mkdir ofs://localhost/s3v/bucket1/dir1 [pony.chen@linux /root/ozone]% ozone fs -touch ofs://localhost/s3v/bucket1/file1 [pony.chen@linux /root/ozone]% aws s3 --endpoint http://localhost:9878 cp ~/testfile s3://bucket1/s3file upload: ../../testfile to s3://bucket1/s3file [pony.chen@linux /root/ozone]% ``` 2. switch to another user and display `key/file` info about `owner`, the `owner` info will be real info created above environment. You can see that the owner is `pony.chen` instead of `root` (before this PR it will be root) ``` linux:~ root# whoami root ``` ```shell linux:~ root# ozone sh key ls s3v/bucket1 | grep "name\|owner" "name" : "dir1/", "ownerName" : "pony.chen", "name" : "file1", "ownerName" : "pony.chen", "name" : "putfile", "ownerName" : "pony.chen", "name" : "s3file", "ownerName" : "pony.chen", linux:~ root# linux:~ root# ozone fs -ls ofs://localhost/s3v/bucket1/ Found 4 items drwxrwxrwx - pony.chen root 0 2022-12-06 15:06 ofs://localhost/s3v/bucket1/dir1 -rw-rw-rw- 3 pony.chen root 0 2022-12-06 15:06 ofs://localhost/s3v/bucket1/file1 -rw-rw-rw- 3 pony.chen root 1048576 2022-12-06 15:05 ofs://localhost/s3v/bucket1/putfile -rw-rw-rw- 3 pony.chen root 1048576 2022-12-06 15:07 ofs://localhost/s3v/bucket1/s3file linux:~ root# linux:~ root# aws s3api --endpoint http://localhost:9878 list-objects --bucket bucket1 None CONTENTS 2022-12-06T07:06:07.468Z dir1/ 2022-12-06T07:06:07.468000+00:00 0 STANDARD OWNER pony.chen pony.chen CONTENTS 2022-12-06T07:06:22.887Z file1 2022-12-06T07:06:22.887000+00:00 0 STANDARD OWNER pony.chen pony.chen CONTENTS 2022-12-06T07:05:39.955Z putfile 2022-12-06T07:05:39.955000+00:00 1048576 STANDARD OWNER pony.chen pony.chen CONTENTS 2022-12-06T07:07:00.776Z s3file 2022-12-06T07:07:00.776000+00:00 1048576 STANDARD OWNER pony.chen pony.chen ``` -- 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]
