qemush : options -monitoret -daemonize hardcodée au lieu d'être dans le script kvm

This commit is contained in:
Ahurac 2024-01-23 10:30:54 +01:00
parent 7bd8c07fd4
commit 8587327c9e
2 changed files with 4 additions and 10 deletions

View file

@ -65,6 +65,9 @@ error_usage() {
public_start() { public_start() {
QEMUSH_NAME="$1" QEMUSH_NAME="$1"
set -- "$@" \
-monitor "unix:$(sockpath),server,nowait" \
-daemonize
if ! "$@"; then if ! "$@"; then
perror "error launching virtual machine \"${QEMUSH_NAME}\"" perror "error launching virtual machine \"${QEMUSH_NAME}\""
return 2 return 2

View file

@ -1,13 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Retrieve the name of the monitor socket
from subprocess import CalledProcessError
try:
from subprocess import check_output
socket = 'unix:%s,server,nowait' % (check_output(["sockpath"], text=True))
except CalledProcessError as e:
exit(e.returncode)
# Set number of vCPUs to use to the environment variable QEMUSH_NPROC or # Set number of vCPUs to use to the environment variable QEMUSH_NPROC or
# half of total vCPUs installed if it fails # half of total vCPUs installed if it fails
try: try:
@ -30,8 +22,7 @@ except KeyError:
from sys import argv from sys import argv
command = [ command = [
'qemu-system-x86_64', 'qemu-system-x86_64',
'-enable-kvm', '-daemonize', '-enable-kvm',
'-monitor', socket,
'-M', 'q35', '-M', 'q35',
'-cpu', 'host', '-smp', nproc, '-cpu', 'host', '-smp', nproc,
'-m', ram, '-m', ram,