Files
sos_testing/functions.sh

68 lines
1.4 KiB
Bash

#!/bin/bash
declare -A all_series_ubuntu
declare -A all_series_rh
all_series_ubuntu=(
# ['bionic']="ubuntu:bionic"
['focal']="ubuntu:focal"
['jammy']="ubuntu:jammy"
['noble']="ubuntu:noble"
['questing']="ubuntu:questing"
['resolute']="ubuntu-daily:devel"
)
all_series_rh=(
['fedora38']="fedora/38/cloud"
['fedora39']="fedora/39/cloud"
['fedora40']="fedora/40/cloud"
['alma8']="almalinux/8/cloud"
['alma9']="almalinux/9/cloud"
#['rocky8']="rockylinux/8/cloud"
#['rocky9']="rockylinux/9/cloud"
#['centos8']="centos/8-Stream/cloud"
#['centos9']="centos/9-Stream/cloud"
)
check_vm_status()
{
inst_name=$1
project=""
if [[ $2 != "" ]] ; then
project="--project $2"
fi
lxc="lxc $project"
echo -n "Checking VM status of ${inst_name} "
while true ; do
num_of_procs=$(${lxc} info ${inst_name} | yq .Resources.Processes)
[[ ${num_of_procs} -gt 0 ]] && break
sleep 3
echo -n "."
done
echo done
}
check_cloud_init_status()
{
inst_name=$1
project=""
if [[ $2 != "" ]] ; then
project="--project $2"
fi
lxc_exec="lxc $project exec"
echo -n "Checking cloud-init status of ${inst_name} "
while true ; do
status=$(${lxc_exec} ${inst_name} -- cloud-init status | grep status | awk '{print $2}')
[[ "${status}" == "done" ]] && break
[[ "${status}" == "error" ]] && break
sleep 3
echo -n "."
done
echo done
}