Add support of unknown default VG and default root LV names (use find and awk instead)
This commit is contained in:
parent
04fb5ca175
commit
fd9ad6bdf6
22
deploy_vm.sh
22
deploy_vm.sh
|
@ -442,9 +442,16 @@ if [ "${VM_DISK_EXTEND}" -ne 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "INFO : Add new PV to VG default_vg... (vgextend default_vg /dev/vda3)"
|
DEFAULT_VG=$(vgs | awk '/vg/ {print $1}')
|
||||||
|
|
||||||
ssh ${SSH_OPT} ${SSH_HOST} "vgextend default_vg /dev/vda3" &> /dev/null
|
if [ $? -ne 0 ]; then
|
||||||
|
echo 'ERROR : problem during get the name of the default VG'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "INFO : Add new PV to VG ${DEFAULT_VG}... (vgextend ${DEFAULT_VG} /dev/vda3)"
|
||||||
|
|
||||||
|
ssh ${SSH_OPT} ${SSH_HOST} "vgextend ${DEFAULT_VG} /dev/vda3" &> /dev/null
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo 'ERROR : problem during add new PV in VG, please finish manually the deploy OR delete VM and IPAM information'
|
echo 'ERROR : problem during add new PV in VG, please finish manually the deploy OR delete VM and IPAM information'
|
||||||
|
@ -452,8 +459,15 @@ if [ "${VM_DISK_EXTEND}" -ne 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "INFO : Resize LV on disk... (RESIZE VM LV)"
|
echo "INFO : Resize LV on disk... (RESIZE VM LV)"
|
||||||
|
|
||||||
|
DEFAULT_LV_ROOT=$(find /dev/mapper -name '*root*')
|
||||||
|
|
||||||
ssh ${SSH_OPT} ${SSH_HOST} "lvextend -l +100%FREE /dev/mapper/default_vg-root_1" &> /dev/null
|
if [ $? -ne 0 ]; then
|
||||||
|
echo 'ERROR : problem during get the name of the default root LV'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ssh ${SSH_OPT} ${SSH_HOST} "lvextend -l +100%FREE ${DEFAULT_LV_ROOT}" &> /dev/null
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo 'ERROR : problem during resizing LV, please finish manually the deploy OR delete VM and IPAM information'
|
echo 'ERROR : problem during resizing LV, please finish manually the deploy OR delete VM and IPAM information'
|
||||||
|
@ -462,7 +476,7 @@ if [ "${VM_DISK_EXTEND}" -ne 0 ]; then
|
||||||
|
|
||||||
echo "INFO : resize2fs the LV... (RESIZE VM LV FS)"
|
echo "INFO : resize2fs the LV... (RESIZE VM LV FS)"
|
||||||
|
|
||||||
ssh ${SSH_OPT} ${SSH_HOST} "resize2fs /dev/mapper/default_vg-root_1" &> /dev/null
|
ssh ${SSH_OPT} ${SSH_HOST} "resize2fs ${DEFAULT_LV_ROOT}" &> /dev/null
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo 'ERROR : problem during resize2fs, please finish manually the deploy OR delete VM and IPAM information'
|
echo 'ERROR : problem during resize2fs, please finish manually the deploy OR delete VM and IPAM information'
|
||||||
|
|
Loading…
Reference in a new issue