diff --git a/swiftonhpss/swift/obj/diskfile.py b/swiftonhpss/swift/obj/diskfile.py index d441cb7..5348e83 100644 --- a/swiftonhpss/swift/obj/diskfile.py +++ b/swiftonhpss/swift/obj/diskfile.py @@ -397,18 +397,19 @@ class DiskFileWriter(object): self.close() # TODO: see if this is really the right way of getting the ETag + # TODO: add timeout in case we should end up never having an ETag if not has_etag: - sleep(.5) try: - xattrs = xattr.xattr(df._data_file) - if 'system.hpss.hash' in xattrs: - etag = xattrs['system.hpss.hash'] - elif 'user.hash.checksum' in xattrs: - etag = xattrs['user.hash.checksum'] - else: - raise DiskFileError( - 'ETag was not in HPSS xattrs for file %s' - % df._data_file) + etag = None + # We sit here and wait until hpssfs-cksum finishes calculating + # the checksum. + while etag is None: + time.sleep(.25) + xattrs = xattr.xattr(df._data_file) + if 'system.hpss.hash' in xattrs: + etag = xattrs['system.hpss.hash'] + elif 'user.hash.checksum' in xattrs: + etag = xattrs['user.hash.checksum'] metadata['ETag'] = etag write_metadata(df._data_file, metadata) except IOError as err: diff --git a/swiftonhpss/swift/obj/server.py b/swiftonhpss/swift/obj/server.py index 8c6c2de..1d601d5 100644 --- a/swiftonhpss/swift/obj/server.py +++ b/swiftonhpss/swift/obj/server.py @@ -398,7 +398,6 @@ class ObjectController(server.ObjectController): @public @timing_stats() def GET(self, request): - logging.error(request) """Handle HTTP GET requests for the Swift on File object server""" device, partition, account, container, obj, policy = \ get_name_and_placement(request, 5, 5, True) @@ -460,8 +459,8 @@ class ObjectController(server.ObjectController): headers = {} if hasattr(e, 'timestamp'): headers['X-Backend-Timestamp'] = e.timestamp.internal - return HTTPNotFound(request=request, headers=headers, - conditional_response=True) + return HTTPNotFound(request=request, headers=headers, + conditional_response=True) @public @timing_stats()