blob: 0f84c21e9c322157928c0aa56b14c0dab8d6d391 [file] [log] [blame]
Vasyl Saienko775c1da2023-07-13 11:34:25 +00001EXAMPLES_DIR=$(cd $(dirname "$0")/.. && pwd)
2WORKDIR=$(cd $(dirname "$0") && pwd)
3source ${EXAMPLES_DIR}/lib.sh
4
5command=$1
6
7function 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
27function 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
34pushd $WORKDIR
35$command
36popd