Welcome to mirror list, hosted at ThFree Co, Russian Federation.

run.sh « ext-links « others « test - github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 82fa3932282f8da9c63da78e91d136663fd76e65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash

ip=${CR_IP_TOOL:-ip}
mvln="mv0"
finf="finish"
outf="ns_output"
pidf="ns_pid"
criu="../../../criu/criu"

export ip
export mvln
export finf
export outf
export pidf

function fail {
	$ip link del $mvln
	touch $finf
	echo $@
	exit 1
}

# Build the mvlink plugin
make

set -x

rm -f "$finf" "$outf" "$pidf"
rm -rf "dump"

# Unshare netns. The run_ns will exit once ns is spawned.
unshare --net ./run_ns.sh
nspid=$(cat $pidf)
ps $nspid

# Create and push macvlan device into it. CRIU doesn't support
# macvlans treating them as external devices.
./addmv_raw.sh $mvln $nspid || fail "Can't setup namespace"

# Dump
sleep 1
mkdir dump
$criu dump -t $nspid -D dump/ -o dump.log -v4 --lib $(pwd) || fail "Can't dump namespace"

# Restore
# Ask for the pid (shouldn't change, so just as an example), ask to call
# script that will put macvlan device back into namespace
sleep 1
rm -f $pidf
$criu restore -D dump/ -o restore.log -v4 --pidfile $(pwd)/$pidf --action-script "$(pwd)/addmv.sh $mvln $(pwd)/$pidf" -d || fail "Can't restore namespaces"

# Finish and check results
touch $finf
set +x
while ! egrep 'PASS|FAIL' $outf; do
	echo "Waiting"
	sleep 1
done