Here is a small update for people, that want to have multiple displays on their linux guest vms.
This works well with the virtio-vga driver. While for Windows guests, you need to add a second
adapter to the config raw.qemu key as described in the previous post, linux does not work with
two adapters. Here the solution is, to increase the heads count of your VM adapter by adding
this update to the raw.qemu.conf config key:
raw.qemu.conf: |-
[device "qemu_gpu"]
max_outputs = "3"
This will extend the qemu config section for your lxd “qemu_gpu” device with the key max_outputs and will allow for three monitors int this case. Default is 1.
You could verify this update happen, while your vm is running in your /var/log/lxd//qemu.conf.
Note, the monitors need to be activated in the lxd client virt-viewer frontend panel and this was first possible for me, when the VM had started up the desktop completely.
Finally also managed to replace the virtio-vga adpater to a qlx-vga adapter for my vms with lxd.
It seems faster over slower bandwidth networks. But for my linux vm s the multi head setup seems not to work stable. It is to say, that spice is a bit older and more complex, may be not so save, as the virtio adapter. But it has some nice features.
If you want to test it in your linux / windows vm, add this config update to your vm:
raw.qemu.conf: |-
[device "qemu_gpu"]
driver = "qxl-vga"
id = "video0"
max_outputs = "3"
ram_size = "67108864"
vram_size = "67108864"
vram64_size_mb = "0"
vgamem_mb = "16"
bus = "pcie.0"
addr = "4.0"
Please note : I could not reuse any of the pcie devices, that lxd defined already in my qemu.conf. First I tried to reuse the “qemu_pcie3” bus, that lxd defined earlier for my virtio-vga
[device "qemu_pcie3"]
driver = "pcie-root-port"
bus = "pcie.0"
addr = "1.3"
chassis = "3"
but without an error, the vga console did not startup the bios/uefi to boot the VM.
So I defined a new, yet free pci root port 4.0. You have to check, where the next free slot is, maybe 3.0 works or 5.0, depending on your config amd qemu.raw additional devices, like sound cards, etc.
I found, that the qxl adapter works not that well with multihead setup in the linux guest, at least for me.
In debian I have to install the xserver-xspice and spice-vdagent. The additional displays were first
available, when my kde environment was fully loaded.