summaryrefslogtreecommitdiffstats
path: root/ufo/gluster/swift/common/utils.py
diff options
context:
space:
mode:
authorPeter Portante <peter.portante@redhat.com>2013-04-04 13:08:32 -0400
committerAnand Avati <avati@redhat.com>2013-04-05 11:20:37 -0700
commit6a7d28c0f8c107baf376eceb9fc05d9e80bf74e5 (patch)
tree05adcb9cfab21adca87401032df6222239ef74d5 /ufo/gluster/swift/common/utils.py
parenta56dca94c3b174637074be46e9a537ba0ca02c4b (diff)
object-storage: use tox for unit tests; fix em too
Add the ability to use tox for unit tests, since it helps us solve the problem of supporting multiple branches that require different versions of dependencies, and allows us to possibly support multiple versions of python in the future. Also fix the code to work with pre-grizzly environments, by not requiring the constraints backport. Also fixed the xattr support to work with both pyxattr and xattr modules. And fixed the ring tests to also work without a live /etc/swift directory. BUG: 948657 (https://bugzilla.redhat.com/show_bug.cgi?id=948657) Change-Id: I2be79c8ef8916bb6552ef957094f9186a963a068 Signed-off-by: Peter Portante <peter.portante@redhat.com> Reviewed-on: http://review.gluster.org/4781 Reviewed-by: Alex Wheeler <wheelear@gmail.com> Tested-by: Alex Wheeler <wheelear@gmail.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'ufo/gluster/swift/common/utils.py')
-rw-r--r--ufo/gluster/swift/common/utils.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/ufo/gluster/swift/common/utils.py b/ufo/gluster/swift/common/utils.py
index a8e50081..7e9f8a60 100644
--- a/ufo/gluster/swift/common/utils.py
+++ b/ufo/gluster/swift/common/utils.py
@@ -70,7 +70,7 @@ def read_metadata(path):
key = 0
while metadata is None:
try:
- metadata_s += xattr.get(path, '%s%s' % (METADATA_KEY, (key or '')))
+ metadata_s += xattr.getxattr(path, '%s%s' % (METADATA_KEY, (key or '')))
except IOError as err:
if err.errno == errno.ENODATA:
if key > 0:
@@ -86,7 +86,7 @@ def read_metadata(path):
# to the caller we have no metadata.
metadata = {}
else:
- logging.exception("xattr.get failed on %s key %s err: %s",
+ logging.exception("xattr.getxattr failed on %s key %s err: %s",
path, key, str(err))
# Note that we don't touch the keys on errors fetching the
# data since it could be a transient state.
@@ -120,9 +120,9 @@ def write_metadata(path, metadata):
key = 0
while metastr:
try:
- xattr.set(path, '%s%s' % (METADATA_KEY, key or ''), metastr[:MAX_XATTR_SIZE])
+ xattr.setxattr(path, '%s%s' % (METADATA_KEY, key or ''), metastr[:MAX_XATTR_SIZE])
except IOError as err:
- logging.exception("xattr.set failed on %s key %s err: %s", path, key, str(err))
+ logging.exception("setxattr failed on %s key %s err: %s", path, key, str(err))
raise
metastr = metastr[MAX_XATTR_SIZE:]
key += 1
@@ -131,7 +131,7 @@ def clean_metadata(path):
key = 0
while True:
try:
- xattr.remove(path, '%s%s' % (METADATA_KEY, (key or '')))
+ xattr.removexattr(path, '%s%s' % (METADATA_KEY, (key or '')))
except IOError as err:
if err.errno == errno.ENODATA:
break
@@ -142,12 +142,12 @@ def check_user_xattr(path):
if not os_path.exists(path):
return False
try:
- xattr.set(path, 'user.test.key1', 'value1')
+ xattr.setxattr(path, 'user.test.key1', 'value1')
except IOError as err:
logging.exception("check_user_xattr: set failed on %s err: %s", path, str(err))
raise
try:
- xattr.remove(path, 'user.test.key1')
+ xattr.removexattr(path, 'user.test.key1')
except IOError as err:
logging.exception("check_user_xattr: remove failed on %s err: %s", path, str(err))
#Remove xattr may fail in case of concurrent remove.