diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2018-02-15 15:39:08 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2018-02-15 15:39:08 -0500 |
commit | 48959a73dfe38449d12717a44ba8e7e7612971e0 (patch) | |
tree | 7118d80ab8d004ae2bbb7805fe72c8696bfd1a81 |
Initial implementation
-rw-r--r-- | conf.d/qemu.d/beefcake | 25 | ||||
-rw-r--r-- | conf.d/qemu.d/testbox | 10 | ||||
-rwxr-xr-x | systemd/system/qemu | 11 | ||||
-rw-r--r-- | systemd/system/qemu@.service | 15 |
4 files changed, 61 insertions, 0 deletions
diff --git a/conf.d/qemu.d/beefcake b/conf.d/qemu.d/beefcake new file mode 100644 index 0000000..c6eea0f --- /dev/null +++ b/conf.d/qemu.d/beefcake @@ -0,0 +1,25 @@ +#!/hint/bash + +system=x86_64 +args=( + #-nodefaults + -no-user-config + -no-reboot # let the systemd supervisor know we're restarting + + -machine accel=kvm + -m 32768 + -smp 16 + + #-realtime mlock=off + #-no-hpet + + -uuid 4c42bd65-6ad5-456d-8b76-758ecb795e21 + -drive media=disk,file=/dev/vg_build64/lv_beefcake_root,format=raw,if=virtio + -drive media=disk,file=/dev/vg_build64/lv_beefcake_home,format=raw,if=virtio + -drive media=disk,file=/dev/vg_build64/lv_beefcake_data,format=raw,if=virtio + -drive media=disk,file=/dev/vg_build64/lv_beefcake_chroots,format=raw,if=virtio + #-cdrom /mnt/media/Operating_Systems/unix/Linux-based/Arch-based/Parabola/parabola-2017.05.28-dual.iso + -boot menu=on,order=dc + + -writeconfig /tmp/beefcake.cfg +) diff --git a/conf.d/qemu.d/testbox b/conf.d/qemu.d/testbox new file mode 100644 index 0000000..6e76886 --- /dev/null +++ b/conf.d/qemu.d/testbox @@ -0,0 +1,10 @@ +#!/hint/bash + +system=x86_64 +args=( + -machine accel=kvm + -m 5G + -cdrom /mnt/media/Operating_Systems/unix/Linux-based/Arch-based/Parabola/parabola-2017.05.28-dual.iso + -boot menu=on,order=dc + -writeconfig /tmp/testbox.cfg +) diff --git a/systemd/system/qemu b/systemd/system/qemu new file mode 100755 index 0000000..98ca582 --- /dev/null +++ b/systemd/system/qemu @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +source "/etc/conf.d/qemu.d/$1" +args+=( + -name "$1",debug-threads=on + -pidfile "/run/qemu-$1/pid" + -vnc unix:"/run/qemu-$1/vnc.sock" + -monitor unix:"/run/qemu-$1/monitor.sock",server,nowait + -daemonize +) +exec qemu-system-"${system}" "${args[@]}" diff --git a/systemd/system/qemu@.service b/systemd/system/qemu@.service new file mode 100644 index 0000000..7adcbfb --- /dev/null +++ b/systemd/system/qemu@.service @@ -0,0 +1,15 @@ +[Unit] +Description=Virtual Machine %I +Documentation=man:qemu(1) +PartOf=machines.target +Before=machines.target + +[Service] +Type=forking +RuntimeDirectory=qemu-%I +PIDFile=/run/qemu-%I/pid +ExecStart=/etc/systemd/system/qemu %I +ExecStop=/bin/socat SYSTEM:'echo system_powerdown; sleep infinity' UNIX-CONNECT:/run/qemu-%I/monitor.sock + +[Install] +WantedBy=machines.target |