-
Notifications
You must be signed in to change notification settings - Fork 86
NC | NSFS | Versioning | Fix Bug | Return 405 for Get/Head Specific Delete-Marker #8338
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
Merged
shirady
merged 1 commit into
noobaa:master
from
shirady:nsfs-nc-versioning-head-get-version-id-delete-marker
Sep 17, 2024
Merged
NC | NSFS | Versioning | Fix Bug | Return 405 for Get/Head Specific Delete-Marker #8338
shirady
merged 1 commit into
noobaa:master
from
shirady:nsfs-nc-versioning-head-get-version-id-delete-marker
Sep 17, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bd259fc
to
03b57bb
Compare
379b8a3
to
81439e0
Compare
romayalon
reviewed
Sep 16, 2024
romayalon
approved these changes
Sep 16, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
81439e0
to
6cea101
Compare
…elete-marker 1. In namespace_fs add the case of specific version to the error that is thrown with additional information that we will use to set headers in the http response. To support it I added the params argument to the function _throw_if_delete_marker. 2. In s3_error add the mapping between the rpc that we used in namespace_fs and the S3 error that we want it to be mapped. 3. In s3_rest change the s3err.rpc_data to err.rpc_data since the object s3error does not have the rpc_data as a property inside it. Add the case to set http header for the delete-marker, reuse this change in a refactored function _prepare_error. Signed-off-by: shirady <[email protected]>
6cea101
to
8492113
Compare
2 tasks
shirady
added a commit
to shirady/noobaa-core
that referenced
this pull request
Sep 25, 2024
1. In test_bucketspace_versioning.js in the object tagging tests - Add Header check related to HeadObject with tagging, as was manually tested in PR NC | NSFS | Fix Bug | Head Object on a Tagged Object Does Not Return x-amz-tagging-count Header noobaa#8357. - Change the bucket from suspended_bucket_name to bucket_name (the bucket that we use with versioning Enabled). 2. In test_bucketspace_versioning.js add headers check, as was manually tested in PR NC | NSFS | Versioning | Fix Bug | Return 405 for Get/Head Specific Delete-Marker noobaa#8338 in the following tests: - head object, with version enabled, version id specified delete marker - should throw error with code 405 - get object, with version enabled, version id specified delete marker - should throw error with code 405 Signed-off-by: shirady <[email protected]>
romayalon
pushed a commit
to romayalon/noobaa-core
that referenced
this pull request
Sep 26, 2024
1. In test_bucketspace_versioning.js in the object tagging tests - Add Header check related to HeadObject with tagging, as was manually tested in PR NC | NSFS | Fix Bug | Head Object on a Tagged Object Does Not Return x-amz-tagging-count Header noobaa#8357. - Change the bucket from suspended_bucket_name to bucket_name (the bucket that we use with versioning Enabled). 2. In test_bucketspace_versioning.js add headers check, as was manually tested in PR NC | NSFS | Versioning | Fix Bug | Return 405 for Get/Head Specific Delete-Marker noobaa#8338 in the following tests: - head object, with version enabled, version id specified delete marker - should throw error with code 405 - get object, with version enabled, version id specified delete marker - should throw error with code 405 Signed-off-by: shirady <[email protected]> (cherry picked from commit 229a01e)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explain the changes
namespace_fs
add the case of specific version to the error that is thrown with additional information that we will use to set headers in the http response. To support it I added theparams
argument to the function_throw_if_delete_marker
.s3_error
add the mapping between the rpc that we used innamespace_fs
and the S3 error that we want it to be mapped.s3_rest
change thes3err.rpc_data
toerr.rpc_data
since the objects3error
does not have therpc_data
as a property inside it. Add the case to set http header for the delete-marker, reuse this change in a refactored function_prepare_error
.Issues:
If the specified version in the request is a delete marker, the response returns a 405 Method Not Allowed error and the Last-Modified: timestamp response header.
Currently, we returned:
List of gaps:
s3err.rpc_data
also appears in the function_handle_html_response
, need to decide if we want to change it there as well.x-amz-delete-marker
when versioning is enabled.s3tests_boto3/functional/test_s3.py::test_get_object_ifnonematch_good
ands3tests_boto3/functional/test_s3.py::test_get_object_ifmodifiedsince_failed
- but they did not pass - need to investigate more.Testing Instructions:
Unit Test
Please run:
sudo NC_CORETEST=true node ./node_modules/mocha/bin/mocha ./src/test/unit_tests/test_bucketspace_versioning.js
Manual Tests
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
.sudo node src/cmd/nsfs --debug 5
Notes:
config.NSFS_CHECK_BUCKET_BOUNDARIES = false; //SDSD
because I’m using the/tmp/
and not/private/tmp/
.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’
.nc-user-1-s3 s3 ls; echo $?
nc-user-1-s3 s3 mb s3://bucket-v
(bucket-v
is the bucket name in this example)nc-user-1-s3 s3api put-bucket-versioning --bucket bucket-v --versioning-configuration Status=Enabled
nc-user-1-s3 s3api put-object --bucket bucket-v --key hello.txt
nc-user-1-s3 s3api delete-object --bucket bucket-v --key hello.txt
(save theVersionId
from the output).nc-user-1-s3 s3api get-object --bucket bucket-v --key hello.txt --version-id mtime-d41oghwhfyf4-ino-2f74i2 --debug
(should beAn error occurred (405) when calling the HeadObject operation: Method Not Allowed
use thedebug
flag to validate the headers ofLast-Modified
andx-amz-delete-marker
).touch my_get.txt
;nc-user-1-s3 s3api get-object --bucket bucket-v --key hello.txt --version-id mtime-d41oghwhfyf4-ino-2f74i2 my_get.txt --debug
(should beAn error occurred (MethodNotAllowed) when calling the GetObject operation: The specified method is not allowed against this resource.
use thedebug
flag to validate the headers ofLast-Modified
andx-amz-delete-marker
).