launchers : remaniement
This commit is contained in:
parent
87498f7bb8
commit
6b0475ad4e
8 changed files with 31 additions and 40 deletions
20
qemu/launchers/kvm
Executable file
20
qemu/launchers/kvm
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
from os import execvp
|
||||||
|
from multiprocessing import cpu_count
|
||||||
|
from psutil import virtual_memory
|
||||||
|
from sys import argv
|
||||||
|
|
||||||
|
nproc = cpu_count() // 2
|
||||||
|
ram_kilo = virtual_memory().available // 2 // 1024
|
||||||
|
|
||||||
|
command = [
|
||||||
|
'qemu-system-x86_64',
|
||||||
|
'-enable-kvm',
|
||||||
|
'-M', 'q35',
|
||||||
|
'-cpu', 'host', '-smp', str(nproc),
|
||||||
|
'-m', '{}K'.format(ram_kilo),
|
||||||
|
'-net', 'nic'
|
||||||
|
] + argv[1:]
|
||||||
|
|
||||||
|
print(command)
|
||||||
|
execvp(command[0], command)
|
|
@ -1,7 +1,6 @@
|
||||||
#!/bin/sh -x
|
#!/bin/sh -x
|
||||||
exec linux \
|
exec kvm \
|
||||||
-vga qxl \
|
-vga qxl \
|
||||||
-device virtio-serial \
|
|
||||||
-chardev spicevmc,id=vdagent,debug=0,name=vdagent \
|
-chardev spicevmc,id=vdagent,debug=0,name=vdagent \
|
||||||
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
|
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
|
||||||
-spice port="$(first-free-port 5900)",addr=127.0.0.1,disable-ticketing=on \
|
-spice port="$(first-free-port 5900)",addr=127.0.0.1,disable-ticketing=on \
|
|
@ -1,8 +0,0 @@
|
||||||
#!/bin/sh -x
|
|
||||||
qemu-system-x86_64 \
|
|
||||||
-enable-kvm \
|
|
||||||
-M q35 \
|
|
||||||
-cpu host -smp "$(("$(nproc)" / 2))" \
|
|
||||||
-m "$(("$(free | awk '($1 == "Mem:") { print $2 }')" / 2))K" \
|
|
||||||
-net nic \
|
|
||||||
"$@"
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/sh -x
|
|
||||||
exec qemu-system-x86_64 \
|
|
||||||
-enable-kvm \
|
|
||||||
-M q35 \
|
|
||||||
-cpu host -smp "$(("$(nproc)" / 2))" \
|
|
||||||
-m "$(("$(free | grep '^Mem:\s' | awk '{ print $NF }')" / 2))K" \
|
|
||||||
-device e1000,netdev=net0 \
|
|
||||||
-device nec-usb-xhci,id=xhci \
|
|
||||||
-device ich9-intel-hda -device hda-duplex \
|
|
||||||
"$@"
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/sh -x
|
|
||||||
exec redox \
|
|
||||||
-vga qxl -spice port="$(first-free-port 5900)",addr=127.0.0.1,disable-ticketing=on \
|
|
||||||
"$@"
|
|
|
@ -1,9 +0,0 @@
|
||||||
#!/bin/sh -x
|
|
||||||
qemu-system-x86_64 \
|
|
||||||
-enable-kvm \
|
|
||||||
-cpu host -smp "$(("$(nproc)" / 2))" \
|
|
||||||
-m "$(("$(free | grep '^Mem: ' | awk '{ print $NF }')" / 2))K" \
|
|
||||||
-net nic \
|
|
||||||
-device virtio-serial \
|
|
||||||
-usbdevice tablet \
|
|
||||||
"$@"
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/sh -x
|
|
||||||
exec windows \
|
|
||||||
-vga qxl \
|
|
||||||
-spice port="$(first-free-port 5900)",addr=127.0.0.1,disable-ticketing=on \
|
|
||||||
-chardev spicevmc,id=vdagent,name=vdagent \
|
|
||||||
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
|
|
||||||
"$@"
|
|
10
qemu/launchers/windows10
Executable file
10
qemu/launchers/windows10
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh -x
|
||||||
|
name="$(basename "$0")"
|
||||||
|
exec kvm-spice \
|
||||||
|
-monitor stdio \
|
||||||
|
-drive file="$(diskpath "$name")",if=virtio \
|
||||||
|
-net user,hostname="${name}" \
|
||||||
|
-device virtio-serial \
|
||||||
|
-usbdevice tablet \
|
||||||
|
-name "$name" \
|
||||||
|
"$@"
|
Loading…
Reference in a new issue