Change in vdsm[master]: Improve logging on some filesystem operations

xfrancis at redhat.com xfrancis at redhat.com
Mon Mar 24 15:00:32 UTC 2014


Xavi Francisco has uploaded a new change for review.

Change subject: Improve logging on some filesystem operations
......................................................................

Improve logging on some filesystem operations

The rationale behind this patch is to increase the logging on some
filesystem operations. Before no trace was given when creating or
deleting symbolic links or removing or renaming files or folders in
storage operations. This patch tries to solve this adding debug
messages after those operations succeed.

This patch only includes the logging in the VDSM process so no OOP
log management is needed.

Change-Id: I3602513af123951f71091c03f799e36ea759aa61
Signed-off-by: Xavi Francisco <xfrancis at redhat.com>
---
M vdsm/storage/blockSD.py
M vdsm/storage/blockVolume.py
M vdsm/storage/fileSD.py
M vdsm/storage/fileUtils.py
M vdsm/storage/fileVolume.py
M vdsm/storage/sp.py
6 files changed, 20 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/26046/1

diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index cac59fa..9e73647 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -1056,6 +1056,7 @@
                            imgUUID)
         try:
             os.symlink(imgPath, dst)
+            self.log.debug("symlink created from %s to %s", imgPath, dst)
         except OSError as e:
             if e.errno == errno.EEXIST:
                 self.log.debug("path to image directory already exists: %s",
@@ -1085,6 +1086,8 @@
             dstVol = os.path.join(imgRunDir, volUUID)
             try:
                 os.symlink(srcVol, dstVol)
+                self.log.debug("symlink created from %s to %s", srcvol,
+                               sdtvol)
             except OSError as e:
                 if e.errno == errno.EEXIST:
                     self.log.debug("img run vol already exists: %s", dstVol)
@@ -1316,6 +1319,7 @@
             if not os.path.lexists(dst):
                 src = lvm.lvPath(self.sdUUID, lvName)
                 os.symlink(src, dst)
+                self.log.debug("symlink created from %s to %s", src, dst)
 
     def extendVolume(self, volumeUUID, size, isShuttingDown=None):
         self._extendlock.acquire()
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index 36bfa1f..a438b09 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -110,6 +110,7 @@
 
                 if os.path.lexists(volPath):
                     os.unlink(volPath)
+                    cls.log.debug("Unlinking half baked volume: %s", volPath)
 
     @classmethod
     def validateCreateVolumeParams(cls, volFormat, preallocate, srcVolUUID):
@@ -251,6 +252,7 @@
 
         try:
             os.unlink(vol_path)
+            self.log.debug("Unlinking %s", vol_path)
             return True
         except Exception as e:
             eFound = e
@@ -433,6 +435,7 @@
         volPath = os.path.join(self.imagePath, self.volUUID)
         if not os.path.lexists(volPath):
             os.symlink(lvm.lvPath(self.sdUUID, self.volUUID), volPath)
+            self.log.debug("Creating symlink to %s", volPath)
         self.volumePath = volPath
 
     def getVolumeTag(self, tagPrefix):
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index 180a43f..d488706 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -357,6 +357,7 @@
                 self.oop.os.remove(volPath)
                 self.oop.os.remove(volPath + '.meta')
                 self.oop.os.remove(volPath + '.lease')
+                self.log.debug("Removed volume: %s", volPath)
             except OSError:
                 self.log.error("vol: %s can't be removed.",
                                volPath, exc_info=True)
@@ -441,6 +442,8 @@
         imgRunDir = os.path.join(sdRunDir, imgUUID)
         try:
             os.symlink(srcImgPath, imgRunDir)
+            self.log.debug("Created img run dir from %s to %s", srcImagePath,
+                           imgRunDir)
         except OSError as e:
             if e.errno == errno.EEXIST:
                 self.log.debug("img run dir already exists: %s", imgRunDir)
@@ -537,6 +540,7 @@
         masterdir = os.path.join(self.domaindir, sd.MASTER_FS_DIR)
         if not self.oop.fileUtils.pathExists(masterdir):
             self.oop.os.mkdir(masterdir, 0o755)
+            self.log.debug("Created master directory: %s", masterdir)
 
     def unmountMaster(self):
         """
@@ -603,6 +607,7 @@
                 tLink = os.path.join(basePath, rImg, volFile)
                 tVol = os.path.join(basePath, templateImage, volFile)
                 self.oop.utils.forceLink(tVol, tLink)
+                self.log.debug("Relinking %s to %s", tVol, tLink)
 
 
 def getMountsList(pattern="*"):
diff --git a/vdsm/storage/fileUtils.py b/vdsm/storage/fileUtils.py
index f1af44a..3e46a32 100644
--- a/vdsm/storage/fileUtils.py
+++ b/vdsm/storage/fileUtils.py
@@ -141,7 +141,7 @@
         cleanupdir_errors.append('%s: %s' % (func.__name__, exc_info[1]))
 
     shutil.rmtree(dirPath, onerror=logit)
-
+    log.debug("Removed directory: %s", dirPath)
     if not ignoreErrors and cleanupdir_errors:
         raise RuntimeError("%s %s" % (dirPath, cleanupdir_errors))
 
@@ -160,6 +160,7 @@
 
     try:
         os.makedirs(*params)
+        log.debug("Created directory: %s", dirPath)
     except OSError as e:
         if e.errno != errno.EEXIST:
             raise
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index f2a93d6..df0d075 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -286,6 +286,7 @@
         metaPath = self._getMetaVolumePath()
         if self.oop.os.path.lexists(metaPath):
             self.oop.os.unlink(metaPath)
+            self.log.debug("Removing metadada: %s", metaPath)
 
     def getMetadataId(self):
         """
@@ -455,6 +456,7 @@
                                                  "renameVolumeRollback",
                                                  [volPath, self.volumePath]))
         self.oop.os.rename(self.volumePath, volPath)
+        self.log.debug("Renamed %s to %s", self.volumePath, volPath)
         if recovery:
             name = "Rename meta-volume rollback: " + metaPath
             vars.task.pushRecovery(task.Recovery(name, "fileVolume",
@@ -462,6 +464,7 @@
                                                  "renameVolumeRollback",
                                                  [metaPath, prevMetaPath]))
         self.oop.os.rename(prevMetaPath, metaPath)
+        self.log.debug("Renamed %s to %s", prevMetaPath, metaPath)
         if recovery:
             name = "Rename lease-volume rollback: " + leasePath
             vars.task.pushRecovery(task.Recovery(name, "fileVolume",
@@ -470,6 +473,7 @@
                                                  [leasePath, prevLeasePath]))
         try:
             self.oop.os.rename(prevLeasePath, leasePath)
+            self.log.debug("Renamed %s to %s", prevLeasePath, leasePath)
         except OSError as e:
             if e.errno != os.errno.ENOENT:
                 raise
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index a63d074..5b88551 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1128,12 +1128,14 @@
                                      str(uuid.uuid4()))
         os.symlink(src, tmp_link_name)     # make tmp_link
         os.rename(tmp_link_name, linkName)
+        self.log.debug("Storage domain linked from %s to %s", src, linkName)
 
     @unsecured
     def _cleanupDomainLinks(self, domain):
         linkPath = os.path.join(self.poolPath, domain)
         try:
             os.remove(linkPath)
+            self.log.debug("Removed domain link: %s", linkPath)
         except (OSError, IOError):
             pass
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3602513af123951f71091c03f799e36ea759aa61
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xavi Francisco <xfrancis at redhat.com>


More information about the vdsm-patches mailing list