Petr Šabata f5bf49
# Executed before VM starts
Petr Šabata f5bf49
on_build() {
Petr Šabata f5bf49
	img_inst_pkg "nfs-utils"
Petr Šabata f5bf49
	img_add_qemu_cmd "-nic socket,connect=127.0.0.1:8010,mac=52:54:00:12:34:57"
Petr Šabata f5bf49
}
Petr Šabata f5bf49
Petr Šabata f5bf49
on_test() {
Petr Šabata f5bf49
	local boot_count=$(get_test_boot_count)
Petr Šabata f5bf49
	local nfs_server=192.168.77.1
Petr Šabata f5bf49
Petr Šabata f5bf49
	if [ "$boot_count" -eq 1 ]; then
Petr Šabata f5bf49
		cat << EOF > /etc/kdump.conf
Petr Šabata f5bf49
nfs $nfs_server:/srv/nfs
DistroBaker 5cac7c
core_collector makedumpfile -l --message-level 7 -d 31
Petr Šabata f5bf49
EOF
Petr Šabata f5bf49
Petr Šabata f5bf49
		while ! ping -c 1 $nfs_server -W 1; do
Petr Šabata f5bf49
			:
Petr Šabata f5bf49
		done
Petr Šabata f5bf49
Petr Šabata f5bf49
		kdumpctl start || test_failed "Failed to start kdump"
Petr Šabata f5bf49
Petr Šabata f5bf49
		sync
Petr Šabata f5bf49
Petr Šabata f5bf49
		echo 1 > /proc/sys/kernel/sysrq
Petr Šabata f5bf49
		echo c > /proc/sysrq-trigger
Petr Šabata f5bf49
	else
Petr Šabata f5bf49
		shutdown -h 0
Petr Šabata f5bf49
	fi
Petr Šabata f5bf49
}