summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Moralejo <amoralej@redhat.com>2019-04-09 19:27:29 +0200
committerAlfredo Moralejo <amoralej@redhat.com>2019-04-17 12:38:22 +0200
commited356fc6b46e133899e1bf1c54df239536ea78b9 (patch)
tree25c1bf5d8c0378c32fd4ec440c66e50e448e9dc2
parentba6b5cf2ae0afb69bf31ab1e2b30edaeba388946 (diff)
Do not include ETag when puting manifest in chunked uploadsHEADmaster
While testing glance with Ceph Rados Gateway using latest Ceph release (Nautilus), i've found that glance fails to upload the manifest using dynamic large objects mode because of the value used in ETag request. This issue has been reported to Ceph as it seems related to some recent change in radosgw code [1]. However, checking at the upload workflow used by glance and comparing to Swift documentation [2], I wonder if adding the etag is actually providing any value. In the Swift the ETag header is used to validate integrity when uploading chunks, not the manifest while glance is doing exactly the oposite, not sending the etag in the chunks (I guess to avoid checksuming big images, which makes sense to me) and sending it when puting the manifest. This patch is removing the etag header when sending the PUT request for the manifest in chunked uploads. [1] https://tracker.ceph.com/issues/39160 [2] https://docs.openstack.org/swift/latest/api/large_objects.html#dynamic-large-objects Closes-bug: #1824533 Change-Id: I0b563dfcdc30026669fb089c82db8c3df7edc808
Notes
Notes (review): Code-Review+1: Gorka Eguileor <geguileo@redhat.com> Code-Review+1: Francesco Pantano <fpantano@redhat.com> Code-Review+2: Brian Rosmaita <rosmaita.fossdev@gmail.com> Code-Review+2: Erno Kuvaja <jokke@usr.fi> Workflow+1: Erno Kuvaja <jokke@usr.fi> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 17 Apr 2019 16:08:30 +0000 Reviewed-on: https://review.openstack.org/651337 Project: openstack/glance_store Branch: refs/heads/master
-rw-r--r--glance_store/_drivers/swift/store.py9
-rw-r--r--glance_store/tests/unit/test_swift_store.py3
-rw-r--r--glance_store/tests/unit/test_swift_store_multibackend.py3
3 files changed, 9 insertions, 6 deletions
diff --git a/glance_store/_drivers/swift/store.py b/glance_store/_drivers/swift/store.py
index 5de7e6c..706d352 100644
--- a/glance_store/_drivers/swift/store.py
+++ b/glance_store/_drivers/swift/store.py
@@ -1030,11 +1030,12 @@ class BaseStore(driver.Store):
1030 if image_size == 0: 1030 if image_size == 0:
1031 image_size = combined_chunks_size 1031 image_size = combined_chunks_size
1032 1032
1033 # Now we write the object manifest and return the 1033 # Now we write the object manifest in X-Object-Manifest
1034 # manifest's etag... 1034 # header as defined for Dynamic Large Objects (DLO) Mode.
1035 # This request does not include ETag as PUT request has not
1036 # actual content that we need to verify.
1035 manifest = "%s/%s-" % (location.container, location.obj) 1037 manifest = "%s/%s-" % (location.container, location.obj)
1036 headers = {'ETag': hashlib.md5(b"").hexdigest(), 1038 headers = {'X-Object-Manifest': manifest}
1037 'X-Object-Manifest': manifest}
1038 1039
1039 # The ETag returned for the manifest is actually the 1040 # The ETag returned for the manifest is actually the
1040 # MD5 hash of the concatenated checksums of the strings 1041 # MD5 hash of the concatenated checksums of the strings
diff --git a/glance_store/tests/unit/test_swift_store.py b/glance_store/tests/unit/test_swift_store.py
index 287097c..400fff6 100644
--- a/glance_store/tests/unit/test_swift_store.py
+++ b/glance_store/tests/unit/test_swift_store.py
@@ -118,8 +118,9 @@ class SwiftTests(object):
118 fixture_key = "%s/%s" % (container, name) 118 fixture_key = "%s/%s" % (container, name)
119 if fixture_key not in fixture_headers: 119 if fixture_key not in fixture_headers:
120 if kwargs.get('headers'): 120 if kwargs.get('headers'):
121 etag = kwargs['headers']['ETag']
122 manifest = kwargs.get('headers').get('X-Object-Manifest') 121 manifest = kwargs.get('headers').get('X-Object-Manifest')
122 etag = kwargs.get('headers') \
123 .get('ETag', hashlib.md5(b'').hexdigest())
123 fixture_headers[fixture_key] = { 124 fixture_headers[fixture_key] = {
124 'manifest': True, 125 'manifest': True,
125 'etag': etag, 126 'etag': etag,
diff --git a/glance_store/tests/unit/test_swift_store_multibackend.py b/glance_store/tests/unit/test_swift_store_multibackend.py
index fa26301..07c44d9 100644
--- a/glance_store/tests/unit/test_swift_store_multibackend.py
+++ b/glance_store/tests/unit/test_swift_store_multibackend.py
@@ -109,8 +109,9 @@ class SwiftTests(object):
109 fixture_key = "%s/%s" % (container, name) 109 fixture_key = "%s/%s" % (container, name)
110 if fixture_key not in fixture_headers: 110 if fixture_key not in fixture_headers:
111 if kwargs.get('headers'): 111 if kwargs.get('headers'):
112 etag = kwargs['headers']['ETag']
113 manifest = kwargs.get('headers').get('X-Object-Manifest') 112 manifest = kwargs.get('headers').get('X-Object-Manifest')
113 etag = kwargs.get('headers') \
114 .get('ETag', hashlib.md5(b'').hexdigest())
114 fixture_headers[fixture_key] = { 115 fixture_headers[fixture_key] = {
115 'manifest': True, 116 'manifest': True,
116 'etag': etag, 117 'etag': etag,