launchers/kvm : chargement maxi-paresseux

This commit is contained in:
Ahurac 2024-01-21 23:41:32 +01:00
parent 1268015dee
commit 849f6de9bd

View file

@ -1,17 +1,17 @@
#!/usr/bin/env python3
# Retrieve the name of the monitor socket
from subprocess import check_output
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
# half of total vCPUs installed if it fails
from os import environ
try:
from os import environ
nproc = environ['QEMUSH_NPROC']
except KeyError:
from multiprocessing import cpu_count