diff options
author | Peter Portante <peter.portante@redhat.com> | 2012-12-12 09:51:40 -0500 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-12-17 06:12:23 -0800 |
commit | 10ef8ef65a29d1ed7257c8649870b8b735fe0e10 (patch) | |
tree | e4811629c992f41f4b62bfbe1e5db77e41e4eaca | |
parent | 1338ad168a4a468636909322dace9dc9f750dd13 (diff) |
object-storage: do not list directory for delete
Do not list the entire directory contents of the directory containing the file
before deleting it. We have already verified the files existence constructing
the Gluster_DiskFile object.
This fixes a customer issue. See 885281
(https://bugzilla.redhat.com/show_bug.cgi?id=885281).
Change-Id: I4425c42af3e03624370c779d74b7f073e6eef024
BUG: 885281
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Reviewed-on: http://review.gluster.org/4302
Reviewed-by: Mohammed Junaid <junaid@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r-- | ufo/gluster/swift/common/DiskFile.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ufo/gluster/swift/common/DiskFile.py b/ufo/gluster/swift/common/DiskFile.py index 5698ff72ab4..8522295483d 100644 --- a/ufo/gluster/swift/common/DiskFile.py +++ b/ufo/gluster/swift/common/DiskFile.py @@ -251,16 +251,17 @@ class Gluster_DiskFile(DiskFile): if not self.metadata or self.metadata['X-Timestamp'] >= timestamp: return + assert self.data_file, \ + "Have metadata, %r, but no data_file" % self.metadata + if self._is_dir: # Marker directory object if not rmdirs(self.data_file): - logging.error('Unable to delete dir object: %s' % self.data_file) + logging.error('Unable to delete dir object: %s', self.data_file) return else: # File object - for fname in do_listdir(self.datadir): - if os.path.join(self.datadir, fname) == self.data_file: - do_unlink(self.data_file) + do_unlink(self.data_file) self.metadata = {} self.data_file = None |