- start_qemu_vm: - on_checkpoint: redo - check_cmd_out: qemu-system-$$qemu_arch - exec_out: echo "sync" ; sync - exec_out: echo "+++ Starting kvm..." - exec_out: | if [ $$qemu_enable_kvm = true ]; then ENABLE_KVM="-enable-kvm" fi - exec_out: | if [ -f "vm_state_to_load.txt" ] then SAVED_STATE="$(cat vm_state_to_load.txt)" LOADVM="-loadvm $SAVED_STATE" rm -f vm_state_to_load.txt fi - exec_out: | nohup qemu-system-$$qemu_arch \ $ENABLE_KVM -no-reboot \ -drive file="$$image_disk",cache=unsafe,media=disk,if=virtio,id=drive0 \ -smp $${qemu_cpu} \ -m $$qemu_memory_size \ -rtc base=localtime \ -net nic,model=virtio -net user \ -redir tcp:$${qemu_ssh_port}::22 \ -monitor tcp::$$qemu_monitor_port,server,nowait \ -vnc :1 $LOADVM \ 1>qemu.log 2>&1 & disown - exec_out: | echo -n "Waiting for SSH to become available" until ssh-keyscan -4 -p $$qemu_ssh_port localhost 2>&1 | grep -e ssh-rsa -e ssh-dsa &> /dev/null do echo -n "." sleep 1 done echo " ~> OK" - shutdown_qemu_vm: - on_checkpoint: redo - on_setup_clean: - exec_in: echo "Removing insecure ssh key..." - exec_in: | grep -f /root/.ssh/kameleon_insecure_public_key -v /root/.ssh/authorized_keys \ | cat > /root/.ssh/authorized_keys rm -f /root/.ssh/kameleon_insecure_public_key - exec_out: echo -n "Shutting down qemu virtual machine" - exec_in: | sleep 2 && shutdown -h now & - exec_out: | while nc -w 1 -z localhost $$qemu_monitor_port do sleep 1 echo -n "." done echo " ~> OK" - force_shutdown_qemu_vm: - on_checkpoint: redo - on_export_clean: - exec_out: | if nc -w 1 -z localhost $$qemu_monitor_port 2>/dev/null then echo "Shutting down qemu virtual machine..." echo "system_reset" | nc localhost $$qemu_monitor_port 1>/dev/null 2>&1 fi - enable_checkpoint: - on_checkpoint: redo - on_setup_init: - exec_out: touch $$kameleon_cwd/checkpoint_enabled - disable_checkpoint: - on_checkpoint: redo - on_setup_clean: - exec_out: rm -f $$kameleon_cwd/checkpoint_enabled