From e45ecea3c20123a06adce3a8bc8dc05014aafca3 Mon Sep 17 00:00:00 2001 From: Siddharth Vinothkumar Date: Fri, 5 Dec 2014 08:14:41 +0000 Subject: [PATCH] CA-153517: Fix LVHD SR delete Due to differences in dmsetup version cleanups, this patch takes a safe approach in the sr delete code-path. Signed-off-by: Siddharth Vinothkumar --- drivers/LVHDSR.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/LVHDSR.py b/drivers/LVHDSR.py index 83de1c4c5..be7ddcf18 100755 --- a/drivers/LVHDSR.py +++ b/drivers/LVHDSR.py @@ -560,7 +560,9 @@ def delete(self, uuid): try: lvname = os.path.basename(fileName.replace('-','/').\ replace('//', '-')) - os.unlink(os.path.join(self.path, lvname)) + lpath = os.path.join(self.path, lvname) + if os.path.lexists(lpath): + os.unlink(lpath) except Exception, e: util.SMlog("LVHDSR.delete: failed to remove the symlink for " \ "file %s. Error: %s" % (fileName, str(e)))