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

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Thu Feb 25 07:55:43 PST 2016


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

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

https://bugs.openvz.org/browse/OVZ-6696
https://jira.sw.ru/browse/PSBM-44145

v2: add bug links, remove useless junk lines
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 test/vzct/run.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 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..8820aad
--- /dev/null
+++ b/test/vzct/run.sh
@@ -0,0 +1,47 @@
+#!/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"
+
+# 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