[CRIU] [PATCH 3/3] test: vzct plugin should c/r VZ7CT kernel.core_pattern sysctl

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Thu Feb 18 02:02:15 PST 2016


*Need Virtuozzo 7 installed

First, make and put vzct.so plugin in criu default plugins dir and
setup vzt-cpt vzt-rst scripts.

Second, set core_pattern in VZ7CT, c/r with criu and check pattern
persits.

Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 test/vzct/run.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 test/vzct/run.sh

diff --git a/test/vzct/run.sh b/test/vzct/run.sh
new file mode 100644
index 0000000..ac38a32
--- /dev/null
+++ b/test/vzct/run.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+VEID=$RANDOM
+TEST_PATTERN="vzct-plugin-test"
+VZ_CPT="/usr/libexec/libvzctl/scripts/vz-cpt"
+VZ_RST="/usr/libexec/libvzctl/scripts/vz-rst"
+
+function check_err {
+	if [ $1 -ne 0 ]; then
+		echo "ERROR[$VEID]: $2"
+		exit 255
+	fi
+}
+
+set -x
+
+# Compile and copy plugin to default criu plugin dir
+make
+check_err $? "Failed to compile vzct plugin"
+cp vzct.so /var/lib/criu
+
+# Fix vzctl scripts to give VZCT_ID to criu
+grep VZCT_ID $VZ_CPT || sed -i 's/criu dump/VZCT_ID=`basename \$VE_ROOT` criu dump/' $VZ_CPT
+grep VZCT_ID $VZ_RST || sed -i 's/criu restore/VZCT_ID=`basename \$VE_ROOT` criu restore/' $VZ_RST
+
+# Create and start VZCT
+vzlist $VEID /dev/null 2>&1 || vzctl create $VEID --ostemplate centos-7-x86_64
+check_err $? "Failed to create CT $VEID"
+vzctl start $VEID --wait
+check_err $? "Failed to start CT $VEID"
+vzctl exec $VEID service httpd stop
+check_err $? "Failed to disable httpd in CT $VEID"
+
+# Set kernel.core_pattern in VZCT
+vzctl exec $VEID echo $TEST_PATTERN > /proc/sys/kernel/core_pattern
+check_err $? "Failed to set kernel.core_pattern in CT $VEID"
+
+# Suspend & Resume
+vzctl suspend $VEID
+check_err $? "Failed to suspend CT $VEID"
+vzctl resume $VEID
+check_err $? "Failed to resume CT $VEID"
+
+# Check core_pattern is the same
+NEW_PATTERN=$(vzctl exec $VEID "cat /proc/sys/kernel/core_pattern")
+if [ "$TEST_PATTERN" = "$NEW_PATTERN" ]; then
+	echo "PASS: core_pattern is same"
+else
+	echo "FAIL: core_pattern is wrong"
+fi
-- 
1.9.3



More information about the CRIU mailing list