summaryrefslogtreecommitdiffstats
path: root/swift/1.4.8/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'swift/1.4.8/plugins')
-rw-r--r--swift/1.4.8/plugins/DiskDir.py17
-rw-r--r--swift/1.4.8/plugins/DiskFile.py18
-rw-r--r--swift/1.4.8/plugins/Glusterfs.py83
-rwxr-xr-xswift/1.4.8/plugins/bin/gluster-swift-gen-builders19
-rw-r--r--swift/1.4.8/plugins/conf/account-server/1.conf-gluster6
-rw-r--r--swift/1.4.8/plugins/conf/account.builderbin786843 -> 0 bytes
-rw-r--r--swift/1.4.8/plugins/conf/account.ring.gzbin739 -> 0 bytes
-rw-r--r--swift/1.4.8/plugins/conf/container-server/1.conf-gluster6
-rw-r--r--swift/1.4.8/plugins/conf/container.builderbin786843 -> 0 bytes
-rw-r--r--swift/1.4.8/plugins/conf/container.ring.gzbin741 -> 0 bytes
-rw-r--r--swift/1.4.8/plugins/conf/db_file.db0
-rw-r--r--swift/1.4.8/plugins/conf/fs.conf-gluster3
-rw-r--r--swift/1.4.8/plugins/conf/object-server/1.conf-gluster6
-rw-r--r--swift/1.4.8/plugins/conf/object.builderbin786843 -> 0 bytes
-rw-r--r--swift/1.4.8/plugins/conf/object.ring.gzbin738 -> 0 bytes
-rw-r--r--swift/1.4.8/plugins/conf/proxy-server.conf-gluster14
-rw-r--r--swift/1.4.8/plugins/constraints.py25
-rw-r--r--swift/1.4.8/plugins/fs_utils.py2
-rw-r--r--swift/1.4.8/plugins/utils.py70
19 files changed, 139 insertions, 130 deletions
diff --git a/swift/1.4.8/plugins/DiskDir.py b/swift/1.4.8/plugins/DiskDir.py
index 6887bec6c..b12827c58 100644
--- a/swift/1.4.8/plugins/DiskDir.py
+++ b/swift/1.4.8/plugins/DiskDir.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 Red Hat, Inc.
+# 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.
@@ -16,16 +16,15 @@
import os, errno
from swift.plugins.utils import clean_metadata, dir_empty, rmdirs, mkdirs, \
- validate_account, validate_container, check_valid_account, is_marker, \
- get_container_details, get_account_details, get_container_metadata, \
- create_container_metadata, \
+ validate_account, validate_container, is_marker, get_container_details, \
+ get_account_details, get_container_metadata, create_container_metadata, \
create_account_metadata, DEFAULT_GID, DEFAULT_UID, validate_object, \
create_object_metadata, read_metadata, write_metadata, X_CONTENT_TYPE, \
X_CONTENT_LENGTH, X_TIMESTAMP, X_PUT_TIMESTAMP, X_TYPE, X_ETAG, \
X_OBJECTS_COUNT, X_BYTES_USED, X_CONTAINER_COUNT, CONTAINER
from swift.plugins import Glusterfs
-from swift.common.constraints import CONTAINER_LISTING_LIMIT, check_mount
+from swift.common.constraints import CONTAINER_LISTING_LIMIT
from swift.common.utils import normalize_timestamp, TRUE_VALUES
@@ -163,8 +162,6 @@ class DiskDir(DiskCommon):
# Note that the account name has a one-to-one mapping to the gluster
# mount point, or volume name.
self.account = account
- if not check_mount(path, account):
- check_valid_account(account)
assert logger is not None
self.logger = logger
self.metadata = {}
@@ -494,3 +491,9 @@ class DiskAccount(DiskDir):
if include_metadata:
data['metadata'] = self.metadata
return data
+
+ def get_container_timestamp(self, container):
+ cont_path = os.path.join(self.datadir, container)
+ metadata = read_metadata(cont_path)
+
+ return int(metadata.get(X_PUT_TIMESTAMP, ('0',0))[0]) or None
diff --git a/swift/1.4.8/plugins/DiskFile.py b/swift/1.4.8/plugins/DiskFile.py
index 61b1c9cf9..a57b2ece3 100644
--- a/swift/1.4.8/plugins/DiskFile.py
+++ b/swift/1.4.8/plugins/DiskFile.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 Red Hat, Inc.
+# 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.
@@ -19,14 +19,12 @@ from tempfile import mkstemp
from contextlib import contextmanager
from swift.common.utils import normalize_timestamp, renamer
from swift.plugins.utils import mkdirs, rmdirs, validate_object, \
- check_valid_account, create_object_metadata, do_open, \
- do_close, do_unlink, do_chown, do_stat, do_listdir, read_metadata,\
- write_metadata
-from swift.common.constraints import check_mount
-from swift.plugins.utils import X_CONTENT_TYPE, X_CONTENT_LENGTH, X_TIMESTAMP,\
+ create_object_metadata, do_open, do_close, do_unlink, do_chown, \
+ do_stat, do_listdir, read_metadata, write_metadata
+from swift.plugins.utils import X_CONTENT_TYPE, X_CONTENT_LENGTH, X_TIMESTAMP, \
X_PUT_TIMESTAMP, X_TYPE, X_ETAG, X_OBJECTS_COUNT, X_BYTES_USED, \
- X_OBJECT_TYPE, FILE, DIR, MARKER_DIR, OBJECT, \
- DIR_TYPE, FILE_TYPE, DEFAULT_UID, DEFAULT_GID
+ X_OBJECT_TYPE, FILE, DIR, MARKER_DIR, OBJECT, DIR_TYPE, FILE_TYPE, \
+ DEFAULT_UID, DEFAULT_GID
import logging
from swift.obj.server import DiskFile
@@ -74,11 +72,7 @@ class Gluster_DiskFile(DiskFile):
self.name = container
#Absolute path for obj directory.
self.datadir = os.path.join(path, device, self.name)
-
self.device_path = os.path.join(path, device)
- if not check_mount(path, device):
- check_valid_account(account)
-
self.container_path = os.path.join(path, device, container)
self.tmpdir = os.path.join(path, device, 'tmp')
self.logger = logger
diff --git a/swift/1.4.8/plugins/Glusterfs.py b/swift/1.4.8/plugins/Glusterfs.py
index 35b0c2f59..c176a247b 100644
--- a/swift/1.4.8/plugins/Glusterfs.py
+++ b/swift/1.4.8/plugins/Glusterfs.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 Red Hat, Inc.
+# 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.
@@ -16,7 +16,6 @@ import logging
import os, fcntl, time
from ConfigParser import ConfigParser
from swift.common.utils import TRUE_VALUES
-from hashlib import md5
from swift.plugins.fs_utils import mkdirs
@@ -24,17 +23,12 @@ from swift.plugins.fs_utils import mkdirs
# Read the fs.conf file once at startup (module load)
#
_fs_conf = ConfigParser()
-MOUNT_PATH = '/mnt/gluster-object'
AUTH_ACCOUNT = 'auth'
MOUNT_IP = 'localhost'
REMOTE_CLUSTER = False
OBJECT_ONLY = False
if _fs_conf.read(os.path.join('/etc/swift', 'fs.conf')):
try:
- MOUNT_PATH = _fs_conf.get('DEFAULT', 'mount_path', '/mnt/gluster-object')
- except (NoSectionError, NoOptionError):
- pass
- try:
AUTH_ACCOUNT = _fs_conf.get('DEFAULT', 'auth_account', 'auth')
except (NoSectionError, NoOptionError):
pass
@@ -53,12 +47,6 @@ if _fs_conf.read(os.path.join('/etc/swift', 'fs.conf')):
NAME = 'glusterfs'
-def strip_obj_storage_path(path, mp=MOUNT_PATH):
- """
- strip the mount path off, also stripping the leading and trailing slashes
- """
- return path.replace(mp, '').strip(os.path.sep)
-
def _busy_wait(full_mount_path):
# Iterate for definite number of time over a given
# interval for successful mount
@@ -66,13 +54,26 @@ def _busy_wait(full_mount_path):
if os.path.ismount(os.path.join(full_mount_path)):
return True
time.sleep(2)
+ logging.error('Busy wait for mount timed out for mount %s', full_mount_path)
return False
-def mount(account):
- full_mount_path = os.path.join(MOUNT_PATH, account)
- export = get_export_from_account_id(account)
+def mount(root, drive):
+ # FIXME: Possible thundering herd problem here
- pid_dir = "/var/lib/glusterd/vols/%s/run/" % export
+ el = _get_export_list()
+ for export in el:
+ if drive == export:
+ break
+ else:
+ logging.error('No export found in %r matching drive %s', el, drive)
+ return False
+
+ # NOTE: root is typically the default value of /mnt/gluster-object
+ full_mount_path = os.path.join(root, drive)
+ if not os.path.isdir(full_mount_path):
+ mkdirs(full_mount_path)
+
+ pid_dir = "/var/lib/glusterd/vols/%s/run/" % drive
pid_file = os.path.join(pid_dir, 'swift.pid');
if not os.path.exists(pid_dir):
@@ -85,52 +86,46 @@ def mount(account):
except:
ex = sys.exc_info()[1]
if isinstance(ex, IOError) and ex.errno in (EACCES, EAGAIN):
- # This means that some other process is mounting the
- # filesystem, so wait for the mount process to complete
+ # This means that some other process is mounting the
+ # filesystem, so wait for the mount process to complete
return _busy_wait(full_mount_path)
mnt_cmd = 'mount -t glusterfs %s:%s %s' % (MOUNT_IP, export, \
full_mount_path)
if os.system(mnt_cmd) or not _busy_wait(full_mount_path):
- raise Exception('Mount failed %s: %s' % (NAME, mnt_cmd))
+ logging.error('Mount failed %s: %s', NAME, mnt_cmd)
+ return False
return True
def unmount(full_mount_path):
+ # FIXME: Possible thundering herd problem here
+
umnt_cmd = 'umount %s 2>> /dev/null' % full_mount_path
if os.system(umnt_cmd):
logging.error('Unable to unmount %s %s' % (full_mount_path, NAME))
-def get_export_list():
+def _get_export_list():
if REMOTE_CLUSTER:
cmnd = 'ssh %s gluster volume info' % MOUNT_IP
else:
cmnd = 'gluster volume info'
+ export_list = []
+
if os.system(cmnd + ' >> /dev/null'):
if REMOTE_CLUSTER:
- raise Exception('Getting volume info failed %s, make sure to have \
- passwordless ssh on %s', NAME, MOUNT_IP)
+ logging.error('Getting volume info failed %s, make sure to have '\
+ 'passwordless ssh on %s', NAME, MOUNT_IP)
else:
- raise Exception('Getting volume failed %s', NAME)
-
- export_list = []
- fp = os.popen(cmnd)
- while True:
- item = fp.readline()
- if not item:
- break
- item = item.strip('\n').strip(' ')
- if item.lower().startswith('volume name:'):
- export_list.append(item.split(':')[1].strip(' '))
+ logging.error('Getting volume failed %s', NAME)
+ else:
+ fp = os.popen(cmnd)
+ while True:
+ item = fp.readline()
+ if not item:
+ break
+ item = item.strip('\n').strip(' ')
+ if item.lower().startswith('volume name:'):
+ export_list.append(item.split(':')[1].strip(' '))
return export_list
-
-def get_export_from_account_id(account):
- if not account:
- raise ValueError('No account given')
-
- for export in get_export_list():
- if account == 'AUTH_' + export:
- return export
-
- raise Exception('No export found %s %s' % (account, NAME))
diff --git a/swift/1.4.8/plugins/bin/gluster-swift-gen-builders b/swift/1.4.8/plugins/bin/gluster-swift-gen-builders
new file mode 100755
index 000000000..b89cd15fb
--- /dev/null
+++ b/swift/1.4.8/plugins/bin/gluster-swift-gen-builders
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+function create {
+ swift-ring-builder $1 create 0 1 1
+ swift-ring-builder $1 add z1-127.0.0.1:$2/$3_ 100.0
+ swift-ring-builder $1 rebalance
+ swift-ring-builder $1
+}
+
+if [ "$1x" = "x" ]; then
+ echo "Please specify the gluster volume name to use."
+ exit 1
+fi
+
+# Note that these port numbers must match the configured values for the
+# various servers in their configuration files.
+create account.builder 6012 $1
+create container.builder 6011 $1
+create object.builder 6010 $1
diff --git a/swift/1.4.8/plugins/conf/account-server/1.conf-gluster b/swift/1.4.8/plugins/conf/account-server/1.conf-gluster
index 911e2837f..c7a4c10a4 100644
--- a/swift/1.4.8/plugins/conf/account-server/1.conf-gluster
+++ b/swift/1.4.8/plugins/conf/account-server/1.conf-gluster
@@ -1,7 +1,7 @@
[DEFAULT]
-devices = /srv/1/node
-mount_check = false
-bind_port = 6012
+devices = /mnt/gluster-object
+mount_check = true
+bind_port = 6012 # Be sure to keep in sync with /usr/bin/gluster-swift-gen-builders
user = root
log_facility = LOG_LOCAL2
diff --git a/swift/1.4.8/plugins/conf/account.builder b/swift/1.4.8/plugins/conf/account.builder
deleted file mode 100644
index 2943b9cfb..000000000
--- a/swift/1.4.8/plugins/conf/account.builder
+++ /dev/null
Binary files differ
diff --git a/swift/1.4.8/plugins/conf/account.ring.gz b/swift/1.4.8/plugins/conf/account.ring.gz
deleted file mode 100644
index e1a5e6ae2..000000000
--- a/swift/1.4.8/plugins/conf/account.ring.gz
+++ /dev/null
Binary files differ
diff --git a/swift/1.4.8/plugins/conf/container-server/1.conf-gluster b/swift/1.4.8/plugins/conf/container-server/1.conf-gluster
index eb5650afa..2b97eef62 100644
--- a/swift/1.4.8/plugins/conf/container-server/1.conf-gluster
+++ b/swift/1.4.8/plugins/conf/container-server/1.conf-gluster
@@ -1,7 +1,7 @@
[DEFAULT]
-devices = /srv/1/node
-mount_check = false
-bind_port = 6011
+devices = /mnt/gluster-object
+mount_check = true
+bind_port = 6011 # Be sure to keep in sync with /usr/bin/gluster-swift-gen-builders
user = root
log_facility = LOG_LOCAL2
diff --git a/swift/1.4.8/plugins/conf/container.builder b/swift/1.4.8/plugins/conf/container.builder
deleted file mode 100644
index 6031d79df..000000000
--- a/swift/1.4.8/plugins/conf/container.builder
+++ /dev/null
Binary files differ
diff --git a/swift/1.4.8/plugins/conf/container.ring.gz b/swift/1.4.8/plugins/conf/container.ring.gz
deleted file mode 100644
index fdbcb18b2..000000000
--- a/swift/1.4.8/plugins/conf/container.ring.gz
+++ /dev/null
Binary files differ
diff --git a/swift/1.4.8/plugins/conf/db_file.db b/swift/1.4.8/plugins/conf/db_file.db
deleted file mode 100644
index e69de29bb..000000000
--- a/swift/1.4.8/plugins/conf/db_file.db
+++ /dev/null
diff --git a/swift/1.4.8/plugins/conf/fs.conf-gluster b/swift/1.4.8/plugins/conf/fs.conf-gluster
index b6ec5121f..0bd21babf 100644
--- a/swift/1.4.8/plugins/conf/fs.conf-gluster
+++ b/swift/1.4.8/plugins/conf/fs.conf-gluster
@@ -1,9 +1,8 @@
[DEFAULT]
-mount_path = /mnt/gluster-object
auth_account = auth
#ip of the fs server.
mount_ip = localhost
#fs server need not be local, remote server can also be used,
#set remote_cluster=yes for using remote server.
remote_cluster = no
-object_only = no \ No newline at end of file
+object_only = no
diff --git a/swift/1.4.8/plugins/conf/object-server/1.conf-gluster b/swift/1.4.8/plugins/conf/object-server/1.conf-gluster
index 13dda69ba..62e2fb496 100644
--- a/swift/1.4.8/plugins/conf/object-server/1.conf-gluster
+++ b/swift/1.4.8/plugins/conf/object-server/1.conf-gluster
@@ -1,7 +1,7 @@
[DEFAULT]
-devices = /srv/1/node
-mount_check = false
-bind_port = 6010
+devices = /mnt/gluster-object
+mount_check = true
+bind_port = 6010 # Be sure to keep in sync with /usr/bin/gluster-swift-gen-builders
user = root
log_facility = LOG_LOCAL2
diff --git a/swift/1.4.8/plugins/conf/object.builder b/swift/1.4.8/plugins/conf/object.builder
deleted file mode 100644
index ce4535059..000000000
--- a/swift/1.4.8/plugins/conf/object.builder
+++ /dev/null
Binary files differ
diff --git a/swift/1.4.8/plugins/conf/object.ring.gz b/swift/1.4.8/plugins/conf/object.ring.gz
deleted file mode 100644
index 73e88d589..000000000
--- a/swift/1.4.8/plugins/conf/object.ring.gz
+++ /dev/null
Binary files differ
diff --git a/swift/1.4.8/plugins/conf/proxy-server.conf-gluster b/swift/1.4.8/plugins/conf/proxy-server.conf-gluster
index 9bec64253..b5e1f6f35 100644
--- a/swift/1.4.8/plugins/conf/proxy-server.conf-gluster
+++ b/swift/1.4.8/plugins/conf/proxy-server.conf-gluster
@@ -13,6 +13,18 @@ account_autocreate = true
[filter:tempauth]
use = egg:swift#tempauth
+# Here you need to add users explicitly. See the OpenStack Swift Deployment
+# Guide for more information. The user and user64 directives take the
+# following form:
+# user_<account>_<username> = <key> [group] [group] [...] [storage_url]
+# user64_<account_b64>_<username_b64> = <key> [group] [group] [...] [storage_url]
+# Where you use user64 for accounts and/or usernames that include underscores.
+#
+# NOTE (and WARNING): The account name must match the device name specified
+# when generating the account, container, and object build rings.
+#
+# E.g.
+# user_ufo0_admin = abc123 .admin
[filter:healthcheck]
use = egg:swift#healthcheck
@@ -21,4 +33,4 @@ use = egg:swift#healthcheck
use = egg:swift#memcache
[filter:gluster]
-use = egg:swift#gluster \ No newline at end of file
+use = egg:swift#gluster
diff --git a/swift/1.4.8/plugins/constraints.py b/swift/1.4.8/plugins/constraints.py
index d52209082..6d003b94c 100644
--- a/swift/1.4.8/plugins/constraints.py
+++ b/swift/1.4.8/plugins/constraints.py
@@ -13,7 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from webob.exc import HTTPBadRequest
+
import swift.common.constraints
+from swift.plugins import Glusterfs
+
MAX_OBJECT_NAME_COMPONENT_LENGTH = swift.common.constraints.constraints_conf_int(
'max_object_name_component_length', 255)
@@ -25,7 +29,7 @@ def validate_obj_name_component(obj):
return 'cannot be . or ..'
return ''
-# Save the original
+# Save the original check object creation
__check_object_creation = swift.common.constraints.check_object_creation
# Define our new one which invokes the original
@@ -48,7 +52,7 @@ def gluster_check_object_creation(req, object_name):
if ret is None:
for obj in object_name.split('/'):
- reason = validate_obj_name(obj)
+ reason = validate_obj_name_component(obj)
if reason:
bdy = 'Invalid object name "%s", component "%s" %s' \
% (object_name, obj, reason)
@@ -58,4 +62,21 @@ def gluster_check_object_creation(req, object_name):
return ret
+# Replace the original check object creation with ours
swift.common.constraints.check_object_creation = gluster_check_object_creation
+
+# Save the original check mount
+__check_mount = swift.common.constraints.check_mount
+
+# Define our new one which invokes the original
+def gluster_check_mount(root, drive):
+ # FIXME: Potential performance optimization here to not call the original
+ # check mount which makes two stat calls. We could do what they do with
+ # just one.
+ if __check_mount(root, drive):
+ return True
+
+ return Glusterfs.mount(root, drive)
+
+# Replace the original check mount with ours
+swift.common.constraints.check_mount = gluster_check_mount
diff --git a/swift/1.4.8/plugins/fs_utils.py b/swift/1.4.8/plugins/fs_utils.py
index 0c74836cd..7f5292c2b 100644
--- a/swift/1.4.8/plugins/fs_utils.py
+++ b/swift/1.4.8/plugins/fs_utils.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 Red Hat, Inc.
+# 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.
diff --git a/swift/1.4.8/plugins/utils.py b/swift/1.4.8/plugins/utils.py
index 838c1bd75..45990d1da 100644
--- a/swift/1.4.8/plugins/utils.py
+++ b/swift/1.4.8/plugins/utils.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 Red Hat, Inc.
+# 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.
@@ -137,11 +137,6 @@ def clean_metadata(path):
raise
key += 1
-def get_device_from_account(account):
- if account.startswith(RESELLER_PREFIX):
- device = account.replace(RESELLER_PREFIX, '', 1)
- return device
-
def check_user_xattr(path):
if not os.path.exists(path):
return False
@@ -157,27 +152,6 @@ def check_user_xattr(path):
#Remove xattr may fail in case of concurrent remove.
return True
-def _check_valid_account(account):
- full_mount_path = os.path.join(Glusterfs.MOUNT_PATH, account)
-
- if os.path.ismount(full_mount_path):
- return True
-
- if not _check_account_exists(Glusterfs.get_export_from_account_id(account)):
- logging.error('Account not present %s', account)
- return False
-
- if not os.path.isdir(full_mount_path):
- mkdirs(full_mount_path)
-
- if not Glusterfs.mount(account):
- return False
-
- return True
-
-def check_valid_account(account):
- return _check_valid_account(account)
-
def validate_container(metadata):
if not metadata:
logging.warn('validate_container: No metadata')
@@ -253,9 +227,10 @@ def is_marker(metadata):
else:
return False
-def _update_list(path, const_path, src_list, reg_file=True, object_count=0,
+def _update_list(path, cont_path, src_list, reg_file=True, object_count=0,
bytes_used=0, obj_list=[]):
- obj_path = Glusterfs.strip_obj_storage_path(path, const_path)
+ # strip the prefix off, also stripping the leading and trailing slashes
+ obj_path = path.replace(cont_path, '').strip(os.path.sep)
for i in src_list:
if obj_path:
@@ -270,14 +245,14 @@ def _update_list(path, const_path, src_list, reg_file=True, object_count=0,
return object_count, bytes_used
-def update_list(path, const_path, dirs=[], files=[], object_count=0,
+def update_list(path, cont_path, dirs=[], files=[], object_count=0,
bytes_used=0, obj_list=[]):
- object_count, bytes_used = _update_list (path, const_path, files, True,
- object_count, bytes_used,
- obj_list)
- object_count, bytes_used = _update_list (path, const_path, dirs, False,
- object_count, bytes_used,
- obj_list)
+ object_count, bytes_used = _update_list(path, cont_path, files, True,
+ object_count, bytes_used,
+ obj_list)
+ object_count, bytes_used = _update_list(path, cont_path, dirs, False,
+ object_count, bytes_used,
+ obj_list)
return object_count, bytes_used
@@ -314,7 +289,7 @@ def get_container_details(cont_path, memcache=None):
"""
mkey = ''
if memcache:
- mkey = MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + Glusterfs.strip_obj_storage_path(cont_path)
+ mkey = MEMCACHE_CONTAINER_DETAILS_KEY_PREFIX + cont_path
cd = memcache.get(mkey)
if cd:
if not cd.dir_list:
@@ -330,7 +305,7 @@ def get_container_details(cont_path, memcache=None):
if memcache:
memcache.set(mkey, cd)
return cd.obj_list, cd.object_count, cd.bytes_used
-
+
class AccountDetails(object):
""" A simple class to store the three pieces of information associated
@@ -371,7 +346,7 @@ def get_account_details(acc_path, memcache=None):
acc_stats = None
mkey = ''
if memcache:
- mkey = MEMCACHE_ACCOUNT_DETAILS_KEY_PREFIX + Glusterfs.strip_obj_storage_path(acc_path)
+ mkey = MEMCACHE_ACCOUNT_DETAILS_KEY_PREFIX + acc_path
ad = memcache.get(mkey)
if ad:
# FIXME: Do we really need to stat the file? If we are object
@@ -481,19 +456,6 @@ def create_account_metadata(acc_path, memcache=None):
metadata = get_account_metadata(acc_path, memcache)
return restore_metadata(acc_path, metadata)
-def _check_account_exists(account):
- if account not in get_account_list():
- logging.warn('Account %s does not exist' % account)
- return False
- else:
- return True
-
-def get_account_list():
- return Glusterfs.get_export_list()
-
-def get_account_id(account):
- return RESELLER_PREFIX + md5(account + HASH_PATH_SUFFIX).hexdigest()
-
_DEFAULT_GLUSTER_ENABLED = os.getenv('GLUSTER_UNIT_TEST_ENABLED', 'no')
__swift_conf = ConfigParser()
@@ -507,3 +469,7 @@ _gluster_enabled = _gluster_enabled_val in TRUE_VALUES
def Gluster_enabled():
return _gluster_enabled
+
+if _gluster_enabled:
+ # Monkey patch only when Gluster enabled
+ import swift.plugins.constraints