diff options
author | Peter Portante <peter.portante@redhat.com> | 2012-11-07 12:37:26 -0500 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-11-16 04:52:06 -0800 |
commit | e8d95655d5e73462723799d20e59bc4f21bdf973 (patch) | |
tree | b1e37a514241340834896e51e6127bff6c577e75 /swift/1.4.8/test/unit/plugins/test_utils.py | |
parent | 05cc14c2d301934d79ee37cd36f498247b7a9886 (diff) |
object-storage: refactor to use swift devices
Refactor code to use the devices configuration file setting for account,
container, and object servers, dropping mount_path from the fs.conf file, and
constructing new account, container and object server rings.
This removes the next to last set of diffs in the swift diff file. See BZ
870589 (https://bugzilla.redhat.com/show_bug.cgi?id=870589).
The key to the change is the dropping of the pre-built account, container and
object rings, instead providing a script that will generate them for the user
given the gluster volume name in use. In addition, we override the Swift
check_mount() method and replace it with Gluster's which attempts to
"auto-mount" if it is not already mounted.
The following is an enumeration of the changes contained in this refactoring:
* The refactoring to override the Swift check_mount() involved condensing
a lot of code, removing redundancies and simplifying methods across a
number of modules
* Drop checking the mount point in the low level DiskDir, DiskAccount and
DiskFile objects now that Swift's normal mount checking is used, and
enable it by default in the template configuration file
* Add missing get_container_timestamp() method for DiskAccount objects
* Fix the plugin RPM spec file to provide the new ring builders, and while
we were at it, finally fix the over-writing of the configuration files
on install
* Bug fixes
* The monkey patched version of check_object_creation was not working
correctly due to a missing import of HTTPBadRequest and a bad
reference to validate_obj_name_component()
* Only have the utils module import the plugins constraints module for
the side effect of monkey patching if gluster is enabled
* Removed the db_file.db file in the tree since it is created on the
fly
* Updated 2011 copyright notices to 2012
Change-Id: I8f4454576b1423021c9bbf3c36176f8db51e62c0
BUG: 870589
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Reviewed-on: http://review.gluster.org/4179
Reviewed-by: Pete Zaitcev <zaitcev@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Mohammed Junaid <junaid@redhat.com>
Diffstat (limited to 'swift/1.4.8/test/unit/plugins/test_utils.py')
-rw-r--r-- | swift/1.4.8/test/unit/plugins/test_utils.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/swift/1.4.8/test/unit/plugins/test_utils.py b/swift/1.4.8/test/unit/plugins/test_utils.py index e46c0adbd0b..92c7ff00571 100644 --- a/swift/1.4.8/test/unit/plugins/test_utils.py +++ b/swift/1.4.8/test/unit/plugins/test_utils.py @@ -26,7 +26,7 @@ import tarfile import shutil from collections import defaultdict from swift.common.utils import normalize_timestamp -from swift.plugins import utils, Glusterfs +from swift.plugins import utils # # Somewhat hacky way of emulating the operation of xattr calls. They are made @@ -542,7 +542,7 @@ class TestUtils(unittest.TestCase): self.st_mtime = mtime return MockStat(100) cd = mock_get_container_details_from_fs(the_path, bu_p=6) - mc.set(utils.MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + Glusterfs.strip_obj_storage_path(the_path), cd) + mc.set(utils.MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + the_path, cd) orig_gcdff = utils._get_container_details_from_fs utils._get_container_details_from_fs = mock_get_container_details_from_fs orig_ds = utils.do_stat @@ -571,7 +571,7 @@ class TestUtils(unittest.TestCase): # Be sure we don't miss due to mtimes not matching self.fail("do_stat should not have been called") cd = mock_get_container_details_from_fs(the_path + "u", bu_p=6) - mc.set(utils.MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + Glusterfs.strip_obj_storage_path(the_path + "u"), cd) + mc.set(utils.MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + the_path + "u", cd) orig_gcdff = utils._get_container_details_from_fs utils._get_container_details_from_fs = mock_get_container_details_from_fs orig_ds = utils.do_stat @@ -580,7 +580,7 @@ class TestUtils(unittest.TestCase): retval = utils.get_container_details(the_path, memcache=mc) cd = mock_get_container_details_from_fs(the_path) assert retval == (cd.obj_list, cd.object_count, cd.bytes_used) - mkey = utils.MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + Glusterfs.strip_obj_storage_path(the_path) + mkey = utils.MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + the_path assert mkey in mc._d finally: utils._get_container_details_from_fs = orig_gcdff @@ -599,7 +599,7 @@ class TestUtils(unittest.TestCase): # Be sure we don't miss due to mtimes not matching self.fail("do_stat should not have been called") cd = mock_get_container_details_from_fs(the_path, bu_p=6) - mc.set(utils.MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + Glusterfs.strip_obj_storage_path(the_path), cd) + mc.set(utils.MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + the_path, cd) orig_gcdff = utils._get_container_details_from_fs utils._get_container_details_from_fs = mock_get_container_details_from_fs orig_ds = utils.do_stat @@ -608,7 +608,7 @@ class TestUtils(unittest.TestCase): retval = utils.get_container_details(the_path, memcache=mc) cd = mock_get_container_details_from_fs(the_path) assert retval == (cd.obj_list, cd.object_count, cd.bytes_used) - mkey = utils.MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + Glusterfs.strip_obj_storage_path(the_path) + mkey = utils.MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + the_path assert mkey in mc._d assert 5 == mc._d[mkey].bytes_used finally: @@ -631,7 +631,7 @@ class TestUtils(unittest.TestCase): self.st_mtime = mtime return MockStat(200) cd = mock_get_container_details_from_fs(the_path, bu_p=6) - mc.set(utils.MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + Glusterfs.strip_obj_storage_path(the_path), cd) + mc.set(utils.MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + the_path, cd) orig_gcdff = utils._get_container_details_from_fs utils._get_container_details_from_fs = mock_get_container_details_from_fs orig_ds = utils.do_stat @@ -640,7 +640,7 @@ class TestUtils(unittest.TestCase): retval = utils.get_container_details(the_path, memcache=mc) cd = mock_get_container_details_from_fs(the_path) assert retval == (cd.obj_list, cd.object_count, cd.bytes_used) - mkey = utils.MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + Glusterfs.strip_obj_storage_path(the_path) + mkey = utils.MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + the_path assert mkey in mc._d assert 5 == mc._d[mkey].bytes_used finally: @@ -678,7 +678,7 @@ class TestUtils(unittest.TestCase): return MockStat(100) ad = mock_get_account_details_from_fs(the_path, None) ad.container_list = ['x', 'y'] - mc.set(utils.MEMCACHE_ACCOUNT_DETAILS_KEY_PREFIX + Glusterfs.strip_obj_storage_path(the_path), ad) + mc.set(utils.MEMCACHE_ACCOUNT_DETAILS_KEY_PREFIX + the_path, ad) orig_gcdff = utils._get_account_details_from_fs orig_ds = utils.do_stat utils._get_account_details_from_fs = mock_get_account_details_from_fs @@ -707,7 +707,7 @@ class TestUtils(unittest.TestCase): return MockStat(100) ad = mock_get_account_details_from_fs(the_path, None) ad.container_list = ['x', 'y'] - mc.set(utils.MEMCACHE_ACCOUNT_DETAILS_KEY_PREFIX + Glusterfs.strip_obj_storage_path(the_path + 'u'), ad) + mc.set(utils.MEMCACHE_ACCOUNT_DETAILS_KEY_PREFIX + the_path + 'u', ad) orig_gcdff = utils._get_account_details_from_fs orig_ds = utils.do_stat utils._get_account_details_from_fs = mock_get_account_details_from_fs @@ -737,7 +737,7 @@ class TestUtils(unittest.TestCase): ad = mock_get_account_details_from_fs(the_path, None) ad.container_list = ['x', 'y'] ad.mtime = 200 - mc.set(utils.MEMCACHE_ACCOUNT_DETAILS_KEY_PREFIX + Glusterfs.strip_obj_storage_path(the_path), ad) + mc.set(utils.MEMCACHE_ACCOUNT_DETAILS_KEY_PREFIX + the_path, ad) orig_gcdff = utils._get_account_details_from_fs orig_ds = utils.do_stat utils._get_account_details_from_fs = mock_get_account_details_from_fs |