Vasyl Saienko | 775c1da | 2023-07-13 11:34:25 +0000 | [diff] [blame] | 1 | EXAMPLES_DIR=$(cd $(dirname "$0")/.. && pwd) |
| 2 | WORKDIR=$(cd $(dirname "$0") && pwd) |
| 3 | source ${EXAMPLES_DIR}/lib.sh |
| 4 | |
| 5 | command=$1 |
| 6 | |
| 7 | function run { |
| 8 | echo "Creating VM" |
| 9 | kubectl apply -f cirros.yaml |
| 10 | |
| 11 | echo "Starting VM" |
| 12 | virtctl start cirros-memdump |
| 13 | |
| 14 | echo "Waiting VM is Running." |
| 15 | wait_vm_state cirros-memdump Running |
| 16 | |
| 17 | echo "Creating memorydump" |
| 18 | virtctl memory-dump get cirros-memdump --claim-name=cirros-memdump --create-claim |
| 19 | |
| 20 | sleep 5 |
| 21 | |
| 22 | echo "Creating ubuntu pod" |
| 23 | kubectl apply -f ubuntu.yaml |
| 24 | |
| 25 | } |
| 26 | |
| 27 | function cleanup { |
| 28 | kubectl delete pod ubuntu-memdump --force --grace-period=0 |
| 29 | kubectl delete -f cirros.yaml |
| 30 | kubectl delete -f ubuntu.yaml |
| 31 | kubectl delete pvc cirros-memdump |
| 32 | } |
| 33 | |
| 34 | pushd $WORKDIR |
| 35 | $command |
| 36 | popd |