1 |
On Wednesday, 17 June 2020 20:55:19 BST J. Roeleveld wrote: |
2 |
> On 17 June 2020 21:32:19 CEST, Michael <confabulate@××××××××.com> wrote: |
3 |
|
4 |
> This brings another problem I have with KVM/QEMU: all howtos and documents I |
5 |
> find show long commandline options to just start the VM. I have not found |
6 |
> one where I can provide all the config in a single file and use that. |
7 |
> Allowing me to duplicate settings by simply copying the file and changing a |
8 |
> few lines. |
9 |
> |
10 |
> KVM/Qemu seems to be written to be used together with virt-manager which, |
11 |
> for me, lacks important features to make it usable in production. |
12 |
> |
13 |
> -- |
14 |
> Joost |
15 |
|
16 |
The long line can be extremely short, if you are happy with defaults, or |
17 |
silly-long if you have specific needs. The same long line can also go into a |
18 |
script and invoked with bash. For example, this will boot a pfSense VM on an |
19 |
EFI BIOS platform, 4G RAM and Opteron_G5-v1 CPU: |
20 |
|
21 |
qemu-system-x86_64 -bios /usr/share/edk2-ovmf/OVMF_CODE.fd -m 4096 -cpu |
22 |
Opteron_G5-v1,+topoext -smp cpus=4,maxcpus=8,cores=4,threads=2,sockets=1 - |
23 |
enable-kvm -accel kvm,thread=multi -display sdl,gl=on -vga virtio -soundhw hda |
24 |
-drive if=virtio,file=pfSense.qcow2,cache=none -usb -device qemu-xhci,id=xhci |
25 |
-net nic,model=virtio -net user,hostfwd=tcp::53260-:443 |
26 |
|
27 |
or, you could set it all up in a script file, one or more lines at a time: |
28 |
|
29 |
#!/bin/bash |
30 |
# |
31 |
qemu-system-x86_64 \ |
32 |
-bios /usr/share/edk2-ovmf/OVMF_CODE.fd \ |
33 |
-m 4096 \ |
34 |
-cpu Opteron_G5-v1,+topoext \ |
35 |
[snip ...] |
36 |
|
37 |
Then call the script from a terminal whenever you want to run it. I prefer |
38 |
using a script file when I experiment with new machines and options, because |
39 |
it allows me to comment out options as I change them to alternatives and |
40 |
backtrack as necessary. |
41 |
|
42 |
If you prefer to use RHL's libvirt to execute in 'C' API calls onto QEMU/KVM, |
43 |
then virt-manager will offer a VirtualBox GUI equivalent, or virsh a CLI |
44 |
option. Virt-manager can be the front end for other hypervisors/VMs, e.g. |
45 |
Xen, ESX, etc. so it is not QEMU/KVM specific. |
46 |
|
47 |
QEMU also offers QMP for JSON scripting, because ... apps, and a rather basic |
48 |
console interface called Human Monitor Interface (HMP), should you wish to |
49 |
interact with it while it's running to modify inputs/interfaces, plug/unplug |
50 |
devices, etc. |
51 |
|
52 |
I'm not starting and stopping VMs all day long, so installing and running a |
53 |
libvirt GUI, or some of the various front ends for QEMU has not been necessary |
54 |
for me. However, they may offer more sophisticated options than my basic CLI |
55 |
input above. |