Fix anaconda bug when installing compute nodes

If wipedisk script is not used, only the
cgts-vg lvm volume will be deleted in the kickstart files
and other lvm volumes will still be in use (e.g nova-local)
and anaconda will throw an error.
We fix this by removing all the lvm volumes in
the kickstart files.

Closes-Bug: 1881327
Change-Id: I3726d5f0aa662212d64f4a4f100d71cb430eb7cd
Signed-off-by: Mihnea Saracin <Mihnea.Saracin@windriver.com>
This commit is contained in:
Mihnea Saracin 2020-06-16 18:52:14 +03:00
parent 240773cf5d
commit 259d646c5a
1 changed files with 11 additions and 4 deletions

View File

@ -44,10 +44,17 @@ fi
# Deactivate existing volume groups to avoid Anaconda issues with pre-existing groups
vgs --noheadings -o vg_name | xargs --no-run-if-empty -n 1 vgchange -an
# Remove volumes and group for cgts-vg, if any
lvremove --force cgts-vg
pvs --select 'vg_name=cgts-vg' --noheadings -o pv_name | xargs --no-run-if-empty pvremove --force --force --yes
vgs --select 'vg_name=cgts-vg' --noheadings -o vg_name | xargs --no-run-if-empty vgremove --force
# Remove the volume groups that have physical volumes on the root disk
for vg in $(vgs --noheadings -o vg_name); do
pvs --select "vg_name=$vg" --noheadings -o pv_name | grep -q "$(get_disk $rootfs_device)"
if [ $? -ne 0 ]; then
continue
fi
echo "Removing vg $vg"
lvremove --force $vg
pvs --select "vg_name=$vg" --noheadings -o pv_name | xargs --no-run-if-empty pvremove --force --force --yes
vgs --select "vg_name=$vg" --noheadings -o vg_name | xargs --no-run-if-empty vgremove --force
done
ONLYUSE_HDD=""
part_type_guid_str="Partition GUID code"