From afd1810c12ddd4c6f5c873a098d55c1643f0ea57 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 21 Sep 2015 08:38:44 -0500 Subject: [PATCH] Stop trying to send image_size to the server It turns out the server does not support this, and the underlying code gets very unhappy. Co-Authored-By:Itisha Change-Id: If67c11da28adbb2d793430d122e3930cc278737f --- glanceclient/tests/unit/v2/test_images.py | 4 +--- glanceclient/v2/images.py | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/glanceclient/tests/unit/v2/test_images.py b/glanceclient/tests/unit/v2/test_images.py index 7260f47e..84726ce0 100644 --- a/glanceclient/tests/unit/v2/test_images.py +++ b/glanceclient/tests/unit/v2/test_images.py @@ -802,11 +802,9 @@ class TestController(testtools.TestCase): image_data = 'CCC' image_id = '606b0e88-7c5a-4d54-b5bb-046105d4de6f' self.controller.upload(image_id, image_data, image_size=3) - body = {'image_data': image_data, - 'image_size': 3} expect = [('PUT', '/v2/images/%s/file' % image_id, {'Content-Type': 'application/octet-stream'}, - sorted(body.items()))] + image_data)] self.assertEqual(expect, self.api.calls) def test_data_without_checksum(self): diff --git a/glanceclient/v2/images.py b/glanceclient/v2/images.py index c126a35e..1f733a44 100644 --- a/glanceclient/v2/images.py +++ b/glanceclient/v2/images.py @@ -205,15 +205,11 @@ class Controller(object): :param image_id: ID of the image to upload data for. :param image_data: File-like object supplying the data to upload. - :param image_size: Total size in bytes of image to be uploaded. + :param image_size: Unused - present for backwards compatability """ url = '/v2/images/%s/file' % image_id hdrs = {'Content-Type': 'application/octet-stream'} - if image_size: - body = {'image_data': image_data, - 'image_size': image_size} - else: - body = image_data + body = image_data self.http_client.put(url, headers=hdrs, data=body) def delete(self, image_id):