Bug #10645
using x-fresh-metadata=true in object copying using swift API copies custom metadata also.
0%
Description
If x-fresh-metadata=true header is passed in object copying operation then the new object created should not contain the metadata of copied object. This is how swift behaves. But when the same header is used in ceph object storage using swift API it doesn't work. The same issue is observed whether using PUT and x-copy-from combination or COPY and destination header combination.
Steps to reproduce:
1. swift post container
2. curl -i https://object.jiocloud.com:80/swift/v1/container/file1 -X PUT -H "X-Auth-Token: b2ede42799494e18b00cc23c03f5d67f" -H "content-length:0" -d ""
3. swift post container file1 -H "x-object-meta-testmeta: meta"
4. swift stat container file1
Account: v1
Container: container
Object: file1
Content Type: application/octet-stream
Content Length: 0
Last Modified: Tue, 27 Jan 2015 06:53:47 GMT
ETag: d41d8cd98f00b204e9800998ecf8427e
Meta Testmeta: meta
Accept-Ranges: bytes
Server: Apache/2.4.7 (Ubuntu)
Connection: close
5. curl -i https://object.jiocloud.com:80/swift/v1/container/file2 -X PUT -H "X-Auth-Token: b2ede42799494e18b00cc23c03f5d67f" -H "x-copy-from: container/file1" -H "X-Fresh-Metadata: true"
HTTP/1.1 201 Created
Date: Tue, 27 Jan 2015 06:54:29 GMT
Server: Apache/2.4.7 (Ubuntu)
Content-Type: application/octet-stream
Connection: close
Transfer-Encoding: chunked
6. curl -i https://object.jiocloud.com:80/swift/v1/container/file2 -I -H "X-Auth-Token: b2ede42799494e18b00cc23c03f5d67f"
HTTP/1.1 200 OK
Date: Tue, 27 Jan 2015 06:55:05 GMT
Server: Apache/2.4.7 (Ubuntu)
Accept-Ranges: bytes
Last-Modified: Tue, 27 Jan 2015 06:54:29 GMT
etag: d41d8cd98f00b204e9800998ecf8427e
X-Object-Meta-testmeta: meta
Content-Type: application/octet-stream
Connection: close
Ceph version: 0.80.8
Associated revisions
rgw: improve metadata handling on copy operation of Swift API.
Fixes: #10645
Backport: hammer
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
rgw: improve metadata handling on copy operation of Swift API.
Fixes: #10645
Backport: hammer
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
(cherry picked from commit a00cb31cc52e91bfacdd15e0af60be74e66c1996)
History
#1 Updated by Dmytro Yurchenko almost 9 years ago
Could you please provide a link where this particular header x-fresh-metadata is documented?
I cannot find it here http://docs.openstack.org/api/openstack-object-storage/1.0/content/COPY_copyObject__v1__account___container___object__storage_object_services.html
nor here http://developer.openstack.org/api-ref-objectstorage-v1.html
#2 Updated by Ahmad Faheem almost 9 years ago
x-fresh-metadata is not documented in the links you provided but a little description about it is given in https://wiki.openstack.org/wiki/Swift/ObjectSystemMetadata#.27POST-as-copy.27. There are test cases also in tempest to verify this functionality. the test cases can be found in https://github.com/openstack/tempest/blob/master/tempest/api/object_storage/test_object_services.py
with names: test_create_object_with_x_fresh_metadata, test_copy_object_with_x_fresh_metadata.
#3 Updated by Dmytro Yurchenko almost 9 years ago
- Assignee set to Dmytro Yurchenko
#4 Updated by Dmytro Yurchenko almost 9 years ago
I still doubt if we need this. It seems like x-fresh-metadata header is used only internally by swift and is not a part of external API.
Taken from: https://wiki.openstack.org/wiki/Swift/ObjectSystemMetadata#.27POST-as-copy.27
Fortunately PUTs due to POST-as-copy can be distinguished from regular PUTs via an X-Fresh-Metadata header that is added by the proxy controller while processing
POST-as-copy (this header is used as a flag internal to the proxy object controller to signal that all existing user metadata should but be replaced during the
copy, but the header ends up being sent to the backend object server as a side-effect).
And tempest verifies swift's health and sanity regarding his internal structure.
Likely it is not a testing suite for API compatibility.
So I'd stick to the API specification.
#5 Updated by Yehuda Sadeh almost 9 years ago
While we can implement it, as it doesn't sound like a huge deal, I'd rather spend the time in fixing compatibility with documented api, rather than with undocumented features. I don't want to start hunting and replicating all the undocumented behavior of swift. Maybe the next step would be to contact the swift authors and ask for clarification about this specific feature, maybe they can get it documented officially?
#6 Updated by Dmytro Yurchenko almost 9 years ago
- Assignee deleted (
Dmytro Yurchenko)
#7 Updated by Yehuda Sadeh over 8 years ago
- Status changed from New to Pending Backport
- Backport set to hammer
#8 Updated by Loïc Dachary over 8 years ago
- Regression set to No
#9 Updated by Loïc Dachary over 8 years ago
- hammer backport https://github.com/ceph/ceph/pull/4568
#10 Updated by Loïc Dachary over 8 years ago
- Status changed from Pending Backport to Resolved