diff options
author | Peter Portante <peter.portante@redhat.com> | 2012-11-08 01:16:56 -0500 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-11-16 04:52:26 -0800 |
commit | 1129698a490ac9266b1f613fababdf524e11f887 (patch) | |
tree | 0a4e22d7657c66cd36ce759bc095cba96eae95b4 /swift/1.4.8/swift.diff | |
parent | e8d95655d5e73462723799d20e59bc4f21bdf973 (diff) |
object-storage: final changes to remove swift diff
Final set of changes to remove the diffs carried to make UFO work with
OpenStack Swift. The code is now a complete layering on top of OpenStack Swift
where we either "monkey patch" or subclass as necessary.
See BZ 870589 (https://bugzilla.redhat.com/show_bug.cgi?id=870589).
There are a lot of changes here due for the most part to rearranging the
directory hierarchy to have create a proper python module hierarchy under the
"gluster" namespace. Plugin references have been removed. The differences that
used to be in the swift.diff file are now replaced with server implementations
for account, container, object, and proxy that subclass the swift versions.
Additionally, the plugins/conf directory has been moved to the "etc"
directory, and the plugins/bin directory promoted a level.
Unit tests pass.
A new setup.py file is provided so that the install process can use it for
creating all the necessary python install infrastructure (eggs and paste
support).
A new RPM spec file is provided which to properly install the new code, and
the sample configuration files have been modified to reference the new python
egg.
Change-Id: I4316c1b66dca80f847fe9b0d583174689c175599
BUG: 870589
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Reviewed-on: http://review.gluster.org/4180
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Mohammed Junaid <junaid@redhat.com>
Tested-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'swift/1.4.8/swift.diff')
-rw-r--r-- | swift/1.4.8/swift.diff | 174 |
1 files changed, 0 insertions, 174 deletions
diff --git a/swift/1.4.8/swift.diff b/swift/1.4.8/swift.diff deleted file mode 100644 index 59bbbe262..000000000 --- a/swift/1.4.8/swift.diff +++ /dev/null @@ -1,174 +0,0 @@ -diff --git a/setup.py b/setup.py -index d195d34..ef625ff 100644 ---- a/setup.py -+++ b/setup.py -@@ -1,5 +1,6 @@ - #!/usr/bin/python - # Copyright (c) 2010-2012 OpenStack, LLC. -+# Copyright (c) 2012 Red Hat, Inc. - # - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. -@@ -94,6 +95,7 @@ setup( - 'tempurl=swift.common.middleware.tempurl:filter_factory', - 'formpost=swift.common.middleware.formpost:filter_factory', - 'name_check=swift.common.middleware.name_check:filter_factory', -+ 'gluster=swift.plugins.middleware.gluster:filter_factory', - ], - }, - ) -diff --git a/swift/account/server.py b/swift/account/server.py -index 800b3c0..eaf9e0d 100644 ---- a/swift/account/server.py -+++ b/swift/account/server.py -@@ -1,4 +1,5 @@ - # Copyright (c) 2010-2012 OpenStack, LLC. -+# Copyright (c) 2012 Red Hat, Inc. - # - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. -@@ -29,6 +30,10 @@ from webob.exc import HTTPAccepted, HTTPBadRequest, \ - HTTPPreconditionFailed, HTTPConflict - import simplejson - -+from swift.plugins.utils import Gluster_enabled -+if Gluster_enabled(): -+ from swift.plugins.DiskDir import DiskAccount -+ - from swift.common.db import AccountBroker - from swift.common.utils import get_logger, get_param, hash_path, \ - normalize_timestamp, split_path, storage_directory -@@ -54,6 +59,8 @@ class AccountController(object): - conf.get('auto_create_account_prefix') or '.' - - def _get_account_broker(self, drive, part, account): -+ if Gluster_enabled(): -+ return DiskAccount(self.root, account, self.logger) - hsh = hash_path(account) - db_dir = storage_directory(DATADIR, part, hsh) - db_path = os.path.join(self.root, drive, db_dir, hsh + '.db') -diff --git a/swift/container/server.py b/swift/container/server.py -index 8a18cfd..3da0f95 100644 ---- a/swift/container/server.py -+++ b/swift/container/server.py -@@ -1,4 +1,5 @@ - # Copyright (c) 2010-2012 OpenStack, LLC. -+# Copyright (c) 2012 Red Hat, Inc. - # - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. -@@ -29,6 +30,10 @@ from webob.exc import HTTPAccepted, HTTPBadRequest, HTTPConflict, \ - HTTPCreated, HTTPInternalServerError, HTTPNoContent, \ - HTTPNotFound, HTTPPreconditionFailed, HTTPMethodNotAllowed - -+from swift.plugins.utils import Gluster_enabled -+if Gluster_enabled(): -+ from swift.plugins.DiskDir import DiskDir -+ - from swift.common.db import ContainerBroker - from swift.common.utils import get_logger, get_param, hash_path, \ - normalize_timestamp, storage_directory, split_path, validate_sync_to -@@ -73,6 +78,8 @@ class ContainerController(object): - :param container: container name - :returns: ContainerBroker object - """ -+ if Gluster_enabled(): -+ return DiskDir(self.root, account, container, self.logger) - hsh = hash_path(account, container) - db_dir = storage_directory(DATADIR, part, hsh) - db_path = os.path.join(self.root, drive, db_dir, hsh + '.db') -diff --git a/swift/obj/server.py b/swift/obj/server.py -index 9cca16b..448ea5c 100644 ---- a/swift/obj/server.py -+++ b/swift/obj/server.py -@@ -1,4 +1,5 @@ - # Copyright (c) 2010-2012 OpenStack, LLC. -+# Copyright (c) 2012 Red Hat, Inc. - # - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. -@@ -35,6 +36,8 @@ from webob.exc import HTTPAccepted, HTTPBadRequest, HTTPCreated, \ - from xattr import getxattr, setxattr - from eventlet import sleep, Timeout, tpool - -+from swift.plugins.utils import Gluster_enabled -+ - from swift.common.utils import mkdirs, normalize_timestamp, \ - storage_directory, hash_path, renamer, fallocate, \ - split_path, drop_buffer_cache, get_logger, write_pickle -@@ -340,6 +343,10 @@ class DiskFile(object): - raise DiskFileNotExist('Data File does not exist.') - - -+if Gluster_enabled(): -+ from swift.plugins.DiskFile import Gluster_DiskFile -+ -+ - class ObjectController(object): - """Implements the WSGI application for the Swift Object Server.""" - -@@ -378,6 +385,15 @@ class ObjectController(object): - self.expiring_objects_container_divisor = \ - int(conf.get('expiring_objects_container_divisor') or 86400) - -+ def get_DiskFile_obj(self, path, device, partition, account, container, obj, -+ logger, keep_data_fp=False, disk_chunk_size=65536): -+ if Gluster_enabled(): -+ return Gluster_DiskFile(path, device, partition, account, container, -+ obj, logger, keep_data_fp, disk_chunk_size) -+ else: -+ return DiskFile(path, device, partition, account, container, -+ obj, logger, keep_data_fp, disk_chunk_size) -+ - def async_update(self, op, account, container, obj, host, partition, - contdevice, headers_out, objdevice): - """ -@@ -493,7 +509,7 @@ class ObjectController(object): - content_type='text/plain') - if self.mount_check and not check_mount(self.devices, device): - return Response(status='507 %s is not mounted' % device) -- file = DiskFile(self.devices, device, partition, account, container, -+ file = self.get_DiskFile_obj(self.devices, device, partition, account, container, - obj, self.logger, disk_chunk_size=self.disk_chunk_size) - - if 'X-Delete-At' in file.metadata and \ -@@ -548,7 +564,7 @@ class ObjectController(object): - if new_delete_at and new_delete_at < time.time(): - return HTTPBadRequest(body='X-Delete-At in past', request=request, - content_type='text/plain') -- file = DiskFile(self.devices, device, partition, account, container, -+ file = self.get_DiskFile_obj(self.devices, device, partition, account, container, - obj, self.logger, disk_chunk_size=self.disk_chunk_size) - orig_timestamp = file.metadata.get('X-Timestamp') - upload_expiration = time.time() + self.max_upload_time -@@ -626,9 +642,9 @@ class ObjectController(object): - content_type='text/plain') - if self.mount_check and not check_mount(self.devices, device): - return Response(status='507 %s is not mounted' % device) -- file = DiskFile(self.devices, device, partition, account, container, -- obj, self.logger, keep_data_fp=True, -- disk_chunk_size=self.disk_chunk_size) -+ file = self.get_DiskFile_obj(self.devices, device, partition, account, container, -+ obj, self.logger, keep_data_fp=True, -+ disk_chunk_size=self.disk_chunk_size) - if file.is_deleted() or ('X-Delete-At' in file.metadata and - int(file.metadata['X-Delete-At']) <= time.time()): - if request.headers.get('if-match') == '*': -@@ -702,7 +718,7 @@ class ObjectController(object): - return resp - if self.mount_check and not check_mount(self.devices, device): - return Response(status='507 %s is not mounted' % device) -- file = DiskFile(self.devices, device, partition, account, container, -+ file = self.get_DiskFile_obj(self.devices, device, partition, account, container, - obj, self.logger, disk_chunk_size=self.disk_chunk_size) - if file.is_deleted() or ('X-Delete-At' in file.metadata and - int(file.metadata['X-Delete-At']) <= time.time()): -@@ -744,7 +760,7 @@ class ObjectController(object): - if self.mount_check and not check_mount(self.devices, device): - return Response(status='507 %s is not mounted' % device) - response_class = HTTPNoContent -- file = DiskFile(self.devices, device, partition, account, container, -+ file = self.get_DiskFile_obj(self.devices, device, partition, account, container, - obj, self.logger, disk_chunk_size=self.disk_chunk_size) - if 'x-if-delete-at' in request.headers and \ - int(request.headers['x-if-delete-at']) != \ |