Change in vdsm[master]: Related to 846307 - Simplifying clientIF._cleanOldFiles().

ewarszaw at redhat.com ewarszaw at redhat.com
Wed Oct 17 11:00:56 UTC 2012


Eduardo has uploaded a new change for review.

Change subject: Related to 846307 - Simplifying clientIF._cleanOldFiles().
......................................................................

Related to 846307 - Simplifying clientIF._cleanOldFiles().

Change-Id: Ifd63a1f4b1c64f84d5734da033a2420b97ce0ada
Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=846307
Signed-off-by: Eduardo <ewarszaw at redhat.com>
---
M vdsm/clientIF.py
1 file changed, 15 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/8626/1

diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index e9ca7c9..669c5be 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -1,3 +1,4 @@
+import os.path
 #
 # Copyright 2011 Red Hat, Inc.
 #
@@ -453,24 +454,18 @@
         return None
 
     def _cleanOldFiles(self):
-        for f in os.listdir(constants.P_VDSM_RUN):
+        for fName in os.listdir(constants.P_VDSM_RUN):
+            if fName in ('vdsmd.pid', 'respawn.pid', 'svdsm.pid',
+                        'svdsm.sock'):
+                continue
             try:
-                vmId, fileType = f.split(".", 1)
-                if fileType in ["guest.socket", "monitor.socket", "pid",
-                                    "stdio.dump", "recovery"]:
-                    if vmId in self.vmContainer:
-                        continue
-                    if f == 'vdsmd.pid':
-                        continue
-                    if f == 'respawn.pid':
-                        continue
-                    if f == 'svdsm.pid':
-                        continue
-                    if f == 'svdsm.sock':
-                        continue
-                else:
-                    continue
-                self.log.debug("removing old file " + f)
-                utils.rmFile(constants.P_VDSM_RUN + f)
-            except:
-                pass
+                vmId, fileType = fName.split('.', 1)
+            except ValueError:
+                pass  # fName does not contains '.'
+            if not fileType in ("guest.socket", "monitor.socket", "pid",
+                                "stdio.dump", "recovery"):
+                continue
+            if vmId in self.vmContainer:
+                continue
+            self.log.debug("Removing old file %s", fName)
+            utils.rmFile(constants.P_VDSM_RUN + fName)


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

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


More information about the vdsm-patches mailing list