diff --git a/drivers/LargeBlockSR.py b/drivers/LargeBlockSR.py index b6ffc866..f1635ac5 100644 --- a/drivers/LargeBlockSR.py +++ b/drivers/LargeBlockSR.py @@ -21,7 +21,6 @@ import util import xs_errors import os -import pathlib CAPABILITIES = ["SR_PROBE", "SR_UPDATE", "SR_SUPPORTS_LOCAL_CACHING", "VDI_CREATE", "VDI_DELETE", "VDI_ATTACH", "VDI_DETACH", @@ -71,7 +70,6 @@ def create(self, sr_uuid, size): 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() - new_path = pathlib.Path(new_path) try: os.symlink(self.loopdev, new_path) @@ -79,9 +77,8 @@ def create_loopdev(self, dev, new_path): raise xs_errors.XenError("SymlinkExist", opterr="Symlink {} couldn't be created".format(new_path)) def delete_loopdev(self, dev, new_path): - new_path = pathlib.Path(new_path) - if new_path.exists() and new_path.is_symlink(): - new_path.unlink() + if os.path.exists(new_path) and os.path.islink(new_path): + os.unlink(new_path) # The backing file isn't a symlink if given by ID in device-config but the real device dev = os.path.realpath(dev)