blob: 19711902eee7e06883ae0dfc2af19a5c961840f8 [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 PVC"
9 kubectl apply -f pvc.yaml
10
11 echo "Creating VM"
12 kubectl apply -f cirros.yaml
13
14 echo "Starting VM"
15 virtctl start cirros-migrate
16
17 echo "Waiting VM is Running."
18 wait_vm_state cirros-migrate Running
19
20 kubectl get pods -o wide
21
22 read -p "Press any key to start live migration" -n 1 -r
23 virtctl migrate cirros-migrate
24
25 for i in {1..5}; do
26 kubectl get pods -o wide
27 kubectl get vmim
28 sleep 5
29 done
30}
31
32function cleanup {
33 kubectl delete -f cirros.yaml
34 kubectl delete -f pvc.yaml
35}
36
37pushd $WORKDIR
38$command
39popd