Change in vdsm[master]: Remove fileUtils.cleanupfiles().

ewarszaw at redhat.com ewarszaw at redhat.com
Sun Jan 27 13:12:51 UTC 2013


Eduardo has uploaded a new change for review.

Change subject: Remove fileUtils.cleanupfiles().
......................................................................

Remove fileUtils.cleanupfiles().

Racy, redundant, named out of convention, ...

Change-Id: I2dbb22ea97b1a6b2d572d21a5c4267fe78759e7f
Signed-off-by: Eduardo <ewarszaw at redhat.com>
---
M vdsm/storage/fileUtils.py
M vdsm/storage/fileVolume.py
2 files changed, 9 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/25/11425/1

diff --git a/vdsm/storage/fileUtils.py b/vdsm/storage/fileUtils.py
index 440974c..86f6e1a 100644
--- a/vdsm/storage/fileUtils.py
+++ b/vdsm/storage/fileUtils.py
@@ -129,15 +129,6 @@
     return os.access(filename, check)
 
 
-def cleanupfiles(filelist):
-    """
-    Removes the files in the list
-    """
-    for item in filelist:
-        if os.path.lexists(item):
-            os.remove(item)
-
-
 def cleanupdir(dirPath, ignoreErrors=True):
     """
     Recursively remove all the files and directories in the given directory
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index ef1443a..ae65c8f 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -54,15 +54,14 @@
 
 def deleteMultipleVolumes(sdUUID, volumes, postZero):
     # Posix asserts that the blocks will be zeroed before reuse
-    volPaths = []
     for vol in volumes:
         vol.setLegality(volume.ILLEGAL_VOL)
-        volPaths.append(vol.getVolumePath())
-    try:
-        oop.getGlobalProcPool().fileUtils.cleanupfiles(volPaths)
-    except OSError:
-        volume.log.error("cannot delete some volumes at paths: %s",
-                         volPaths, exc_info=True)
+        volPath = vol.getVolumePath()
+        try:
+            oop.getGlobalProcPool().utils.rmFile(volPath)
+        except OSError:
+            volume.log.error("cannot delete volume at path: %s",
+                             volPath, exc_info=True)
 
 
 class FileVolume(volume.Volume):
@@ -202,8 +201,9 @@
                              puuid, exc_info=True)
 
         try:
-            self.oop.fileUtils.cleanupfiles([vol_path, lease_path])
-        except Exception as e:
+            self.oop.utils.rmFile(vol_path)
+            self.oop.utils.rmFile(lease_path)
+        except OSError as e:
             eFound = e
             self.log.error("cannot delete volume %s at path: %s", self.volUUID,
                            vol_path, exc_info=True)


--
To view, visit http://gerrit.ovirt.org/11425
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2dbb22ea97b1a6b2d572d21a5c4267fe78759e7f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw at redhat.com>


More information about the vdsm-patches mailing list