Skip to content

Commit

Permalink
Delete libvirt bootstrap images (openshift#56509)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgoveas authored and MiguelCarpio committed Sep 12, 2024
1 parent 24823e9 commit 65f856a
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ set -o nounset
[ -z "${AUX_HOST}" ] && { echo "\$AUX_HOST is not filled. Failing."; exit 1; }
[ -z "${architecture}" ] && { echo "\$architecture is not filled. Failing."; exit 1; }

SSHOPTS=(-o 'ConnectTimeout=5'
-o 'StrictHostKeyChecking=no'
-o 'UserKnownHostsFile=/dev/null'
-o 'ServerAliveInterval=90'
-o LogLevel=ERROR
-i "${CLUSTER_PROFILE_DIR}/ssh-key")

echo "[INFO] Look for a bootstrap VM in the provisioning host and destroy it..."
LIBVIRT_DEFAULT_URI="qemu+ssh://root@${AUX_HOST}:$(sed 's/^[%]\?\([0-9]*\)[%]\?$/\1/' < "${CLUSTER_PROFILE_DIR}/provisioning-host-ssh-port-${architecture}")/system?keyfile=${CLUSTER_PROFILE_DIR}/ssh-key&no_verify=1&no_tty=1"
export LIBVIRT_DEFAULT_URI
Expand All @@ -17,3 +24,8 @@ if virsh list --all --name | grep -q "${CLUSTER_NAME}"; then
virsh destroy "${NAME}"
virsh undefine "${NAME}" --remove-all-storage --nvram --managed-save --snapshots-metadata --wipe-storage
fi

timeout -s 9 2m ssh "${SSHOPTS[@]}" -p "$(sed 's/^[%]\?\([0-9]*\)[%]\?$/\1/' < "${CLUSTER_PROFILE_DIR}/provisioning-host-ssh-port-${architecture}")" "root@${AUX_HOST}" \
bash -s -- "${CLUSTER_NAME}" << EOF
rm -rf /var/lib/libivrt/openshift-images/"${1}"-*-bootstrap*
EOF

0 comments on commit 65f856a

Please sign in to comment.