[SOLVED] Using qmemu-ga to send QMP commands to the host

sesquipedality

New Member
May 19, 2020
12
3
3
46
I have been trying to control my VM from within it by using qemu-ga to send monitor commands to the host. I run a new qemu-ga instance as follows

qemu-ga -d -m unix-listen -p /var/run/qemu-ga.socket

I then attach to the socket using

socat - unix:/var/run/qemu-ga-socket

This then accepts JSON commands, but valid QMP commands don't seem to work

{ "execute": "qmp_capabilities" }
{"error": {"class": "CommandNotFound", "desc": "The command qmp_capabilities has not been found"}}
{ "execute": "query-commands" }
{"error": {"class": "CommandNotFound", "desc": "The command query-commands has not been found"}}

I am aware of the need to send a "qmp_capabilities" command to 'activate' the other commands, but this does not work. Stopping the existing qemu-agent using systemctl also has no effect on the outcome. I have also used rlwrap rather than socat directly, but this makes no difference.

What am I doing wrong? Thanks.
 
I think I just answered my own question - whatever JSON qemu-ga is expecting, it does not appear to be QMP commands. To use these, it is necessary to connect from the host. The appropriate socket is created by proxmox, and is found at /var/run/qemu-server/<id>.qmp.