From 0d7fd672328aa587a4de5224909031a9f76863b9 Mon Sep 17 00:00:00 2001 From: Haikel Guemar Date: Sep 11 2014 13:27:11 +0000 Subject: Update to Juno milestone 3 --- diff --git a/0001-Don-t-access-the-net-while-building-docs.patch b/0001-Don-t-access-the-net-while-building-docs.patch index 6afa42b..f2753f7 100644 --- a/0001-Don-t-access-the-net-while-building-docs.patch +++ b/0001-Don-t-access-the-net-while-building-docs.patch @@ -1,4 +1,4 @@ -From ec2bfd4f0f8cad92bb77b3a90b690f6b2d3b6a60 Mon Sep 17 00:00:00 2001 +From eb49cc62e79e4386720621503eb75901d5bf771a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Fri, 6 Jan 2012 17:12:54 +0000 Subject: [PATCH] Don't access the net while building docs diff --git a/0002-Remove-runtime-dep-on-python-pbr.patch b/0002-Remove-runtime-dep-on-python-pbr.patch index 9faefab..f85dfdb 100644 --- a/0002-Remove-runtime-dep-on-python-pbr.patch +++ b/0002-Remove-runtime-dep-on-python-pbr.patch @@ -1,4 +1,4 @@ -From e2ed1cd2fc11ddc49c4656316a5de5d1998b65f2 Mon Sep 17 00:00:00 2001 +From de4c28e13b79e2b317b4ed6975c3be5b893a44a2 Mon Sep 17 00:00:00 2001 From: John Bresnahan Date: Mon, 9 Sep 2013 17:00:28 -1000 Subject: [PATCH] Remove runtime dep on python pbr diff --git a/0003-avoid-unsupported-storage-drivers.patch b/0003-avoid-unsupported-storage-drivers.patch index b787e00..e63dbc9 100644 --- a/0003-avoid-unsupported-storage-drivers.patch +++ b/0003-avoid-unsupported-storage-drivers.patch @@ -1,4 +1,4 @@ -From 64fccff955accd7c0f8f18a274d6bd7b5cc9f77c Mon Sep 17 00:00:00 2001 +From be823a1732c2f3bb0a354b53c321198c0d0a8169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Wed, 9 Apr 2014 10:31:27 +0100 Subject: [PATCH] avoid unsupported storage drivers @@ -10,7 +10,7 @@ Subject: [PATCH] avoid unsupported storage drivers 3 files changed, 6 deletions(-) diff --git a/etc/glance-api.conf b/etc/glance-api.conf -index 45a0558..509bb58 100644 +index ec071d4..c0a2e81 100644 --- a/etc/glance-api.conf +++ b/etc/glance-api.conf @@ -17,10 +17,8 @@ default_store = file @@ -39,7 +39,7 @@ index 0246b67..04e5623 100644 # ============ Filesystem Store Options ======================== diff --git a/glance/store/__init__.py b/glance/store/__init__.py -index ae51417..ba52952 100644 +index d5a3051..93645bd 100644 --- a/glance/store/__init__.py +++ b/glance/store/__init__.py @@ -53,10 +53,8 @@ _ALL_STORES = [ diff --git a/0004-notify-calling-process-we-are-ready-to-serve.patch b/0004-notify-calling-process-we-are-ready-to-serve.patch index 9b64775..db3259c 100644 --- a/0004-notify-calling-process-we-are-ready-to-serve.patch +++ b/0004-notify-calling-process-we-are-ready-to-serve.patch @@ -1,4 +1,4 @@ -From 5bde10a187244e39d32b42c82bc108279b2dd9a7 Mon Sep 17 00:00:00 2001 +From bedcf16700210711395ccd1c7d5e8bd7bf3f359e Mon Sep 17 00:00:00 2001 From: Alan Pevec Date: Tue, 11 Feb 2014 22:36:00 +0100 Subject: [PATCH] notify calling process we are ready to serve @@ -39,18 +39,18 @@ Change-Id: I80f325c9be9c171c2dc8d5526570bf64f0f87c78 create mode 100644 glance/openstack/common/systemd.py diff --git a/glance/cmd/api.py b/glance/cmd/api.py -index 73c79a1..e64cf1a 100755 +index 3860e32..47bc3d8 100755 --- a/glance/cmd/api.py +++ b/glance/cmd/api.py -@@ -43,6 +43,7 @@ from glance.common import config - from glance.common import exception +@@ -48,6 +48,7 @@ from glance.common import exception from glance.common import wsgi + from glance import notifier from glance.openstack.common import log +from glance.openstack.common import systemd import glance.store - -@@ -61,6 +62,7 @@ def main(): + CONF = cfg.CONF +@@ -80,6 +81,7 @@ def main(): server = wsgi.Server() server.start(config.load_paste_app('glance-api'), default_port=9292) @@ -59,18 +59,18 @@ index 73c79a1..e64cf1a 100755 except exception.WorkerCreationFailure as e: fail(2, e) diff --git a/glance/cmd/registry.py b/glance/cmd/registry.py -index 23623a8..4cbc798 100755 +index 06cea6a..e0dfbab 100755 --- a/glance/cmd/registry.py +++ b/glance/cmd/registry.py -@@ -39,6 +39,7 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')): - from glance.common import config +@@ -44,6 +44,7 @@ from glance.common import config from glance.common import wsgi + from glance import notifier from glance.openstack.common import log +from glance.openstack.common import systemd - - def main(): -@@ -49,6 +50,7 @@ def main(): + CONF = cfg.CONF + CONF.import_group("profiler", "glance.common.wsgi") +@@ -69,6 +70,7 @@ def main(): server = wsgi.Server() server.start(config.load_paste_app('glance-registry'), default_port=9191) diff --git a/0005-Enforce-image_size_cap-on-v2-upload.patch b/0005-Enforce-image_size_cap-on-v2-upload.patch deleted file mode 100644 index b39e048..0000000 --- a/0005-Enforce-image_size_cap-on-v2-upload.patch +++ /dev/null @@ -1,175 +0,0 @@ -From adc58d9d002217c1304d3baebb87943e914600d4 Mon Sep 17 00:00:00 2001 -From: Tom Leaman -Date: Fri, 2 May 2014 10:09:20 +0000 -Subject: [PATCH] Enforce image_size_cap on v2 upload - -image_size_cap should be checked and enforced on upload - -Enforcement is in two places: -- on image metadata save -- during image save to backend store - -Closes-Bug: 1315321 -Change-Id: I45bfb360703617bc394e9e27fe17adf43b09c0e1 -Co-Author: Manuel Desbonnet ---- - glance/db/__init__.py | 5 ++++ - glance/location.py | 5 +++- - glance/tests/functional/__init__.py | 2 ++ - glance/tests/functional/v2/test_images.py | 42 +++++++++++++++++++++++++++++++ - glance/tests/unit/test_store_image.py | 6 +++-- - glance/tests/unit/utils.py | 5 +++- - 6 files changed, 61 insertions(+), 4 deletions(-) - -diff --git a/glance/db/__init__.py b/glance/db/__init__.py -index 0289ce8..0a7e4ec 100644 ---- a/glance/db/__init__.py -+++ b/glance/db/__init__.py -@@ -27,6 +27,7 @@ from glance.openstack.common import importutils - - - CONF = cfg.CONF -+CONF.import_opt('image_size_cap', 'glance.common.config') - CONF.import_opt('metadata_encryption_key', 'glance.common.config') - - -@@ -150,6 +151,8 @@ class ImageRepo(object): - - def add(self, image): - image_values = self._format_image_to_db(image) -+ if image_values['size'] > CONF.image_size_cap: -+ raise exception.ImageSizeLimitExceeded - # the updated_at value is not set in the _format_image_to_db - # function since it is specific to image create - image_values['updated_at'] = image.updated_at -@@ -161,6 +164,8 @@ class ImageRepo(object): - - def save(self, image): - image_values = self._format_image_to_db(image) -+ if image_values['size'] > CONF.image_size_cap: -+ raise exception.ImageSizeLimitExceeded - try: - new_values = self.db_api.image_update(self.context, - image.image_id, -diff --git a/glance/location.py b/glance/location.py -index be43207..9fe0605 100644 ---- a/glance/location.py -+++ b/glance/location.py -@@ -354,7 +354,10 @@ class ImageProxy(glance.domain.proxy.Image): - size = 0 # NOTE(markwash): zero -> unknown size - location, size, checksum, loc_meta = self.store_api.add_to_backend( - self.context, CONF.default_store, -- self.image.image_id, utils.CooperativeReader(data), size) -+ self.image.image_id, -+ utils.LimitingReader(utils.CooperativeReader(data), -+ CONF.image_size_cap), -+ size) - self.image.locations = [{'url': location, 'metadata': loc_meta, - 'status': 'active'}] - self.image.size = size -diff --git a/glance/tests/functional/__init__.py b/glance/tests/functional/__init__.py -index 301f38e..774c08b 100644 ---- a/glance/tests/functional/__init__.py -+++ b/glance/tests/functional/__init__.py -@@ -279,6 +279,7 @@ class ApiServer(Server): - self.pid_file = pid_file or os.path.join(self.test_dir, "api.pid") - self.scrubber_datadir = os.path.join(self.test_dir, "scrubber") - self.log_file = os.path.join(self.test_dir, "api.log") -+ self.image_size_cap = 1099511627776 - self.s3_store_host = "s3.amazonaws.com" - self.s3_store_access_key = "" - self.s3_store_secret_key = "" -@@ -342,6 +343,7 @@ metadata_encryption_key = %(metadata_encryption_key)s - registry_host = 127.0.0.1 - registry_port = %(registry_port)s - log_file = %(log_file)s -+image_size_cap = %(image_size_cap)d - s3_store_host = %(s3_store_host)s - s3_store_access_key = %(s3_store_access_key)s - s3_store_secret_key = %(s3_store_secret_key)s -diff --git a/glance/tests/functional/v2/test_images.py b/glance/tests/functional/v2/test_images.py -index efd067a..3f9651d 100644 ---- a/glance/tests/functional/v2/test_images.py -+++ b/glance/tests/functional/v2/test_images.py -@@ -520,6 +520,48 @@ class TestImages(functional.FunctionalTest): - - self.stop_servers() - -+ def test_image_size_cap(self): -+ self.api_server.image_size_cap = 128 -+ self.start_servers(**self.__dict__.copy()) -+ # create an image -+ path = self._url('/v2/images') -+ headers = self._headers({'content-type': 'application/json'}) -+ data = jsonutils.dumps({'name': 'image-size-cap-test-image', -+ 'type': 'kernel', 'disk_format': 'aki', -+ 'container_format': 'aki'}) -+ response = requests.post(path, headers=headers, data=data) -+ self.assertEqual(201, response.status_code) -+ -+ image = jsonutils.loads(response.text) -+ image_id = image['id'] -+ -+ #try to populate it with oversized data -+ path = self._url('/v2/images/%s/file' % image_id) -+ headers = self._headers({'Content-Type': 'application/octet-stream'}) -+ -+ class StreamSim(object): -+ # Using a one-shot iterator to force chunked transfer in the PUT -+ # request -+ def __init__(self, size): -+ self.size = size -+ -+ def __iter__(self): -+ yield 'Z' * self.size -+ -+ response = requests.put(path, headers=headers, data=StreamSim( -+ self.api_server.image_size_cap + 1)) -+ self.assertEqual(413, response.status_code) -+ -+ # hashlib.md5('Z'*129).hexdigest() -+ # == '76522d28cb4418f12704dfa7acd6e7ee' -+ # If the image has this checksum, it means that the whole stream was -+ # accepted and written to the store, which should not be the case. -+ path = self._url('/v2/images/{0}'.format(image_id)) -+ headers = self._headers({'content-type': 'application/json'}) -+ response = requests.get(path, headers=headers) -+ image_checksum = jsonutils.loads(response.text).get('checksum') -+ self.assertNotEqual(image_checksum, '76522d28cb4418f12704dfa7acd6e7ee') -+ - def test_permissions(self): - self.start_servers(**self.__dict__.copy()) - # Create an image that belongs to TENANT1 -diff --git a/glance/tests/unit/test_store_image.py b/glance/tests/unit/test_store_image.py -index d6e7fbf..032ca37 100644 ---- a/glance/tests/unit/test_store_image.py -+++ b/glance/tests/unit/test_store_image.py -@@ -124,8 +124,10 @@ class TestStoreImage(utils.BaseTestCase): - - self.stubs.Set(unit_test_utils.FakeStoreAPI, 'get_from_backend', - fake_get_from_backend) -- -- self.assertEqual(image1.get_data().fd, 'ZZZ') -+ # This time, image1.get_data() returns the data wrapped in a -+ # LimitingReader|CooperativeReader pipeline, so peeking under -+ # the hood of those objects to get at the underlying string. -+ self.assertEqual(image1.get_data().data.fd, 'ZZZ') - image1.locations.pop(0) - self.assertEqual(len(image1.locations), 1) - image2.delete() -diff --git a/glance/tests/unit/utils.py b/glance/tests/unit/utils.py -index d16ff79..66e18d4 100644 ---- a/glance/tests/unit/utils.py -+++ b/glance/tests/unit/utils.py -@@ -160,7 +160,10 @@ class FakeStoreAPI(object): - if image_id in location: - raise exception.Duplicate() - if not size: -- size = len(data.fd) -+ # 'data' is a string wrapped in a LimitingReader|CooperativeReader -+ # pipeline, so peek under the hood of those objects to get at the -+ # string itself. -+ size = len(data.data.fd) - if (current_store_size + size) > store_max_size: - raise exception.StorageFull() - if context.user == USER2: diff --git a/openstack-glance.spec b/openstack-glance.spec index 33d8042..4f52f7b 100644 --- a/openstack-glance.spec +++ b/openstack-glance.spec @@ -1,12 +1,15 @@ +%global release_name juno +%global milestone 3 + Name: openstack-glance Version: 2014.2 -Release: 0.4.b2%{?dist} +Release: 0.5.b%{milestone}%{?dist} Summary: OpenStack Image Service Group: Applications/System License: ASL 2.0 URL: http://glance.openstack.org -Source0: https://launchpad.net/glance/juno/juno-2/+download/glance-%{version}.b2.tar.gz +Source0: https://launchpad.net/glance/%{release_name}/%{release_name}-%{milestone}/+download/glance-%{version}.b%{milestone}.tar.gz Source1: openstack-glance-api.service Source2: openstack-glance-registry.service @@ -19,13 +22,12 @@ Source7: glance-cache-dist.conf Source8: glance-scrubber-dist.conf # -# patches_base=2014.2.b2 +# patches_base=2014.2.b3 # Patch0001: 0001-Don-t-access-the-net-while-building-docs.patch Patch0002: 0002-Remove-runtime-dep-on-python-pbr.patch Patch0003: 0003-avoid-unsupported-storage-drivers.patch Patch0004: 0004-notify-calling-process-we-are-ready-to-serve.patch -Patch0005: 0005-Enforce-image_size_cap-on-v2-upload.patch BuildArch: noarch BuildRequires: python2-devel @@ -124,13 +126,12 @@ and delivery services for virtual disk images. This package contains documentation files for glance. %prep -%setup -q -n glance-%{version}.b2 +%setup -q -n glance-%{version}.b%{milestone} %patch0001 -p1 %patch0002 -p1 %patch0003 -p1 %patch0004 -p1 -%patch0005 -p1 # Remove bundled egg-info rm -rf glance.egg-info @@ -322,6 +323,9 @@ exit 0 %doc doc/build/html %changelog +* Thu Sep 11 2014 Haikel Guemar 2014.2-0.5.b2 +- Update to Juno milestone 3 + * Fri Sep 05 2014 Alan Pevec - 2014.2-0.4.b2 - add missing dependencies