lvm-backup: Normalize path when comparing current path and mount point
Before umounting and removing lvm volume, we need to make sure we are not within the mount point that is to be removed. Previous logic lacks consideration that path can have parts like trailing slashes, which could end up skipping changing dir when it is needed. This patch proposes to normalize the path before doing the check to avoid such mistakes. Closes-Bug: #1799334 Story: 2004153 Task: 27625 Change-Id: Iaa8c8ff523b1d29a1addeaa3d802053d63aba80a
This commit is contained in:
parent
b1c6d533d7
commit
98ea424f39
|
@ -303,7 +303,8 @@ def validate_lvm_params(backup_opt_dict):
|
|||
|
||||
|
||||
def _umount(path):
|
||||
if os.getcwd().startswith(path):
|
||||
# Change dir if we are within the mount point to be removed.
|
||||
if os.getcwd().startswith(os.path.normpath(path)):
|
||||
os.chdir('/')
|
||||
umount_proc = subprocess.Popen('{0} -l -f {1}'.format(
|
||||
utils.find_executable('umount'), path),
|
||||
|
|
Loading…
Reference in New Issue