summaryrefslogtreecommitdiffstats
path: root/gluster
diff options
context:
space:
mode:
authorvenkata edara <redara@redhat.com>2017-11-22 13:35:46 +0530
committerPrashanth Pai <ppai@redhat.com>2017-11-22 09:07:11 +0000
commit488744a005fb399af8d094ad7a62c1917410398c (patch)
tree714441b43e09061fc339cae6a68de5c26f0fdf52 /gluster
parent8af00bf3fa5aa7cd29a53e5e43ea230c196d10b0 (diff)
Rebase to Swift 2.15.1 (pike)HEADmaster
Change-Id: I84ebb44c5c3cf2f80c50f2d4ae4bd92b619a4297 Signed-off-by: venkata edara <redara@redhat.com> Reviewed-on: https://review.gluster.org/18412 Reviewed-by: Prashanth Pai <ppai@redhat.com> Tested-by: Prashanth Pai <ppai@redhat.com>
Diffstat (limited to 'gluster')
-rw-r--r--gluster/swift/__init__.py2
-rw-r--r--gluster/swift/account/utils.py17
-rw-r--r--gluster/swift/common/DiskDir.py20
-rw-r--r--gluster/swift/obj/diskfile.py2
4 files changed, 25 insertions, 16 deletions
diff --git a/gluster/swift/__init__.py b/gluster/swift/__init__.py
index ac0c566..4de6cfa 100644
--- a/gluster/swift/__init__.py
+++ b/gluster/swift/__init__.py
@@ -45,6 +45,6 @@ class PkgInfo(object):
#
# Change the Package version here
#
-_pkginfo = PkgInfo('2.10.1', '0', 'gluster_swift', False)
+_pkginfo = PkgInfo('2.15.1', '0', 'gluster_swift', False)
__version__ = _pkginfo.pretty_version
__canonical_version__ = _pkginfo.canonical_version
diff --git a/gluster/swift/account/utils.py b/gluster/swift/account/utils.py
index 4424835..24fb7df 100644
--- a/gluster/swift/account/utils.py
+++ b/gluster/swift/account/utils.py
@@ -15,7 +15,7 @@
from swift.account.utils import FakeAccountBroker, get_response_headers
from swift.common.swob import HTTPOk, HTTPNoContent
-from swift.common.utils import json
+from swift.common.utils import json, Timestamp
from xml.sax import saxutils
@@ -37,24 +37,29 @@ def account_listing_response(account, req, response_content_type, broker=None,
response_content_type, reverse)
if response_content_type == 'application/json':
data = []
- for (name, object_count, bytes_used, is_subdir) in account_list:
+ for (name, object_count, bytes_used, put_tstamp,
+ is_subdir) in account_list:
if is_subdir:
data.append({'subdir': name})
else:
data.append({'name': name, 'count': object_count,
- 'bytes': bytes_used})
+ 'bytes': bytes_used,
+ 'last_modified': Timestamp(put_tstamp).isoformat})
account_list = json.dumps(data)
elif response_content_type.endswith('/xml'):
output_list = ['<?xml version="1.0" encoding="UTF-8"?>',
'<account name=%s>' % saxutils.quoteattr(account)]
- for (name, object_count, bytes_used, is_subdir) in account_list:
+ for (name, object_count, bytes_used, put_tstamp,
+ is_subdir) in account_list:
if is_subdir:
output_list.append(
'<subdir name=%s />' % saxutils.quoteattr(name))
else:
item = '<container><name>%s</name><count>%s</count>' \
- '<bytes>%s</bytes></container>' % \
- (saxutils.escape(name), object_count, bytes_used)
+ '<bytes>%s</bytes><last_modified>%s</last_modified> \
+ </container>' % \
+ (saxutils.escape(name), object_count, bytes_used,
+ Timestamp(put_tstamp).isoformat)
output_list.append(item)
output_list.append('</account>')
account_list = '\n'.join(output_list)
diff --git a/gluster/swift/common/DiskDir.py b/gluster/swift/common/DiskDir.py
index 0bc95df..bda88aa 100644
--- a/gluster/swift/common/DiskDir.py
+++ b/gluster/swift/common/DiskDir.py
@@ -37,7 +37,7 @@ from gluster.swift.common.utils import ThreadPool
DATADIR = 'containers'
-
+# dict to have mapping of delimiter selected obj to real obj name
# Create a dummy db_file in Glusterfs.RUN_DIR
_db_file = ""
@@ -405,7 +405,6 @@ class DiskDir(DiskCommon):
"""
assert limit >= 0
assert not delimiter or (len(delimiter) == 1 and ord(delimiter) <= 254)
-
if path is not None:
if path:
prefix = path = path.rstrip('/') + '/'
@@ -507,7 +506,9 @@ class DiskDir(DiskCommon):
and not dir_is_object(metadata):
continue
list_item = []
+
list_item.append(obj)
+
if metadata:
list_item.append(metadata[X_TIMESTAMP])
list_item.append(int(metadata[X_CONTENT_LENGTH]))
@@ -551,7 +552,6 @@ class DiskDir(DiskCommon):
if self._dir_exists and Glusterfs._container_update_object_count and \
self.account != 'gsexpiring':
self._update_object_count()
-
data = {'account': self.account, 'container': self.container,
'object_count': self.metadata.get(
X_OBJECTS_COUNT, ('0', 0))[0],
@@ -589,6 +589,7 @@ class DiskDir(DiskCommon):
do_chown(self.datadir, self.uid, self.gid)
metadata = get_container_metadata(self.datadir)
metadata[X_TIMESTAMP] = (timestamp, 0)
+ metadata[X_PUT_TIMESTAMP] = (timestamp, 0)
write_metadata(self.datadir, metadata)
self.metadata = metadata
self._dir_exists = True
@@ -606,7 +607,8 @@ class DiskDir(DiskCommon):
if not do_exists(self.datadir):
self.initialize(timestamp)
else:
- if timestamp > self.metadata[X_PUT_TIMESTAMP]:
+ existing_timestamp = self.metadata[X_PUT_TIMESTAMP][0]
+ if timestamp > existing_timestamp:
self.metadata[X_PUT_TIMESTAMP] = (timestamp, 0)
write_metadata(self.datadir, self.metadata)
@@ -845,10 +847,11 @@ class DiskAccount(DiskCommon):
# the following ordered fields:
# (name, object_count, bytes_used, is_subdir)
for container in containers:
- # When response_content_type == 'text/plain', Swift will only
- # consume the name of the container (first element of tuple).
- # Refer: swift.account.utils.account_listing_response()
- account_list.append((container, 0, 0, 0))
+ # When response_content_type == 'text/plain', Swift will
+ # only consume the name of the container (first element of
+ # tuple).Refer:
+ # swift.account.utils.account_listing_response()
+ account_list.append((container, 0, 0, 0, 0))
if len(account_list) >= limit:
break
if reverse:
@@ -873,6 +876,7 @@ class DiskAccount(DiskCommon):
if metadata:
list_item.append(metadata[X_OBJECTS_COUNT][0])
list_item.append(metadata[X_BYTES_USED][0])
+ list_item.append(metadata[X_PUT_TIMESTAMP][0])
list_item.append(0)
account_list.append(list_item)
count += 1
diff --git a/gluster/swift/obj/diskfile.py b/gluster/swift/obj/diskfile.py
index be0669f..7ad5f26 100644
--- a/gluster/swift/obj/diskfile.py
+++ b/gluster/swift/obj/diskfile.py
@@ -1081,7 +1081,7 @@ class DiskFile(object):
X_OBJECT_TYPE, X_TYPE]
for key in sys_keys:
- if key in orig_metadata:
+ if key in orig_metadata and key not in metadata:
metadata[key] = orig_metadata[key]
if X_OBJECT_TYPE not in orig_metadata: