2023-12-13 12:41:28 +01:00
|
|
|
#!/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',
|
2024-01-21 01:52:04 +01:00
|
|
|
'-enable-kvm', '-daemonize',
|
2023-12-13 12:41:28 +01:00
|
|
|
'-M', 'q35',
|
|
|
|
'-cpu', 'host', '-smp', str(nproc),
|
|
|
|
'-m', '{}K'.format(ram_kilo),
|
|
|
|
'-net', 'nic'
|
|
|
|
] + argv[1:]
|
|
|
|
|
|
|
|
print(command)
|
|
|
|
execvp(command[0], command)
|