Eduardo has uploaded a new change for review.
Change subject: Remove fileUtils.safeUnlink().
......................................................................
Remove fileUtils.safeUnlink().
safeUnlink() usage replaced by utils.rmFile() calls.
Change-Id: I8d6531bdf43aa9ed74dff5a54a54bb476500298e
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/blockVolume.py
M vdsm/storage/fileUtils.py
M vdsm/storage/fileVolume.py
3 files changed, 6 insertions(+), 16 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/11424/1
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index 355e961..cfc1dc9 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -24,6 +24,7 @@
import sanlock
from vdsm.config import config
+import vdsm.utils as utils
import storage_exception as se
import volume
import image
@@ -166,7 +167,7 @@
lvm.createLV(dom.sdUUID, volUUID, volSize, activate=True,
initialTag=TAG_VOL_UNINIT)
- fileUtils.safeUnlink(volPath)
+ utils.rmFile(volPath)
os.symlink(lvm.lvPath(dom.sdUUID, volUUID), volPath)
if not volParent:
@@ -335,7 +336,7 @@
@classmethod
def shareVolumeRollback(cls, taskObj, volPath):
cls.log.info("Volume rollback for volPath=%s", volPath)
- fileUtils.safeUnlink(volPath)
+ utils.rmFile(volPath)
@deprecated # valid only for domain version < 3, see volume.setrw
def _setrw(self, rw):
diff --git a/vdsm/storage/fileUtils.py b/vdsm/storage/fileUtils.py
index b9e348b..440974c 100644
--- a/vdsm/storage/fileUtils.py
+++ b/vdsm/storage/fileUtils.py
@@ -129,17 +129,6 @@
return os.access(filename, check)
-def safeUnlink(filename):
- """
- Remove a file and skip the exception if the file is missing (ENOENT)
- """
- try:
- os.unlink(filename)
- except OSError as e:
- if e.errno != os.errno.ENOENT:
- raise
-
-
def cleanupfiles(filelist):
"""
Removes the files in the list
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index 245c189..ef1443a 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -257,9 +257,9 @@
def shareVolumeRollback(cls, taskObj, volPath):
cls.log.info("Volume rollback for volPath=%s", volPath)
procPool = oop.getProcessPool(getDomUuidFromVolumePath(volPath))
- procPool.fileUtils.safeUnlink(volPath)
- procPool.fileUtils.safeUnlink(cls.__metaVolumePath(volPath))
- procPool.fileUtils.safeUnlink(cls.__leaseVolumePath(volPath))
+ procPool.utils.rmFile(volPath)
+ procPool.utils.rmFile(cls.__metaVolumePath(volPath))
+ procPool.utils.rmFile(cls.__leaseVolumePath(volPath))
@deprecated # valid only for domain version < 3, see volume.setrw
def _setrw(self, rw):
--
To view, visit
http://gerrit.ovirt.org/11424
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8d6531bdf43aa9ed74dff5a54a54bb476500298e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>