From ea7339bec2555523f0c2c1c6fefc8227aaf47f3f Mon Sep 17 00:00:00 2001 From: Steeve Goveas Date: Mon, 19 Jan 2026 11:14:44 +0000 Subject: [PATCH] Add baremetal clean up fixes * Update the bootstrap vm clean-up step to clean up the pool and avoid utilizing space * reset bmc of hosts that dont have pdu info to reset Only cold reset works for iDrac Warm reset works for HP iLo, cold causes bootup issues * Updated wait for 5 mins to make sure bmc has enough time to reset --- .../baremetal-lab-ipi-deprovision-commands.sh | 10 ++++++++- .../wipe/baremetal-lab-post-wipe-commands.sh | 21 +++++++++++-------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ci-operator/step-registry/baremetal/lab/ipi/deprovision/baremetal-lab-ipi-deprovision-commands.sh b/ci-operator/step-registry/baremetal/lab/ipi/deprovision/baremetal-lab-ipi-deprovision-commands.sh index 3dc313e0d40fa..668f14dfed88c 100644 --- a/ci-operator/step-registry/baremetal/lab/ipi/deprovision/baremetal-lab-ipi-deprovision-commands.sh +++ b/ci-operator/step-registry/baremetal/lab/ipi/deprovision/baremetal-lab-ipi-deprovision-commands.sh @@ -13,7 +13,7 @@ SSHOPTS=(-o 'ConnectTimeout=5' [ -z "${PULL_NUMBER:-}" ] && \ timeout -s 9 10m ssh "${SSHOPTS[@]}" "root@${AUX_HOST}" \ - test -f /var/builds/${NAMESPACE}/preserve && \ + test -f /var/builds/"${NAMESPACE}"/preserve && \ { echo "The cluster is expected to persist. Skipping deprovisioning..."; exit 0; } echo "No request to let the cluster persist detected. Deprovisioning..." @@ -28,8 +28,16 @@ CLUSTER_NAME=$(<"${SHARED_DIR}/cluster_name") if virsh list --all --name | grep -q "${CLUSTER_NAME}"; then echo "[INFO] found the bootstrap VM. Destroying it..." NAME=$(virsh list --all --name | grep "${CLUSTER_NAME}") + POOLNAME=$(virsh pool-list --all --name | grep "${CLUSTER_NAME}") virsh destroy "${NAME}" virsh undefine "${NAME}" --remove-all-storage --nvram --managed-save --snapshots-metadata --wipe-storage + if [ -n "${POOLNAME}" ]; then + virsh pool-destroy "${POOLNAME}" + virsh pool-undefine "${POOLNAME}" + # pool-delete fails because of presence of files other than the image file + # Deleting with rm instead after undefining the pool + rm -fr /var/lib/libvirt/openshift-images/"${POOLNAME}" + fi fi timeout -s 9 2m ssh "${SSHOPTS[@]}" -p "$(sed 's/^[%]\?\([0-9]*\)[%]\?$/\1/' < "${CLUSTER_PROFILE_DIR}/provisioning-host-ssh-port-${architecture}")" "root@${AUX_HOST}" \ diff --git a/ci-operator/step-registry/baremetal/lab/post/wipe/baremetal-lab-post-wipe-commands.sh b/ci-operator/step-registry/baremetal/lab/post/wipe/baremetal-lab-post-wipe-commands.sh index 37cd68f10e619..ca57003665bdb 100644 --- a/ci-operator/step-registry/baremetal/lab/post/wipe/baremetal-lab-post-wipe-commands.sh +++ b/ci-operator/step-registry/baremetal/lab/post/wipe/baremetal-lab-post-wipe-commands.sh @@ -69,7 +69,7 @@ check_power_status() { -U "$bmc_user" -P "$bmc_pass" power status > /dev/null 2>&1 } -function check_ilo() { +function check_bmc() { echo "Checking if #${host} BMC is reset successfully..." start_time=$(date +%s) @@ -93,20 +93,23 @@ function check_ilo() { done } -function ilo_reset() { +function bmc_reset() { local bmc_forwarded_port="${1}" local bmc_user="${2}" local bmc_pass="${3}" + local vendor="${4}" local host="${bmc_forwarded_port##1[0-9]}" host="${host##0}" TIMEOUT_SECONDS=180 POLL_INTERVAL=10 + temp="warm" + [ "${vendor}" = "dell" ] && temp="cold" echo "$(date): Reseting BMC of host #$host" - ipmitool -I lanplus -H "${AUX_HOST}" -p "${bmc_forwarded_port}" -U "$bmc_user" -P "$bmc_pass" mc reset warm + ipmitool -I lanplus -H "${AUX_HOST}" -p "${bmc_forwarded_port}" -U "$bmc_user" -P "$bmc_pass" mc reset "$temp" - echo -e "Waiting for #${host} BMC to reset..\n" - sleep 200 - check_ilo + echo -e "Waiting 5 min for #${host} BMC to reset..\n" + sleep 300 + check_bmc } function reset_host() { @@ -172,9 +175,9 @@ for bmhost in $(yq e -o=j -I=0 '.[]' "${SHARED_DIR}/hosts.yaml"); do echo "Error while unmarshalling hosts entries" exit 1 fi - if [ "${ipxe_via_vmedia}" == "true" ]; then - echo -e "Host #${host} needs an ilo reset to workaround bootup and install crash issues" - ilo_reset "${bmc_forwarded_port}" "${bmc_user}" "${bmc_pass}" & + if [ "${ipxe_via_vmedia}" == "true" ] || [ -z "${pdu_uri}" ]; then + echo -e "Host #${host} needs a bmc reset to workaround bootup and install crash issues" + bmc_reset "${bmc_forwarded_port}" "${bmc_user}" "${bmc_pass}" "${vendor}" & fi done wait