Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NC | NSFS | Fix Bug | Head Object on a Tagged Object Does Not Return x-amz-tagging-count Header #8357

Merged

Conversation

shirady
Copy link
Contributor

@shirady shirady commented Sep 12, 2024

Explain the changes

  1. In namespace_fs return tag_count which is the sum of all the extended attribute that has the prefix user.noobaa.tag..
  2. Rename XATTR_NOOBAA_CUSTOM_PREFIX to XATTR_TAG and move the variable declaration to a lower place in the variable declaration list.

Issues: Fixed #8353

  1. Currently, in namespace_fs we always return tag_count: 0, therefore the client would not receive the x-amz-tagging-count header.

Testing Instructions:

Automatic Test

Please run: s3tests_boto3/functional/test_s3.py::test_get_obj_head_tagging in NC deployment.

Manual Test

  1. Create an account with the CLI: sudo node src/cmd/manage_nsfs account add --name <account-name> --new_buckets_path /tmp/nsfs_root1 --access_key <access-key> --secret_key <secret-key> --uid <uid> --gid <gid>
    Note: before creating the account need to give permission to the new_buckets_path: chmod 777 /tmp/nsfs_root1, chmod 777 /tmp/nsfs_root2.
  2. Start the NSFS server with: sudo node src/cmd/nsfs --debug 5
    Notes:
  • I Change the config.NSFS_CHECK_BUCKET_BOUNDARIES = false; //SDSD because I’m using the /tmp/ and not /private/tmp/.
  1. Create the alias for S3 service:alias nc-user-1-s3=‘AWS_ACCESS_KEY_ID=<access-key> AWS_SECRET_ACCESS_KEY=<secret-key> aws --no-verify-ssl --endpoint-url https://localhost:6443’.
  2. Check the connection to the endpoint and try to list the buckets (should be empty): nc-user-1-s3 s3 ls; echo $?
  3. Add bucket to the account using AWS CLI: nc-user-1-s3 s3 mb s3://bucket-1 (bucket-1 is the bucket name in this example)
  4. Put an object: nc-user-1-s3 s3api put-object --bucket bucket-1 --key hello.txt
  5. Put object-tagging: nc-user-1-s3 s3api put-object-tagging --tagging '{"TagSet": [{ "Key": "designation", "Value": "confidential" }, { "Key": "department", "Value": "finance" }, { "Key": "team", "Value": "payroll" } ]}' --bucket bucket-1 --key hello.txt (in this example there are 3 added tags).
  6. Head the object: nc-user-1-s3 s3api get-object --bucket bucket-1 --key hello.txt --debug (use the debug flag to validate the header of `x-amz-tagging-count, expected to see 3).
  • Doc added/updated
  • Tests added

@shirady shirady force-pushed the nsfs-nc-versioning-head-object-with-tagging branch from 6359150 to ef1653f Compare September 12, 2024 12:37
@shirady shirady self-assigned this Sep 12, 2024
src/sdk/namespace_fs.js Outdated Show resolved Hide resolved
@shirady shirady force-pushed the nsfs-nc-versioning-head-object-with-tagging branch 2 times, most recently from ff0828e to 25d5332 Compare September 15, 2024 07:08
…g-count header

1. In namespace_fs return tag_count which is the sum of all the extended attribute that has the prefix `user.noobaa.tag.`.
2. Rename XATTR_NOOBAA_CUSTOM_PREFIX to XATTR_TAG and move the variable declaration to a lower place in the variable declaration list.

Signed-off-by: shirady <[email protected]>
@shirady shirady force-pushed the nsfs-nc-versioning-head-object-with-tagging branch from 25d5332 to cacce05 Compare September 15, 2024 08:34
@shirady shirady merged commit 4edc2a4 into noobaa:master Sep 15, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants