QMP Reference manual and code results (json) do not match for query-migrate
Host environment
- Operating system: SUSE Linux Enterprise Server (SLES) 15 SP7
- OS/kernel version: Linux v 6.4.0-150700.53.16-default #1 SMP PREEMPT_DYNAMIC Wed Sep 10 13:03:54 UTC 2025 (942e5de) x86_64 x86_64 x86_64 GNU/Linux
- Architecture: x86
- QEMU flavor: qemu-system-x86_64
- QEMU version: QEMU emulator version 9.2.4 (SUSE Linux Enterprise 15)
- QEMU command line: (libvirt) - Does not apply
Emulated/Virtualized environment
- Operating system: SLES 15 SP7
- OS/kernel version: same
- Architecture: x86 (KVM used, no TCG)
Description of problem
the QMP "query-migrate" command returns correct data in most cases, but for "completed" migration status it does not return the transfer statistics.
The QMP example in the QMP Reference Manual shows:
{ "execute": "query-migrate" }
{ "return": {
"status": "completed",
"total-time":12345,
"setup-time":12345,
"downtime":12345,
"ram":{
"transferred":123,
"remaining":123,
"total":246,
"duplicate":123,
"normal":123,
"normal-bytes":123456,
"dirty-sync-count":15
}
}
}
https://qemu-project.gitlab.io/qemu/interop/qemu-qmp-ref.html
But this is not what QEMU returns for completed migrations:
The JSON string I get is:
$ virsh qemu-monitor-command --domain a239fbf6-d219-4b1b-b24b-ff3e1738b891 --cmd '{ "execute": "query-migrate" }'
{"return":{"status":"completed"},"id":"libvirt-556"}
Steps to reproduce
- Do a simple live migration with shared storage (virsh migrate ...)
- Issue virsh qemu-monitor-command --cmd '{ "execute": "query-migrate" }' immediately afterwards
- See that the returned data is correct during the transfer.
- wait until migration is completed
- Issue virsh qemu-monitor-command --cmd '{ "execute": "query-migrate" }'
- Witness the lack of any statistics, which contrasts with the documentation.
Suggested fix
Return the statistics also in the completed case, which matches documentation and is useful in practice.
Edited by Claudio Fontana