QMP
QEMU 11.1.1's machine protocol for aarch64, and how to reach it from JavaScript or over a socket.
QMP is QEMU's JSON protocol for controlling a machine. WARM speaks it exactly as QEMU 11.1.1 does for aarch64, with the same commands, arguments and replies, the same events, and the same errors.
The commands and events
QEMU's QMP reference describes every command and event. A machine's own query-commands and query-qmp-schema list exactly what QEMU 11.1.1 has.
From JavaScript
vm.qmp() runs a command and resolves with its return value, and an error rejects with a QmpError. vm.qmpJson() takes and returns JSON text, and vm.on() delivers events. There's no capability negotiation to do.
await vm.qmp("stop");
const { status } = await vm.qmp("query-status"); // "paused"
vm.on("RESUME", () => console.log("running again"));
await vm.qmp("cont");Over a socket
Start warm-system-aarch64 with a QMP server and connect any QMP client, such as QEMU's qmp-shell or socat:
warm-system-aarch64 -M virt -cpu cortex-a76 -m 1G -kernel vmlinuz-virt -initrd initramfs-virt -nographic \
-qmp unix:/tmp/warm.sock,server,wait=offsocat - UNIX-CONNECT:/tmp/warm.sock{"QMP": {"version": {"qemu": {"micro": 1, "minor": 1, "major": 11}, "package": ""}, "capabilities": ["oob"]}}
{"execute": "qmp_capabilities"}
{"return": {}}
{"execute": "query-status", "id": 1}
{"return": {"status": "running", "running": true}, "id": 1}As with QEMU, the client must answer the greeting with qmp_capabilities before anything else. Until it does, every command gets Expecting capabilities negotiation with 'qmp_capabilities'. The endpoints are QEMU's: -qmp unix:, -qmp tcp:, -qmp stdio, and -mon on a -chardev. A web page has no sockets, so use vm.qmp() there.