diff --git a/pkg/hostagent/tasks/expand_root_partition.yaml b/pkg/hostagent/tasks/expand_root_partition.yaml index 2bd38d74..5b500f8f 100644 --- a/pkg/hostagent/tasks/expand_root_partition.yaml +++ b/pkg/hostagent/tasks/expand_root_partition.yaml @@ -6,9 +6,9 @@ tasks: - name: Get root path shell: | - ostype=$(cat /etc/os-release | grep "^ID=" | cut -d "=" -f 2) + . /etc/os-release rootpath="/dev/mapper/rl-root" - if [[ $ostype == '"openEuler"' ]]; then + if [[ $ID == 'openEuler' ]]; then rootpath="/dev/mapper/openeuler-root" fi echo $rootpath @@ -28,7 +28,7 @@ shell: pvresize /dev/vda2 - name: Extend root shell: | - result=$(lvextend -l+100%FREE -n {{ rootpath.stdout }} 2>&1) + result=$(lvextend -r -l+100%FREE -n {{ rootpath.stdout }} 2>&1) if [[ $? == 0 ]]; then echo "$result" elif [[ $result == *'matches existing size'* ]]; then @@ -37,5 +37,3 @@ echo "$result" exit 1 fi - - name: Resize root - shell: resize2fs {{ rootpath.stdout }} diff --git a/templates/cluster-template.yaml b/templates/cluster-template.yaml index 9de464e8..ed5c502e 100644 --- a/templates/cluster-template.yaml +++ b/templates/cluster-template.yaml @@ -104,9 +104,9 @@ spec: #! to the system disk through Tower API. These commands will add the new #! capacity of the system disk to the root partition. #! - | - #! ostype=$(cat /etc/os-release | grep "^ID=" | cut -d "=" -f 2) + #! . /etc/os-release #! rootpath="/dev/mapper/rl-root" - #! if [[ $ostype == '"openEuler"' ]]; then + #! if [[ $ID == 'openEuler' ]]; then #! rootpath="/dev/mapper/openeuler-root" #! fi #! - | @@ -130,7 +130,6 @@ spec: #! echo "$result" #! exit 1 #! fi - #! - "resize2fs $rootpath" useExperimentalRetryJoin: true files: - content: | @@ -286,9 +285,9 @@ spec: #! to the system disk through Tower API. These commands will add the new #! capacity of the system disk to the root partition. #! - | - #! ostype=$(cat /etc/os-release | grep "^ID=" | cut -d "=" -f 2) + #! . /etc/os-release #! rootpath="/dev/mapper/rl-root" - #! if [[ $ostype == '"openEuler"' ]]; then + #! if [[ $ID == 'openEuler' ]]; then #! rootpath="/dev/mapper/openeuler-root" #! fi #! - | @@ -312,7 +311,6 @@ spec: #! echo "$result" #! exit 1 #! fi - #! - "resize2fs $rootpath" --- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 kind: ElfMachineTemplate