LVM: Handle missing loop device at cleanup
When the loop device is not present because something has gone wrong, this will print an error: "losetup: option requires an argument -- 'd'" Just skip the losetup -d in this case. Change-Id: Iedc439b1ae924e9a599f6522eb081b83d43190c7
This commit is contained in:
parent
8755de3d75
commit
5237d16d69
4
lib/lvm
4
lib/lvm
@ -58,7 +58,9 @@ function _clean_lvm_backing_file {
|
|||||||
if [[ -n "$backing_file" ]] && [[ -e "$backing_file" ]]; then
|
if [[ -n "$backing_file" ]] && [[ -e "$backing_file" ]]; then
|
||||||
local vg_dev
|
local vg_dev
|
||||||
vg_dev=$(sudo losetup -j $backing_file | awk -F':' '/'$BACKING_FILE_SUFFIX'/ { print $1}')
|
vg_dev=$(sudo losetup -j $backing_file | awk -F':' '/'$BACKING_FILE_SUFFIX'/ { print $1}')
|
||||||
sudo losetup -d $vg_dev
|
if [[ -n "$vg_dev" ]]; then
|
||||||
|
sudo losetup -d $vg_dev
|
||||||
|
fi
|
||||||
rm -f $backing_file
|
rm -f $backing_file
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user