From: Amit Bawer abawer@redhat.com
On storage setup we can have stale symlinks to loop devices which were created before reboot and now are gone. Re-running the setup will fail on creating the symlink again. In this patch we add removal of the pre-existing symlink, if there is such, before symlinking the new loop device. --- tests/storage.py | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/tests/storage.py b/tests/storage.py index 3258ed4..ef40f08 100644 --- a/tests/storage.py +++ b/tests/storage.py @@ -82,10 +82,13 @@ def create_loop_device(link_path, backing_file, size=1024**3, "--show", ])
device = out.decode("utf-8").strip()
+ #remove stale symlink + if os.path.islink(link_path): + os.unlink(link_path) os.symlink(device, link_path) chown(link_path)
def remove_loop_device(link_path, backing_file):
On Fri, May 31, 2019 at 4:14 AM Nir Soffer nirsof@gmail.com wrote:
From: Amit Bawer abawer@redhat.com
On storage setup we can have stale symlinks to loop devices which were created before reboot and now are gone. Re-running the setup will fail on creating the symlink again. In this patch we add removal of the pre-existing symlink, if there is such, before symlinking the new loop device.
tests/storage.py | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/tests/storage.py b/tests/storage.py index 3258ed4..ef40f08 100644 --- a/tests/storage.py +++ b/tests/storage.py @@ -82,10 +82,13 @@ def create_loop_device(link_path, backing_file, size=1024**3, "--show", ])
device = out.decode("utf-8").strip()
- #remove stale symlink
- if os.path.islink(link_path):
os.unlink(link_path)
Noticed now that the comment is not formatted properly, will fix before pushing.
os.symlink(device, link_path) chown(link_path)
def remove_loop_device(link_path, backing_file):
2.17.2 _______________________________________________ sanlock-devel mailing list -- sanlock-devel@lists.fedorahosted.org To unsubscribe send an email to sanlock-devel-leave@lists.fedorahosted.org Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/sanlock-devel@lists.fedorahoste...
sanlock-devel@lists.fedorahosted.org