Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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..."

Expand All @@ -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}" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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() {
Expand Down Expand Up @@ -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
Expand Down