How to check what commands Incus sends to QEMU?

,

Hi,
so if I understand correctly, Incus uses 3 ways to configure QEMU instance.

  1. Flags when initializing QEMU instance
  2. qemu.conf
  3. QMP commands

So how can I see these commands?

  1. The initial qemu command itself I only saw as output during error. For example here I added into raw.qemu cdrom with nonexistent file -cdrom /home/ondrej/test. Thats on purpose so it throws error.


    But how can I see this init command even without throwing error? Does Incus log it somewhere? I couldnt find it in /var/log/incus

  2. I know where to find qemu.conf. In the previous command qemu reads it with flag -readconfig /run/incus/w10/qemu.conf So thats ok.

  3. I couldnt find anything about QMP commands Incus uses. I know I can create my own commands with raw.qemu.qmp but I would like to know what commands Incus uses so I have any idea where to start. For example when adding disk into Incus configuration I cant see it in the qemu init command or qemu.conf. So I presume Incus adds disks with QMP commands. But how can I see those?

Thanks.

If I understand you correctly, you can get the qemu commandline like this

tr '\0' ' ' < /proc/$(pgrep qemu)/cmdline

Or you can just do

ps -ef | grep qemu

There are probably other ways too - you could use htop for example.

There is no mechanism to dump the QMP commands that are being sent as part of VM startup.
I don’t know if there’s a good way to have QEMU log those, either directly to its log file/output or through another QMP endpoint that you could set up through raw.qemu.

For this particular case, what was the incus info --show-log w10 output?

For this particular case incus info --show-log w10 output:

Name: w10
Status: STOPPED
Type: virtual-machine
Architecture: x86_64
Created: 2024/09/03 20:56 CEST
Last Used: 1970/01/01 01:00 CET

Log:

qemu-system-x86_64: -cdrom /home/ondrej/test: Could not open '/home/ondrej/test': No such file or directory

But like I said. I did this on purpose so I could get the /usr/bin/qemu-system-x86_64 command which otherwise isnt logged anywhere.

Thanks for answer. I will try to dig out the QMP commands with some raw.qemu setting.

But tbh, if you plan to configure QEMU using QMP commands, then Incus should also log every QMP command it sends (and the qemu-system-x86_64 init command). It’s impossible to debug otherwise because I need to know what it does.

2 Likes