openshift-telco / telco-gitops-mgmt

Telco GitOps Management Cluster
Apache License 2.0
1 stars 5 forks source link

Force lvs creation is required #1

Closed alosadagrande closed 3 years ago

alosadagrande commented 3 years ago

Forcing the creation of the lvs is required otherwise we are facing this issue:

[root@eko5 ~]# systemctl status create-lvs-for-lso.service
● create-lvs-for-lso.service - Create LVS partitions for LSO
   Loaded: loaded (/etc/systemd/system/create-lvs-for-lso.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2021-08-25 08:46:24 UTC; 3s ago
  Process: 539949 ExecStart=/bin/bash -c /usr/local/bin/create-lvs-for-lso.sh sdb 10 20 (code=exited, status=5)
 Main PID: 539949 (code=exited, status=5)
      CPU: 636ms

Aug 25 08:46:24 eko5.cnf20.cloud.lab.eng.bos.redhat.com bash[539949]:   Aborting. Failed to wipe start of new LV.
Aug 25 08:46:24 eko5.cnf20.cloud.lab.eng.bos.redhat.com bash[539949]: WARNING: xfs signature detected on /dev/autopart/lv_1 at offset 0. Wipe it? [y/n]: [n]
Aug 25 08:46:24 eko5.cnf20.cloud.lab.eng.bos.redhat.com bash[539949]:   Aborted wiping of xfs.
Aug 25 08:46:24 eko5.cnf20.cloud.lab.eng.bos.redhat.com bash[539949]:   1 existing signature left on the device.
Aug 25 08:46:24 eko5.cnf20.cloud.lab.eng.bos.redhat.com bash[539949]:   Failed to wipe signatures on logical volume autopart/lv_1.
Aug 25 08:46:24 eko5.cnf20.cloud.lab.eng.bos.redhat.com bash[539949]:   Aborting. Failed to wipe start of new LV.
Aug 25 08:46:24 eko5.cnf20.cloud.lab.eng.bos.redhat.com systemd[1]: create-lvs-for-lso.service: Main process exited, code=exited, status=5/NOTINSTALLED
Aug 25 08:46:24 eko5.cnf20.cloud.lab.eng.bos.redhat.com systemd[1]: create-lvs-for-lso.service: Failed with result 'exit-code'.
Aug 25 08:46:24 eko5.cnf20.cloud.lab.eng.bos.redhat.com systemd[1]: Failed to start Create LVS partitions for LSO.
Aug 25 08:46:24 eko5.cnf20.cloud.lab.eng.bos.redhat.com systemd[1]: create-lvs-for-lso.service: Consumed 636ms CPU time

This is basically the change (-y):

createLV()
{
  SIZE=${1}
  VG=${2}
  LAST_LV=$(lvs autopart --no-headings --separator , 2>/dev/null | awk -F "," '{print $1}' | awk -F "lv_" '{print $2}' | sort -n | tail -1)
  NEW_LV=$((LAST_LV + 1))
  lvcreate -L ${SIZE}G --name lv_${NEW_LV} ${VG} -y
}

Signed-off-by: Alberto Losada alosadag@redhat.com