21 lines
439 B
Text
21 lines
439 B
Text
|
#!/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)
|