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: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2.7 KiB
virt-qemu-run
Run a standalone QEMU guest
- Manual section
-
1
- Manual group
-
Virtualization Support
SYNOPSIS
virt-qemu-run [OPTIONS...] [IGUEST-XML] DESCRIPTION =========== This tool provides a way to run a standalone QEMU guest such that it is completely independant of libvirtd. It makes use of the embedded QEMU driver support to run the VM placing files under an isolated directory tree. When the guest is run with this tool it is invisible to libvirtd and thus also invisible to other libvirt tools such as virsh. The virt-qemu-run program will run the QEMU virtual machine, and then block until the guest OS shuts down, at which point it will exit. If the virt-qemu-run program is interrupted (eg Ctrl-C) it will immediately terminate the virtual machine without giving the guest OS any opportunity to gracefully shutdown. OPTIONS =======
GUEST-XMLThe full path to the XML file describing the guest virtual machine to be booted.
-h,
--helpDisplay the command line help
-v,
--verboseDisplay verbose information about startup
-r
DIR,
--root=DIRSpecify the root directory to use for storing state associated with the virtual machine. The caller is responsible for deleting this directory when it is no longer required. If this parameter is omitted, then a random temporary directory will be created, and its contents be automaticlaly deleted at VM shutdown.
-s
XML-FILE,VALUE-FILE,
--secret=XML-FILE,VALUE-FILESpecify a secret to be loaded into the secret driver. The
XML-FILEis a path to the XML description of the secret, whose UUID should match a secret referenced in the guest domain XML. The
VALUE-FILEis a path containing the raw value of the secret. EXIT STATUS =========== Upon successful shutdown, an exit status of 0 will be set. Upon failure a non-zero status will be set. AUTHOR ====== Daniel P. Berrangé BUGS ==== Please report all bugs you discover. This should be done via either: #. the mailing list `https://libvirt.org/contact.html <https://libvirt.org/contact.html>`_ #. the bug tracker `https://libvirt.org/bugs.html <https://libvirt.org/bugs.html>`_ Alternatively, you may report bugs to your software distributor / vendor. COPYRIGHT ========= Copyright (C) 2019 by Red Hat, Inc. LICENSE =======
virt-run-qemu``
is distributed under the terms of the GNU LGPL v2+. This is free
software; see the source for copying conditions. There is NO warranty;
not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
SEE ALSO
virsh(1), https://libvirt.org/