diff --git a/drivers/LargeBlockSR.py b/drivers/LargeBlockSR.py index dff5f6a7..1839df0c 100644 --- a/drivers/LargeBlockSR.py +++ b/drivers/LargeBlockSR.py @@ -93,9 +93,13 @@ def create_loopdev(self, dev, new_path): cmd = ["losetup", "-f", "-v", "--show", "--sector-size", str(self.LOOP_SECTOR_SIZE), dev] self.loopdev = util.pread2(cmd).rstrip() + if os.path.exists(new_path) and os.path.islink(new_path): + os.unlink(new_path) + try: os.symlink(self.loopdev, new_path) except OSError: + #util.pread2(["losetup", "-d", self.loopdev]) raise xs_errors.XenError("LargeBlockSymlinkExist", opterr="Symlink {} couldn't be created".format(new_path)) def delete_loopdev(self, dev, new_path):