From 5016c1da15b3fadefb98f1fe18697b0cfe04187d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 23 May 2018 13:47:01 -0400 Subject: Add Type=notify for initialization errors, log ttyS0 --- conf.d/qemu.d/qemutest | 7 +++++++ systemd/system/qemu | 8 +++++++- systemd/system/qemu@.service | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 conf.d/qemu.d/qemutest diff --git a/conf.d/qemu.d/qemutest b/conf.d/qemu.d/qemutest new file mode 100644 index 0000000..04d9046 --- /dev/null +++ b/conf.d/qemu.d/qemutest @@ -0,0 +1,7 @@ +#!/hint/bash + +system=x86_64 +args=( + -machine accel=kvm -m 5G + -drive media=disk,file=/dev/vg_build64/lv_qemutest_root,format=raw,if=virtio +) diff --git a/systemd/system/qemu b/systemd/system/qemu index 603a437..ca35498 100755 --- a/systemd/system/qemu +++ b/systemd/system/qemu @@ -6,6 +6,12 @@ args+=( -pidfile "/run/qemu-$1/pid" -vnc unix:"/run/qemu-$1/vnc.sock" -monitor unix:"/run/qemu-$1/monitor.sock",server,nowait + -serial unix:"/run/qemu-$1/ttyS0.sock",server -daemonize ) -exec qemu-system-"${system}" "${args[@]}" +{ + until [[ -S /run/qemu-$1/ttyS0.sock ]]; do :; done + exec socat UNIX-CONNECT:"/run/qemu-$1/ttyS0.sock" STDOUT > >(exec cat) +} & +qemu-system-"${system}" "${args[@]}" +systemd-notify --ready diff --git a/systemd/system/qemu@.service b/systemd/system/qemu@.service index 7adcbfb..95cbefc 100644 --- a/systemd/system/qemu@.service +++ b/systemd/system/qemu@.service @@ -5,7 +5,8 @@ PartOf=machines.target Before=machines.target [Service] -Type=forking +Type=notify +NotifyAccess=all RuntimeDirectory=qemu-%I PIDFile=/run/qemu-%I/pid ExecStart=/etc/systemd/system/qemu %I -- cgit v1.2.3-2-g168b