Skip to content

Commit

Permalink
Fix for #2222 - Thin pool recreation logic / use of vgcfgrestore is b…
Browse files Browse the repository at this point in the history
…roken

Removing forcibly (with '--force' passed twice) just works.

Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
  • Loading branch information
rmetrich committed Sep 4, 2019
1 parent b97b660 commit 1b779ab
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions usr/share/rear/layout/prepare/GNU/Linux/110_include_lvm_code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,16 @@ elif lvm vgcfgrestore --force -f "$VAR_DIR/layout/lvm/${vg}.cfg" $vg >&2 ; then
[ \$vg == "$vg" ] || continue
# Consider Thin Pools only
[[ ,\$layout, == *,thin,* ]] && [[ ,\$layout, == *,pool,* ]] || continue
# Remove twice, the first time it fails because of thin volumes in the pool
lvm lvremove -q -f -y \$vg/\$lv || true
lvm lvremove -q -f -y \$vg/\$lv
# Use "--force" twice to bypass any error due to invalid transaction id
lvm lvremove -q -f -f -y $vg/\$lv
done
# Once Thin pools have been removed, we can activate the VG
lvm vgchange --available y $vg >&2
LogPrint "Sleeping 3 seconds to let udev or systemd-udevd create their devices..."
sleep 3 >&2
# All logical volumes have been created, except Thin volumes and pools
create_volume_group=0
create_thin_volumes_only=1
Expand Down

0 comments on commit 1b779ab

Please sign in to comment.