Skip to content
  • Daniel P. Berrangé's avatar
    tools: add virt-qemu-qmp-proxy for proxying QMP via libvirt QEMU guests · 83c6d80a
    Daniel P. Berrangé authored
    
    
    Libvirt provides QMP passthrough APIs for the QEMU driver and these are
    exposed in virsh. It is not especially pleasant, however, using the raw
    QMP JSON syntax. QEMU has a tool 'qmp-shell' which can speak QMP and
    exposes a human friendly interactive shell. It is not possible to use
    this with libvirt managed guest, however, since only one client can
    attach to the QMP socket at any point in time. While it would be
    possible to configure a second QMP socket for a VM, it may not be
    an known requirement at the time the guest is provisioned.
    
    The virt-qmp-proxy tool aims to solve this problem. It opens a UNIX
    socket and listens for incoming client connections, speaking QMP on
    the connected socket. It will forward any QMP commands received onto
    the running libvirt QEMU guest, and forward any replies back to the
    QMP client. It will also forward back events.
    
      $ virsh start demo
      $ virt-qmp-proxy demo demo.qmp &
      $ qmp-shell demo.qmp
      Welcome to the QMP low-level shell!
      Connected to QEMU 6.2.0
    
      (QEMU) query-kvm
      {
          "return": {
              "enabled": true,
              "present": true
          }
      }
    
    Note this tool of course has the same risks as the raw libvirt
    QMP passthrough. It is safe to run query commands to fetch information
    but commands which change the QEMU state risk disrupting libvirt's
    management of QEMU, potentially resulting in data loss/corruption in
    the worst case. Any use of this tool will cause the guest to be marked
    as tainted as an warning that it could be in an unexpected state.
    
    Since this tool introduces a python dependency it is not desirable
    to include it in any of the existing RPMs in libvirt. This tool is
    also QEMU specific, so isn't appropriate to bundle with the generic
    tools. Thus a new RPM is introduced 'libvirt-clients-qemu', to
    contain additional QEMU specific tools, with extra external deps.
    
    Signed-off-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
    83c6d80a