Skip to content

Instantly share code, notes, and snippets.

@rgl
Last active September 30, 2025 20:42
Show Gist options
  • Save rgl/dc38c6875a53469fdebb2e9c0a220c6c to your computer and use it in GitHub Desktop.
Save rgl/dc38c6875a53469fdebb2e9c0a220c6c to your computer and use it in GitHub Desktop.

Revisions

  1. rgl revised this gist May 17, 2020. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,8 @@ Start QEMU with QMP UNIX socket and connect:
    ```bash
    qemu-system-x86_64 -qmp unix:test.socket,server,nowait ...
    nc -U test.socket
    qmp-shell test.socket # see https://github.com/0xef53/qmp-shell
    qmp-shell test.socket # use the raw qmp interface. see https://github.com/0xef53/qmp-shell
    qmp-shell -H test.socket # use the human interface. see https://github.com/0xef53/qmp-shell
    ```

    Or start QEMU with QMP TCP socket and connect:
  2. rgl revised this gist May 17, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -3,15 +3,15 @@
    Start QEMU with QMP UNIX socket and connect:

    ```bash
    ./qemu-system-x86_64.exe -qmp unix:test.socket,server,nowait ...
    qemu-system-x86_64 -qmp unix:test.socket,server,nowait ...
    nc -U test.socket
    qmp-shell test.socket # see https://github.com/0xef53/qmp-shell
    ```

    Or start QEMU with QMP TCP socket and connect:

    ```bash
    ./qemu-system-x86_64.exe -qmp tcp:127.0.0.1:12345,server,nowait ...
    qemu-system-x86_64 -qmp tcp:127.0.0.1:12345,server,nowait ...
    nc localhost 12345
    ```

  3. rgl revised this gist May 4, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -29,6 +29,8 @@ Then you can either execute human or machine friendly commands.

    ```json
    { "execute": "human-monitor-command", "arguments": { "command-line": "help" } }
    { "execute": "human-monitor-command", "arguments": { "command-line": "info version" } }
    { "execute": "human-monitor-command", "arguments": { "command-line": "info network" } }
    { "execute": "human-monitor-command", "arguments": { "command-line": "info qtree" } }
    ```

  4. rgl revised this gist May 4, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -29,6 +29,7 @@ Then you can either execute human or machine friendly commands.

    ```json
    { "execute": "human-monitor-command", "arguments": { "command-line": "help" } }
    { "execute": "human-monitor-command", "arguments": { "command-line": "info qtree" } }
    ```

    ## Machine friendly commands examples
  5. rgl revised this gist May 3, 2020. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -38,6 +38,10 @@ Then you can either execute human or machine friendly commands.

    { "execute": "query-machines" }

    { "execute": "query-version" }
    { "execute": "query-name" }
    { "execute": "query-status" }
    { "execute": "query-kvm" }
    { "execute": "query-pci" }

    { "execute": "device-list-properties", "arguments": { "typename": "vmxnet3" } }
  6. rgl revised this gist May 3, 2020. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -62,6 +62,9 @@ Then you can either execute human or machine friendly commands.
    { "execute": "qom-get", "arguments": { "path": "/machine/peripheral-anon/device[0]", "property": "type" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/peripheral-anon/device[0]", "property": "mac" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/peripheral-anon/device[0]", "property": "netdev" } }

    { "execute": "qom-get", "arguments": { "path": "/machine/peripheral/nic0", "property": "type" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/peripheral/nic0", "property": "mac" } }
    ```

    # References
  7. rgl revised this gist May 3, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -42,6 +42,8 @@ Then you can either execute human or machine friendly commands.

    { "execute": "device-list-properties", "arguments": { "typename": "vmxnet3" } }

    { "execute": "qom-list-types" }

    { "execute": "qom-list", "arguments": { "path": "/" } }
    { "execute": "qom-list", "arguments": { "path": "/machine" } }
    { "execute": "qom-get", "arguments": { "path": "/machine", "property": "type" } }
  8. rgl revised this gist May 3, 2020. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@ Start QEMU with QMP UNIX socket and connect:
    ```bash
    ./qemu-system-x86_64.exe -qmp unix:test.socket,server,nowait ...
    nc -U test.socket
    qmp-shell test.socket # see https://github.com/0xef53/qmp-shell
    ```

    Or start QEMU with QMP TCP socket and connect:
    @@ -24,8 +25,6 @@ After you open the socket, the first command is always:

    Then you can either execute human or machine friendly commands.

    **NB** For a more easy way to execute commands you should use [0xef53/qmp-shell](https://github.com/0xef53/qmp-shell).

    ## Human friendly commands examples

    ```json
  9. rgl revised this gist May 3, 2020. 1 changed file with 5 additions and 9 deletions.
    14 changes: 5 additions & 9 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -34,16 +34,14 @@ Then you can either execute human or machine friendly commands.

    ## Machine friendly commands examples

    ```bash
    #query-pci
    #query-dump
    #query-machines
    ```

    ```json
    { "execute": "query-qmp-schema" }

    { "execute": "device-list-properties", "arguments": { "typename": "vmxnet3" }}
    { "execute": "query-machines" }

    { "execute": "query-pci" }

    { "execute": "device-list-properties", "arguments": { "typename": "vmxnet3" } }

    { "execute": "qom-list", "arguments": { "path": "/" } }
    { "execute": "qom-list", "arguments": { "path": "/machine" } }
    @@ -63,8 +61,6 @@ Then you can either execute human or machine friendly commands.
    { "execute": "qom-get", "arguments": { "path": "/machine/peripheral-anon/device[0]", "property": "type" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/peripheral-anon/device[0]", "property": "mac" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/peripheral-anon/device[0]", "property": "netdev" } }

    { "execute": "query-rx-filter", "arguments": { "name": "hub0port0" } }
    ```

    # References
  10. rgl revised this gist May 3, 2020. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -42,6 +42,9 @@ Then you can either execute human or machine friendly commands.

    ```json
    { "execute": "query-qmp-schema" }

    { "execute": "device-list-properties", "arguments": { "typename": "vmxnet3" }}

    { "execute": "qom-list", "arguments": { "path": "/" } }
    { "execute": "qom-list", "arguments": { "path": "/machine" } }
    { "execute": "qom-get", "arguments": { "path": "/machine", "property": "type" } }
  11. rgl revised this gist May 3, 2020. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,17 @@ After you open the socket, the first command is always:
    { "execute": "qmp_capabilities" }
    ```

    Then you can execute any of the following examples.
    Then you can either execute human or machine friendly commands.

    **NB** For a more easy way to execute commands you should use [0xef53/qmp-shell](https://github.com/0xef53/qmp-shell).

    ## Human friendly commands examples

    ```json
    { "execute": "human-monitor-command", "arguments": { "command-line": "help" } }
    ```

    ## Machine friendly commands examples

    ```bash
    #query-pci
    @@ -59,3 +69,4 @@ Then you can execute any of the following examples.
    * https://github.com/qemu/qemu/blob/v4.2.0/qapi/net.json
    * https://github.com/qemu/qemu/blob/v4.2.0/scripts/qmp/qom-tree
    * https://github.com/qemu/qemu/tree/v4.2.0/python/qemu
    * https://github.com/0xef53/qmp-shell
  12. rgl revised this gist May 3, 2020. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,17 @@
    # QEMU Machine Protocol (QMP) socket

    Start QEMU with QMP TCP socket and connect:
    Start QEMU with QMP UNIX socket and connect:

    ```bash
    ./qemu-system-x86_64.exe -qmp tcp:127.0.0.1:12345,server,nowait ...
    nc localhost 12345
    ./qemu-system-x86_64.exe -qmp unix:test.socket,server,nowait ...
    nc -U test.socket
    ```

    Or start QEMU with QMP UNIX socket and connect:
    Or start QEMU with QMP TCP socket and connect:

    ```bash
    ./qemu-system-x86_64.exe -qmp unix:test.socket,server,nowait ...
    nc -U test.socket
    ./qemu-system-x86_64.exe -qmp tcp:127.0.0.1:12345,server,nowait ...
    nc localhost 12345
    ```

    # Examples
  13. rgl revised this gist May 3, 2020. 1 changed file with 26 additions and 5 deletions.
    31 changes: 26 additions & 5 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,36 @@
    ```bash
    #query-pci
    #query-dump
    #query-machines
    # QEMU Machine Protocol (QMP) socket

    ./qemu-system-x86_64.exe -qmp tcp:127.0.0.1:12345,server,nowait
    Start QEMU with QMP TCP socket and connect:

    ```bash
    ./qemu-system-x86_64.exe -qmp tcp:127.0.0.1:12345,server,nowait ...
    nc localhost 12345
    ```

    Or start QEMU with QMP UNIX socket and connect:

    ```bash
    ./qemu-system-x86_64.exe -qmp unix:test.socket,server,nowait ...
    nc -U test.socket
    ```

    # Examples

    After you open the socket, the first command is always:

    ```json
    { "execute": "qmp_capabilities" }
    ```

    Then you can execute any of the following examples.

    ```bash
    #query-pci
    #query-dump
    #query-machines
    ```

    ```json
    { "execute": "query-qmp-schema" }
    { "execute": "qom-list", "arguments": { "path": "/" } }
    { "execute": "qom-list", "arguments": { "path": "/machine" } }
  14. rgl revised this gist May 3, 2020. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -23,6 +23,13 @@ nc localhost 12345
    { "execute": "qom-get", "arguments": { "path": "/machine/i440fx/pci.0/child[3]", "property": "mac" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/i440fx/pci.0/child[3]", "property": "netdev" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/i440fx/pci.0/child[3]", "property": "legacy-addr" } }

    { "execute": "qom-list", "arguments": { "path": "/machine/peripheral-anon" } }
    { "execute": "qom-list", "arguments": { "path": "/machine/peripheral-anon/device[0]" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/peripheral-anon/device[0]", "property": "type" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/peripheral-anon/device[0]", "property": "mac" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/peripheral-anon/device[0]", "property": "netdev" } }

    { "execute": "query-rx-filter", "arguments": { "name": "hub0port0" } }
    ```

  15. rgl revised this gist May 3, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -28,6 +28,6 @@ nc localhost 12345

    # References

    * https://github.com/qemu/qemu/blob/f57587c7d47b35b2d9b31def3a74d81bdb5475d7/qapi/net.json
    * https://github.com/qemu/qemu/blob/f57587c7d47b35b2d9b31def3a74d81bdb5475d7/scripts/qmp/qom-tree
    * https://github.com/qemu/qemu/tree/f57587c7d47b35b2d9b31def3a74d81bdb5475d7/python/qemu
    * https://github.com/qemu/qemu/blob/v4.2.0/qapi/net.json
    * https://github.com/qemu/qemu/blob/v4.2.0/scripts/qmp/qom-tree
    * https://github.com/qemu/qemu/tree/v4.2.0/python/qemu
  16. rgl revised this gist May 3, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -30,3 +30,4 @@ nc localhost 12345

    * https://github.com/qemu/qemu/blob/f57587c7d47b35b2d9b31def3a74d81bdb5475d7/qapi/net.json
    * https://github.com/qemu/qemu/blob/f57587c7d47b35b2d9b31def3a74d81bdb5475d7/scripts/qmp/qom-tree
    * https://github.com/qemu/qemu/tree/f57587c7d47b35b2d9b31def3a74d81bdb5475d7/python/qemu
  17. rgl revised this gist May 2, 2020. 1 changed file with 11 additions and 7 deletions.
    18 changes: 11 additions & 7 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,14 @@
    query-pci
    query-dump
    query-machines


    ```bash
    #query-pci
    #query-dump
    #query-machines

    ./qemu-system-x86_64.exe -qmp tcp:127.0.0.1:12345,server,nowait

    nc localhost 12345
    ```

    ```json
    { "execute": "qmp_capabilities" }
    { "execute": "query-qmp-schema" }
    { "execute": "qom-list", "arguments": { "path": "/" } }
    @@ -23,6 +24,9 @@ nc localhost 12345
    { "execute": "qom-get", "arguments": { "path": "/machine/i440fx/pci.0/child[3]", "property": "netdev" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/i440fx/pci.0/child[3]", "property": "legacy-addr" } }
    { "execute": "query-rx-filter", "arguments": { "name": "hub0port0" } }
    ```

    # References

    https://github.com/qemu/qemu/blob/f57587c7d47b35b2d9b31def3a74d81bdb5475d7/qapi/net.json
    https://github.com/qemu/qemu/blob/f57587c7d47b35b2d9b31def3a74d81bdb5475d7/scripts/qmp/qom-tree
    * https://github.com/qemu/qemu/blob/f57587c7d47b35b2d9b31def3a74d81bdb5475d7/qapi/net.json
    * https://github.com/qemu/qemu/blob/f57587c7d47b35b2d9b31def3a74d81bdb5475d7/scripts/qmp/qom-tree
  18. rgl created this gist May 2, 2020.
    28 changes: 28 additions & 0 deletions qemu-qmp.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    query-pci
    query-dump
    query-machines



    ./qemu-system-x86_64.exe -qmp tcp:127.0.0.1:12345,server,nowait

    nc localhost 12345

    { "execute": "qmp_capabilities" }
    { "execute": "query-qmp-schema" }
    { "execute": "qom-list", "arguments": { "path": "/" } }
    { "execute": "qom-list", "arguments": { "path": "/machine" } }
    { "execute": "qom-get", "arguments": { "path": "/machine", "property": "type" } }
    { "execute": "qom-list", "arguments": { "path": "/machine/i440fx" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/i440fx", "property": "type" } }
    { "execute": "qom-list", "arguments": { "path": "/machine/i440fx/pci.0" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/i440fx/pci.0", "property": "type" } }
    { "execute": "qom-list", "arguments": { "path": "/machine/i440fx/pci.0/child[3]" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/i440fx/pci.0/child[3]", "property": "type" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/i440fx/pci.0/child[3]", "property": "mac" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/i440fx/pci.0/child[3]", "property": "netdev" } }
    { "execute": "qom-get", "arguments": { "path": "/machine/i440fx/pci.0/child[3]", "property": "legacy-addr" } }
    { "execute": "query-rx-filter", "arguments": { "name": "hub0port0" } }

    https://github.com/qemu/qemu/blob/f57587c7d47b35b2d9b31def3a74d81bdb5475d7/qapi/net.json
    https://github.com/qemu/qemu/blob/f57587c7d47b35b2d9b31def3a74d81bdb5475d7/scripts/qmp/qom-tree