summaryrefslogtreecommitdiffstats
path: root/swift/1.4.8/plugins
diff options
context:
space:
mode:
authorMohammed Junaid <junaid@redhat.com>2012-05-21 15:47:28 +0530
committerVijay Bellur <vijay@gluster.com>2012-05-25 10:22:16 -0700
commit69392d4daa9df0612630813713ae02a99cc068e0 (patch)
treef02a7eb5731c385a0fbd712b30f17074f9ad33ef /swift/1.4.8/plugins
parent65275d048bb031f93a690c69cb32bb751298c212 (diff)
swift: Passing account name in container_update.
This patch also contains fixes to bugs * 811501 * 812498 * 821310 Also, removed the default set of users in the proxy-server.conf file. Change-Id: Ief83905d10ff7bf7c43685ada4d7f05959cee9d1 BUG: 821310 Signed-off-by: Mohammed Junaid <junaid@redhat.com> Reviewed-on: http://review.gluster.com/3440 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'swift/1.4.8/plugins')
-rw-r--r--swift/1.4.8/plugins/DiskDir.py4
-rw-r--r--swift/1.4.8/plugins/DiskFile.py20
-rw-r--r--swift/1.4.8/plugins/Glusterfs.py1
-rw-r--r--swift/1.4.8/plugins/conf/proxy-server.conf4
-rw-r--r--swift/1.4.8/plugins/utils.py24
5 files changed, 28 insertions, 25 deletions
diff --git a/swift/1.4.8/plugins/DiskDir.py b/swift/1.4.8/plugins/DiskDir.py
index 4b813167196..28671be3cd9 100644
--- a/swift/1.4.8/plugins/DiskDir.py
+++ b/swift/1.4.8/plugins/DiskDir.py
@@ -220,14 +220,14 @@ class DiskDir(DiskCommon):
self.metadata[X_BYTES_USED] = int(self.metadata[X_BYTES_USED]) - int(content_length)
self.put_metadata(self.metadata)
- def put_container(self, timestamp, object_count, bytes_used):
+ def put_container(self, container, put_timestamp, del_timestamp, object_count, bytes_used):
"""
For account server.
"""
self.metadata[X_OBJECTS_COUNT] = 0
self.metadata[X_BYTES_USED] = 0
self.metadata[X_CONTAINER_COUNT] = int(self.metadata[X_CONTAINER_COUNT]) + 1
- self.metadata[X_PUT_TIMESTAMP] = timestamp
+ self.metadata[X_PUT_TIMESTAMP] = 1
self.put_metadata(self.metadata)
def delete_container(self, object_count, bytes_used):
diff --git a/swift/1.4.8/plugins/DiskFile.py b/swift/1.4.8/plugins/DiskFile.py
index 815e1c3ab54..6f77eaaa57a 100644
--- a/swift/1.4.8/plugins/DiskFile.py
+++ b/swift/1.4.8/plugins/DiskFile.py
@@ -15,6 +15,8 @@
import os
from eventlet import tpool
+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, \
@@ -294,3 +296,21 @@ class Gluster_DiskFile(DiskFile):
if X_OBJECT_TYPE in self.metadata:
self.metadata.pop(X_OBJECT_TYPE)
+ @contextmanager
+ def mkstemp(self):
+ """Contextmanager to make a temporary file."""
+
+ if not os.path.exists(self.tmpdir):
+ mkdirs(self.tmpdir)
+ fd, tmppath = mkstemp(dir=self.tmpdir)
+ try:
+ yield fd, tmppath
+ finally:
+ try:
+ os.close(fd)
+ except OSError:
+ pass
+ try:
+ os.unlink(tmppath)
+ except OSError:
+ pass
diff --git a/swift/1.4.8/plugins/Glusterfs.py b/swift/1.4.8/plugins/Glusterfs.py
index d5e847a8239..eb8d535dbf9 100644
--- a/swift/1.4.8/plugins/Glusterfs.py
+++ b/swift/1.4.8/plugins/Glusterfs.py
@@ -67,7 +67,6 @@ class Glusterfs(object):
def get_export_list_remote(self):
export_list = []
cmnd = 'ssh %s gluster volume info' % self.mount_ip
- print 'Remote'
if os.system(cmnd + ' >> /dev/null'):
raise Exception('Getting volume info failed %s, make sure to have \
diff --git a/swift/1.4.8/plugins/conf/proxy-server.conf b/swift/1.4.8/plugins/conf/proxy-server.conf
index 7f23d85ccd9..1fcde8e0d3a 100644
--- a/swift/1.4.8/plugins/conf/proxy-server.conf
+++ b/swift/1.4.8/plugins/conf/proxy-server.conf
@@ -13,10 +13,6 @@ account_autocreate = true
[filter:tempauth]
use = egg:swift#tempauth
-user_admin_admin = admin .admin .reseller_admin
-user_test_tester = testing .admin
-user_test2_tester2 = testing2 .admin
-user_test_tester3 = testing3
[filter:healthcheck]
use = egg:swift#healthcheck
diff --git a/swift/1.4.8/plugins/utils.py b/swift/1.4.8/plugins/utils.py
index 57c6180fdd1..e28a6bd853c 100644
--- a/swift/1.4.8/plugins/utils.py
+++ b/swift/1.4.8/plugins/utils.py
@@ -323,33 +323,21 @@ def check_user_xattr(path):
def _check_valid_account(account, fs_object):
mount_path = getattr(fs_object, 'mount_path', MOUNT_PATH)
- if not check_account_exists(fs_object.get_export_from_account_id(account), \
- fs_object):
+ if os.path.ismount(os.path.join(mount_path, account)):
+ return True
+
+ if not check_account_exists(fs_object.get_export_from_account_id(account), fs_object):
logging.error('Account not present %s', account)
return False
- if not os.path.ismount(os.path.join(mount_path, account)):
- if not os.path.isdir(os.path.join(mount_path, account)):
- mkdirs(os.path.join(mount_path, account))
-
+ if not os.path.isdir(os.path.join(mount_path, account)):
+ mkdirs(os.path.join(mount_path, account))
fs_object.unmount(os.path.join(mount_path, account))
if fs_object:
if not fs_object.mount(account):
return False
- if not check_user_xattr(os.path.join(mount_path, account)):
- logging.error('Error: No support for user.xattr on backend %s' % account)
- return False
-
- chmod_cmd = ['chmod 777 %s' % (mount_path), \
- 'chmod 777 %s/%s' % (mount_path, account)]
-
- for cmd in chmod_cmd:
- if os.system(cmd):
- logging.error('Chmod failed: %s' % (cmd))
- return False
-
return True
def check_valid_account(account, fs_object):