Skip to content

Instantly share code, notes, and snippets.

@orimanabu
Last active February 5, 2024 16:04
Show Gist options
  • Save orimanabu/815fc2453966f50f5d5281ea58b0058e to your computer and use it in GitHub Desktop.
Save orimanabu/815fc2453966f50f5d5281ea58b0058e to your computer and use it in GitHub Desktop.
how to run qmp command on a VM invoked via libvirt
# virsh qemu-monitor-command DOMAIN '{"execute": "query-commands"}' --pretty
# virsh qemu-monitor-command DOMAIN --hmp 'help'
# virsh qemu-monitor-command instance-00000002 '{"execute": "query-status"}'
{"return":{"status":"running","singlestep":false,"running":true},"id":"libvirt-5137"}
# virsh qemu-monitor-command instance-00000002 '{"execute": "query-status"}' --pretty
{
"return": {
"status": "running",
"singlestep": false,
"running": true
},
"id": "libvirt-5138"
}
# virsh qemu-monitor-command instance-00000002 --hmp 'info kvm'
kvm support: enabled
# virsh qemu-monitor-command instance-00000002 --hmp 'info network'
net0: index=0,type=nic,model=virtio-net-pci,macaddr=fa:16:3e:d5:d7:a6
\ hostnet0: index=0,type=tap,fd=29
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment