Change in vdsm[master]: Modify _cleanOldFiles method name and avoid naked try-except

ybronhei at redhat.com ybronhei at redhat.com
Sun Jul 5 10:19:35 UTC 2015


Yaniv Bronhaim has uploaded a new change for review.

Change subject: Modify _cleanOldFiles method name and avoid naked try-except
......................................................................

Modify _cleanOldFiles method name and avoid naked try-except

Change-Id: Ie5c1053e268abb03c71935a4414a193a1ed40e9f
Signed-off-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M vdsm/clientIF.py
1 file changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/07/43207/1

diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index a3fa52b..98794d6 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -494,7 +494,7 @@
                    vmstatus.WAIT_FOR_LAUNCH in [v.lastStatus for v in
                                                 self.vmContainer.values()]):
                 time.sleep(1)
-            self._cleanOldFiles()
+            self._cleanRecoveryFiles()
             self._recovery = False
 
             # Now if we have VMs to restore we should wait pool connection
@@ -542,16 +542,17 @@
             self.log.debug("Error recovering VM", exc_info=True)
         return None
 
-    def _cleanOldFiles(self):
+    def _cleanRecoveryFiles(self):
         for f in os.listdir(constants.P_VDSM_RUN):
             try:
                 vmId, fileType = f.split(".", 1)
                 exts = ["guest.socket", "monitor.socket",
                         "stdio.dump", "recovery"]
                 if fileType in exts and vmId not in self.vmContainer:
-                    self.log.debug("removing old file " + f)
+                    self.log.debug("cleaning old file " + f)
                     utils.rmFile(constants.P_VDSM_RUN + f)
-            except:
+            except ValueError:
+                # If file is missing type extention - ignore it
                 pass
 
     def dispatchLibvirtEvents(self, conn, dom, *args):


-- 
To view, visit https://gerrit.ovirt.org/43207
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie5c1053e268abb03c71935a4414a193a1ed40e9f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei at redhat.com>


More information about the vdsm-patches mailing list