summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Portante <peter.portante@redhat.com>2012-12-12 09:51:40 -0500
committerPeter Portante <peter.portante@redhat.com>2013-04-29 16:35:57 -0400
commit75881dae627a5be6858f90c4ff6782f782d5e592 (patch)
tree7708123dbf447296083129a267a8ef1399c5f282
parent163da60336f1f811e7176f42486f099a78fc4c90 (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.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/ufo/gluster/swift/common/DiskFile.py b/ufo/gluster/swift/common/DiskFile.py
index 5698ff7..8522295 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