Idan Shaby has uploaded a new change for review. Change subject: fileSD: fix deleteImage flow ......................................................................
fileSD: fix deleteImage flow In FileStorageDomainManifest.deleteImage, we used to log that the volume could not be removed even if it was removed but the metadata/lease file could not be removed afterwards. This patch logs more informative errors about the specific file that could not be removed. Also, if one of the files couldn't be removed, we didn't try to remove the others. Now we handle each removal separately, so that a failure in the removal of one file doesn't affect the removal of the others. Bug-Url: https://bugzilla.redhat.com/1292092 Change-Id: I9eeb28a70f708a4f9a5effe4ff294da63b757369 Signed-off-by: Idan Shaby <[email protected]> --- M vdsm/storage/fileSD.py 1 file changed, 13 insertions(+), 13 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/04/50804/1 diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py index d6f4843..7d91dba 100644 --- a/vdsm/storage/fileSD.py +++ b/vdsm/storage/fileSD.py @@ -213,19 +213,10 @@ raise se.ImageDeleteError("%s %s" % (imgUUID, str(e))) for volUUID in volsImgs: volPath = os.path.join(toDelDir, volUUID) - try: - self.log.debug("Removing file: %s", volPath) - self.oop.os.remove(volPath) - metaFile = volPath + '.meta' - self.log.debug("Removing file: %s", metaFile) - self.oop.os.remove(metaFile) - if self.hasVolumeLeases(): - leaseFile = volPath + '.lease' - self.log.debug("Removing file: %s", leaseFile) - self.oop.os.remove(leaseFile) - except OSError: - self.log.error("vol: %s can't be removed.", - volPath, exc_info=True) + self._deleteFile("volume", volPath) + self._deleteFile("metadata", volPath + '.meta') + if self.hasVolumeLeases(): + self._deleteFile("lease", volPath + '.lease') self.log.debug("Removing directory: %s", toDelDir) try: self.oop.os.rmdir(toDelDir) @@ -233,6 +224,15 @@ self.log.error("removed image dir: %s can't be removed", toDelDir) raise se.ImageDeleteError("%s %s" % (imgUUID, str(e))) + def _deleteFile(self, fileType, filePath): + try: + self.oop.os.remove(filePath) + self.log.debug("%s file: %s was removed.", fileType, filePath) + except OSError as ose: + if ose.errno != errno.ENOENT: + self.log.error("%s file: %s can't be removed.", + fileType, filePath, exc_info=True) + def getAllVolumes(self): """ Return dict {volUUID: ((imgUUIDs,), parentUUID)} of the domain. -- To view, visit https://gerrit.ovirt.org/50804 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9eeb28a70f708a4f9a5effe4ff294da63b757369 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Idan Shaby <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
