diff --git a/Authors b/Authors index 2e8e0b7b4e..af9b32320d 100644 --- a/Authors +++ b/Authors @@ -23,6 +23,7 @@ Mark McLoughlin Matt Dietz Mike Lundy Monty Taylor +Paul Bourke Rick Clark Rick Harris Russell Bryant diff --git a/glance/store/swift.py b/glance/store/swift.py index e99d7be256..204a2342fb 100644 --- a/glance/store/swift.py +++ b/glance/store/swift.py @@ -339,6 +339,13 @@ def add(self, image_id, image_file, image_size): # best... obj_etag = swift_conn.put_object(self.container, obj_name, image_file) + + if image_size == 0: + resp_headers = swift_conn.head_object(self.container, + obj_name) + # header keys are lowercased by Swift + if 'content-length' in resp_headers: + image_size = int(resp_headers['content-length']) else: # Write the image into Swift in chunks. We cannot # stream chunks of the webob.Request.body_file, unfortunately,