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@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
oVirt Jenkins CI Server has posted comments on this change.
Change subject: Improve logging on some filesystem operations ......................................................................
Patch Set 1:
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6811/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7601/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7711/ : FAILURE
oVirt Jenkins CI Server has posted comments on this change.
Change subject: Improve logging on some filesystem operations ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6813/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7603/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7713/ : SUCCESS
Allon Mureinik has posted comments on this change.
Change subject: Improve logging on some filesystem operations ......................................................................
Patch Set 2:
(1 comment)
General comment - it's usually better to log /before/ performing an operation (or at least, also log before). Storage operations can hang, and in that case we'll be unable to determine where they hung from the log.
http://gerrit.ovirt.org/#/c/26046/2//COMMIT_MSG Commit Message:
Line 6: Line 7: Improve logging on some filesystem operations Line 8: Line 9: The rationale behind this patch is to increase the logging on some Line 10: filesystem operations. Before no trace was given when creating or "storage operations", not "filesystem operations". Note that you're also changing blockSD.py Line 11: deleting symbolic links or removing or renaming files or folders in Line 12: storage operations. This patch tries to solve this adding debug Line 13: messages after those operations succeed. Line 14:
Allon Mureinik has posted comments on this change.
Change subject: Improve logging on some filesystem operations ......................................................................
Patch Set 2:
(1 comment)
http://gerrit.ovirt.org/#/c/26046/2//COMMIT_MSG Commit Message:
Line 6: Line 7: Improve logging on some filesystem operations Line 8: Line 9: The rationale behind this patch is to increase the logging on some Line 10: filesystem operations. Before no trace was given when creating or
"storage operations", not "filesystem operations". Note that you're also ch
take that back - it's all about linking and unlinking. Line 11: deleting symbolic links or removing or renaming files or folders in Line 12: storage operations. This patch tries to solve this adding debug Line 13: messages after those operations succeed. Line 14:
Xavi Francisco has posted comments on this change.
Change subject: Improve logging on some filesystem operations ......................................................................
Patch Set 2:
In general that's true but in this case we use the logging to check for successful operations so probably it could be nice to keep the logging after the successful operation happened
Nir Soffer has posted comments on this change.
Change subject: Improve logging on some filesystem operations ......................................................................
Patch Set 2:
(10 comments)
I agree with Allon, that we better have the logs *before* the operation, and not after the operation.
If the operation blocks, we will have a clue about what we were doing (e.g. last message seen was creating a symlink).
When the operation fails, we get an error log or an exception is raised, so another log is not needed.
If the operation succeeded, we usually do not need a log, except if we like to know how much time the operation took, but I don't see such need currently.
Note also the capitalization - our logs are mostly capitalized.
http://gerrit.ovirt.org/#/c/26046/2/vdsm/storage/blockVolume.py File vdsm/storage/blockVolume.py:
Line 434: self.validateImagePath() Line 435: volPath = os.path.join(self.imagePath, self.volUUID) Line 436: if not os.path.lexists(volPath): Line 437: os.symlink(lvm.lvPath(self.sdUUID, self.volUUID), volPath) Line 438: self.log.debug("Creating symlink to %s", volPath) Here we need the src path in the log, which will make the code easier to read:
lvPath = lvm.lvPath(self.sdUUID, self.volUUID) self.log.debug("Creating symlink from %s to %s", lvPath, volPath) Line 439: self.volumePath = volPath Line 440: Line 441: def getVolumeTag(self, tagPrefix): Line 442: return _getVolumeTag(self.sdUUID, self.volUUID, tagPrefix)
http://gerrit.ovirt.org/#/c/26046/2/vdsm/storage/fileSD.py File vdsm/storage/fileSD.py:
Line 345: def deleteImage(self, sdUUID, imgUUID, volsImgs): Line 346: currImgDir = self.getImagePath(imgUUID) Line 347: dirName, baseName = os.path.split(currImgDir) Line 348: toDelDir = os.tempnam(dirName, sd.REMOVED_IMAGE_PREFIX + baseName) Line 349: try: Lets log this also Line 350: self.oop.os.rename(currImgDir, toDelDir) Line 351: except OSError as e: Line 352: self.log.error("image: %s can't be moved", currImgDir) Line 353: raise se.ImageDeleteError("%s %s" % (imgUUID, str(e)))
Line 356: try: Line 357: self.oop.os.remove(volPath) Line 358: self.oop.os.remove(volPath + '.meta') Line 359: self.oop.os.remove(volPath + '.lease') Line 360: self.log.debug("Removed volume: %s", volPath) Consider adding log for each oop operation. If one on them got stuck, it will be more clear. Line 361: except OSError: Line 362: self.log.error("vol: %s can't be removed.", Line 363: volPath, exc_info=True) Line 364: try:
Line 360: self.log.debug("Removed volume: %s", volPath) Line 361: except OSError: Line 362: self.log.error("vol: %s can't be removed.", Line 363: volPath, exc_info=True) Line 364: try: And this one also Line 365: self.oop.os.rmdir(toDelDir) Line 366: except OSError as e: Line 367: self.log.error("removed image dir: %s can't be removed", toDelDir) Line 368: raise se.ImageDeleteError("%s %s" % (imgUUID, str(e)))
Line 442: imgRunDir = os.path.join(sdRunDir, imgUUID) Line 443: try: Line 444: os.symlink(srcImgPath, imgRunDir) Line 445: self.log.debug("Created img run dir from %s to %s", srcImgPath, Line 446: imgRunDir) This should use the same log format as other symlinks: "Creating symlink from %s to %s". Line 447: except OSError as e: Line 448: if e.errno == errno.EEXIST: Line 449: self.log.debug("img run dir already exists: %s", imgRunDir) Line 450: else:
Line 464: # (ordered volUUIDs) we fix them all. Line 465: imgDir = os.path.join(self.mountpoint, self.sdUUID, sd.DOMAIN_IMAGES, Line 466: imgUUID) Line 467: volPaths = tuple(os.path.join(imgDir, v) for v in volUUIDs) Line 468: for volPath in volPaths: This looks log worthy - "Fixing permissions on %s" - what do you think? Line 469: self.oop.fileUtils.copyUserModeToGroup(volPath) Line 470: Line 471: return self.createImageLinks(imgDir, imgUUID) Line 472:
Line 606: for volFile in volFiles: Line 607: tLink = os.path.join(basePath, rImg, volFile) Line 608: tVol = os.path.join(basePath, templateImage, volFile) Line 609: self.oop.utils.forceLink(tVol, tLink) Line 610: self.log.debug("Relinking %s to %s", tVol, tLink) Lets use the term "Force linking %s to %f", and "Linking %s to %s" for standard links. Line 611: Line 612: Line 613: def getMountsList(pattern="*"): Line 614: finalPat = os.path.join(sd.StorageDomain.storage_repository,
http://gerrit.ovirt.org/#/c/26046/2/vdsm/storage/fileVolume.py File vdsm/storage/fileVolume.py:
Line 285: """ Line 286: metaPath = self._getMetaVolumePath() Line 287: if self.oop.os.path.lexists(metaPath): Line 288: self.oop.os.unlink(metaPath) Line 289: self.log.debug("Removing metadada: %s", metaPath) I think the path already includes "metadata" Line 290: Line 291: def getMetadataId(self): Line 292: """ Line 293: Get the metadata Id
http://gerrit.ovirt.org/#/c/26046/2/vdsm/storage/sp.py File vdsm/storage/sp.py:
Line 1127: tmp_link_name = os.path.join(self.storage_repository, Line 1128: str(uuid.uuid4())) Line 1129: os.symlink(src, tmp_link_name) # make tmp_link Line 1130: os.rename(tmp_link_name, linkName) Line 1131: self.log.debug("Storage domain linked from %s to %s", src, linkName) _linkStorageDomain is included in the logging message automatically, so we can use standard terms like "Linking %s to %s". Line 1132: Line 1133: @unsecured Line 1134: def _cleanupDomainLinks(self, domain): Line 1135: linkPath = os.path.join(self.poolPath, domain)
Line 1134: def _cleanupDomainLinks(self, domain): Line 1135: linkPath = os.path.join(self.poolPath, domain) Line 1136: try: Line 1137: os.remove(linkPath) Line 1138: self.log.debug("Removed domain link: %s", linkPath) Same as above. Line 1139: except (OSError, IOError): Line 1140: pass Line 1141: Line 1142: @unsecured
oVirt Jenkins CI Server has posted comments on this change.
Change subject: Add logging on some filesystem operations ......................................................................
Patch Set 3:
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/7065/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7967/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7856/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: Add logging on some filesystem operations ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7951/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/7161/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/8063/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: Add logging on some filesystem operations ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7952/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/7162/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/8064/ : SUCCESS
Allon Mureinik has posted comments on this change.
Change subject: Add logging on some filesystem operations ......................................................................
Patch Set 3: Code-Review+1
Nir Soffer has posted comments on this change.
Change subject: Add logging on some filesystem operations ......................................................................
Patch Set 3:
Xavi, please publish this patch. You should have a "Publish" button in gerrit, or just push a new version with git review (without the -D flag).
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 4:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/8563/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/7773/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/8690/ : FAILURE
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 5:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/8564/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/7774/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/8691/ : FAILURE
Allon Mureinik has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 5: Code-Review+1
Nir Soffer has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 5: Code-Review-1
(4 comments)
Mostly nice, but there are some place which duplicated some logic for the log, which make the code worse.
http://gerrit.ovirt.org/#/c/26046/5/vdsm/storage/fileSD.py File vdsm/storage/fileSD.py:
Line 391: try: Line 392: self.log.debug("Removing file: %s", volPath) Line 393: self.oop.os.remove(volPath) Line 394: self.log.debug("Removing file: %s", volPath + '.meta') Line 395: self.oop.os.remove(volPath + '.meta') There is duplication here - better:
metafile = volPath + '.meta' self.log.debug("Removing file: %s", metaPath) self.oop.os.remove(metaPath) Line 396: self.log.debug("Removing file: %s", volPath + '.lease') Line 397: self.oop.os.remove(volPath + '.lease') Line 398: except OSError: Line 399: self.log.error("vol: %s can't be removed.",
Line 397: self.oop.os.remove(volPath + '.lease') Line 398: except OSError: Line 399: self.log.error("vol: %s can't be removed.", Line 400: volPath, exc_info=True) Line 401: try: Well if we log all operations, why not log this one also? Line 402: self.oop.os.rmdir(toDelDir) Line 403: except OSError as e: Line 404: self.log.error("removed image dir: %s can't be removed", toDelDir) Line 405: raise se.ImageDeleteError("%s %s" % (imgUUID, str(e)))
http://gerrit.ovirt.org/#/c/26046/5/vdsm/storage/fileUtils.py File vdsm/storage/fileUtils.py:
Line 380: if (mode & 0o070) != newGroupMode: # group mode mask Line 381: # setting the new group mode masking out the original one Line 382: log.debug("Changing mode for %s to %#o", path, Line 383: (mode & 0o707) | newGroupMode) Line 384: os.chmod(path, (mode & 0o707) | newGroupMode) The logic for the new mode is duplicated, which will lead to mismatch when someone change the value in the chmod call but forget the log. Better:
newMode = (mode & 0o707) | newGroupMode log it... chmod... Line 385: Line 386: Line 387: def padToBlockSize(path): Line 388: with file(path, 'a') as f:
Line 388: with file(path, 'a') as f: Line 389: size = os.fstat(f.fileno()).st_size Line 390: log.debug("Truncating file %s to %s", path, Line 391: 512 * ((size + 511) / 512)) Line 392: os.ftruncate(f.fileno(), 512 * ((size + 511) / 512)) Same duplication issue
Nir Soffer has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 6: Code-Review-1
(1 comment)
I found one case where you added a new variable but you are not using it in the code, so the logic duplication remain. Please fix all instances of this error.
http://gerrit.ovirt.org/#/c/26046/6/vdsm/storage/fileSD.py File vdsm/storage/fileSD.py:
Line 392: self.log.debug("Removing file: %s", volPath) Line 393: self.oop.os.remove(volPath) Line 394: metaFile = volPath + '.meta' Line 395: self.log.debug("Removing file: %s", metaFile) Line 396: self.oop.os.remove(volPath + '.meta') You added a new variable, but you are not using it in the code, so the same duplicate logic remain.
self.oop.os.remove(metaFile) Line 397: leaseFile = volPath + '.lease' Line 398: self.log.debug("Removing file: %s", leaseFile) Line 399: self.oop.os.remove(volPath + '.lease') Line 400: except OSError:
Nir Soffer has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 7:
(2 comments)
Now there are just 2 whitespace issues.
http://gerrit.ovirt.org/#/c/26046/7/vdsm/storage/fileUtils.py File vdsm/storage/fileUtils.py:
Line 380: if (mode & 0o070) != newGroupMode: # group mode mask Line 381: # setting the new group mode masking out the original one Line 382: newMode = (mode & 0o707) | newGroupMode Line 383: log.debug("Changing mode for %s to %#o", path, Line 384: newMode) I think this can fit in the previous line. Line 385: os.chmod(path, newMode) Line 386: Line 387: Line 388: def padToBlockSize(path):
Line 389: with file(path, 'a') as f: Line 390: size = os.fstat(f.fileno()).st_size Line 391: newSize = 512 * ((size + 511) / 512) Line 392: log.debug("Truncating file %s to %s", path, Line 393: newSize) Same, join with previous line?
Nir Soffer has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 8: Verified+1
Nice!
Nir Soffer has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 8: -Verified Code-Review+1
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 7:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/8773/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/8909/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/7983/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 8:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/8774/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/8910/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/7984/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 6:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/8772/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/8908/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/7982/ : SUCCESS
Sergey Gotliv has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 8: Code-Review+1
Allon Mureinik has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 8: Code-Review+1
Federico Simoncelli has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 8: Code-Review+2
I am not a fan of such repetitive code insertions. But ok, I am looking forward to see something better in the future.
Xavi Francisco has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 8: Verified+1
Steps to verify:
* Add a new Posix FS Storage domain * Check the VDSM log for directory creation messages
Dan Kenigsberg has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 8:
(2 comments)
http://gerrit.ovirt.org/#/c/26046/8/vdsm/storage/blockSD.py File vdsm/storage/blockSD.py:
Line 1075: for volUUID in volUUIDs: Line 1076: srcVol = os.path.join(srcImgPath, volUUID) Line 1077: dstVol = os.path.join(imgRunDir, volUUID) Line 1078: try: Line 1079: self.log.debug("Creating symlink from %s to %s", srcVol, try-except blocks should be as short as possible. There's no need to put this log line inside it. If for some reason, self.log.debug() raises an EEXIST, you are going to add a false log line in 1084.
So if you can keep as many of your changes out of their respective try-except block, it would be an improvement. Line 1080: dstVol) Line 1081: os.symlink(srcVol, dstVol) Line 1082: except OSError as e: Line 1083: if e.errno == errno.EEXIST:
http://gerrit.ovirt.org/#/c/26046/8/vdsm/storage/blockVolume.py File vdsm/storage/blockVolume.py:
Line 250: self.log.error("cannot remove volume %s/%s", self.sdUUID, Line 251: self.volUUID, exc_info=True) Line 252: Line 253: try: Line 254: self.log.debug("Unlinking %s", vol_path) here we try hard to swallow exceptions, so it's fine. Line 255: os.unlink(vol_path) Line 256: return True Line 257: except Exception as e: Line 258: eFound = e
Yoav Kleinberger has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 8: Code-Review+1
(3 comments)
http://gerrit.ovirt.org/#/c/26046/8//COMMIT_MSG Commit Message:
Line 11: deleting symbolic links or removing or renaming files and folders. Line 12: This patch tries to solve this adding debug messages before the Line 13: operations are executed. Line 14: Line 15: This patch only includes the logging in the VDSM process so no OOP OOP -> out-of-process
hate acronyms, even when I know them. Line 16: log management is needed. Line 17: Line 18: Change-Id: I3602513af123951f71091c03f799e36ea759aa61
http://gerrit.ovirt.org/#/c/26046/8/vdsm/storage/blockVolume.py File vdsm/storage/blockVolume.py:
Line 433: if not self.imagePath: Line 434: self.validateImagePath() Line 435: volPath = os.path.join(self.imagePath, self.volUUID) Line 436: if not os.path.lexists(volPath): Line 437: srcPath = lvm.lvPath(self.sdUUID, self.volUUID) I hate shorthand. srcPath -> sourcePath, volPath -> volumePath. a little more typing, a lot more clarity Line 438: self.log.debug("Creating symlink from %s to %s", srcPath, volPath) Line 439: os.symlink(srcPath, volPath) Line 440: self.volumePath = volPath Line 441:
http://gerrit.ovirt.org/#/c/26046/8/vdsm/storage/fileSD.py File vdsm/storage/fileSD.py:
Line 395: self.log.debug("Removing file: %s", metaFile) Line 396: self.oop.os.remove(metaFile) Line 397: leaseFile = volPath + '.lease' Line 398: self.log.debug("Removing file: %s", leaseFile) Line 399: self.oop.os.remove(leaseFile) suggest: for extention in '.meta', '.lease': file = '%s%s' % ( volPath, extention ) self.log.debug( 'removing %s' % file ) self.oop.os.remove(file)
in fact, refactor this into a small function and call it. Line 400: except OSError: Line 401: self.log.error("vol: %s can't be removed.", Line 402: volPath, exc_info=True) Line 403: try:
Xavi Francisco has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 9: Verified+1
Same verification process
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 9:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/8897/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/9033/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/8107/ : SUCCESS
Nir Soffer has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 8:
(1 comment)
http://gerrit.ovirt.org/#/c/26046/8/vdsm/storage/fileSD.py File vdsm/storage/fileSD.py:
Line 395: self.log.debug("Removing file: %s", metaFile) Line 396: self.oop.os.remove(metaFile) Line 397: leaseFile = volPath + '.lease' Line 398: self.log.debug("Removing file: %s", leaseFile) Line 399: self.oop.os.remove(leaseFile)
suggest:
This remove some repetitive code, but is little less clear.
But this is a bad idea:
self.log.debug( 'removing %s' % file )
There is no reason to pay for the formatting if you do not run with debug log level. This is why logger use log("format", *args).
Refactoring function to some deleteVolume() mehod would be nice, but not in this patch. Line 400: except OSError: Line 401: self.log.error("vol: %s can't be removed.", Line 402: volPath, exc_info=True) Line 403: try:
Nir Soffer has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 9: Code-Review+1
Xavi Francisco has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 9:
Changelog bewteen patch set 8 and pat set 9: * Write log messages outside try/except blocks whenever possible
Dan Kenigsberg has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 9: Code-Review+2
(1 comment)
http://gerrit.ovirt.org/#/c/26046/9/vdsm/storage/fileSD.py File vdsm/storage/fileSD.py:
Line 388: raise se.ImageDeleteError("%s %s" % (imgUUID, str(e))) Line 389: for volUUID in volsImgs: Line 390: volPath = os.path.join(toDelDir, volUUID) Line 391: try: Line 392: self.log.debug("Removing file: %s", volPath) this could have been kept out easily, but never mind. Line 393: self.oop.os.remove(volPath) Line 394: metaFile = volPath + '.meta' Line 395: self.log.debug("Removing file: %s", metaFile) Line 396: self.oop.os.remove(metaFile)
Dan Kenigsberg has submitted this change and it was merged.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
storage: Add logging on filesystem altering operations
The rationale behind this patch is to add logging on filesystem altering operations. Before, no trace was given when creating or deleting symbolic links or removing or renaming files and folders. This patch tries to solve this adding debug messages before the operations are executed.
This patch only includes the logging in the VDSM process so no out of process log management is needed.
Change-Id: I3602513af123951f71091c03f799e36ea759aa61 Signed-off-by: Xavi Francisco xfrancis@redhat.com Reviewed-on: http://gerrit.ovirt.org/26046 Reviewed-by: Nir Soffer nsoffer@redhat.com Reviewed-by: Dan Kenigsberg danken@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, 36 insertions(+), 7 deletions(-)
Approvals: Xavi Francisco: Verified Nir Soffer: Looks good to me, but someone else must approve Dan Kenigsberg: Looks good to me, approved
oVirt Jenkins CI Server has posted comments on this change.
Change subject: storage: Add logging on filesystem altering operations ......................................................................
Patch Set 10:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_create-rpms_merged/1306/ : SUCCESS
vdsm-patches@lists.fedorahosted.org