Change in vdsm[master]: utils: Add logs to rotateFiles

ykaplan at redhat.com ykaplan at redhat.com
Mon Sep 8 09:18:03 UTC 2014


Yeela Kaplan has uploaded a new change for review.

Change subject: utils: Add logs to rotateFiles
......................................................................

utils: Add logs to rotateFiles

Change-Id: If4636d54bb39db02301e2f528c9ca15f13472eaf
Signed-off-by: Yeela Kaplan <ykaplan at redhat.com>
---
M lib/vdsm/utils.py
1 file changed, 10 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/05/32605/1

diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index 3a83300..54fcfa0 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -156,6 +156,11 @@
 
 
 def rotateFiles(directory, prefixName, gen, cp=False, persist=False):
+    '''
+    gen: the max number of files rotated and saved under directory at a point
+         in time
+    cp : determines if rotate is done with root permissions
+    '''
     logging.debug("dir: %s, prefixName: %s, versions: %s" %
                   (directory, prefixName, gen))
     gen = int(gen)
@@ -188,7 +193,8 @@
                 unpersistFile(oldName)
                 unpersistFile(newName)
             except:
-                pass
+                logging.warning("Failed to unpersist files: %s, %s",
+                                oldName, newName)
         try:
             if cp:
                 execCmd([constants.EXT_CP, oldName, newName], sudo=True)
@@ -198,14 +204,13 @@
             else:
                 os.rename(oldName, newName)
         except:
-            pass
+            logging.warning("Failed to rotate file: %s to: %s",
+                            oldName, newName)
         if persist and not cp:
             try:
                 persistFile(newName)
-                execCmd([constants.EXT_PERSIST, newName],
-                        sudo=True)
             except:
-                pass
+                logging.warning("Failed to persist file: %s" % newName)
 
 
 def _parseMemInfo(lines):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If4636d54bb39db02301e2f528c9ca15f13472eaf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan at redhat.com>


More information about the vdsm-patches mailing list