1. 27 1月, 2020 1 次提交
    • D
      qemu: introduce a new "virt-qemu-run" program · d6006672
      Daniel P. Berrangé 提交于
      The previous "QEMU shim" proof of concept was taking an approach of only
      caring about initial spawning of the QEMU process. It was then
      registered with the libvirtd daemon who took over management of it. The
      intent was that later libvirtd would be refactored so that the shim
      retained control over the QEMU monitor and libvirt just forwarded APIs
      to each shim as needed. This forwarding of APIs would require quite alot
      of significant refactoring of libvirtd to achieve.
      
      This impl thus takes a quite different approach, explicitly deciding to
      keep the VMs completely separate from those seen & managed by libvirtd.
      Instead it uses the new "qemu:///embed" URI scheme to embed the entire
      QEMU driver in the shim, running with a custom root directory.
      
      Once the driver is initialization, the shim starts a VM and then waits
      to shutdown automatically when QEMU shuts down, or should kill QEMU if
      it is terminated itself. This ought to use the AUTO_DESTROY feature but
      that is not yet available in embedded mode, so we rely on installing a
      few signal handlers to gracefully kill QEMU. This isn't reliable if
      we crash of course, but you can restart with the same root dir.
      
      Note this program does not expose any way to manage the QEMU process,
      since there's no RPC interface enabled. It merely starts the VM and
      cleans up when the guest shuts down at the end. This program is
      installed to /usr/bin/virt-qemu-run enabling direct use by end users.
      Most use cases will probably want to integrate the concept directly
      into their respective application codebases. This standalone binary
      serves as a nice demo though, and also provides a way to measure
      performance of the startup process quite simply.
      Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      d6006672