From 6f7f84a77297970af539b0e9cde00e6ac30eba90 Mon Sep 17 00:00:00 2001
From: Daniel Veillard When running in a Xen environment, programs using libvirt have to execute
+ Currently libvirt supports 2 kind of virtualization, and its internal
+structure is based on a driver model which simplifies adding new engines: When running in a Xen environment, programs using libvirt have to execute
in "Domain 0", which is the primary Linux OS loaded on the machine. That OS
kernel provides most if not all of the actual drivers used by the set of
domains. It also runs the Xen Store, a database of informations shared by the
@@ -11,35 +14,54 @@ drivers, kernels and daemons communicate though a shared system bus
implemented in the hypervisor. The figure below tries to provide a view of
this environment: The library can be initialized in 2 ways depending on the level of
priviledge of the embedding program. If it runs with root access,
-virConnectOpen() can be used, it will use three different ways to connect to
+virConnectOpen() can be used, it will use different ways to connect to
the Xen infrastructure: The library will usually interact with the Xen daemon for any operation
changing the state of the system, but for performance and accuracy reasons
may talk directly to the hypervisor when gathering state informations at
least when possible (i.e. when the running program using libvirt has root
priviledge access). If it runs without root access virConnectOpenReadOnly() should be used to
-connect to initialize the library. It will try to open the read-only socket
- As the previous section explains, libvirt can communicate using different
-channels with the current hypervisor, and should also be able to use
-different kind of hypervisor. To simplify the internal design, code, ease
+connect to initialize the library. It will then fork a libvirt_proxy program
+running as root and providing read_only access to the API, this is then
+only useful for reporting and monitoring. The model for QEmu and KVM is completely similar, basically KVM is
+based on QEmu for the process controlling a new domain, only small details
+differs between the two. In both case the libvirt API is provided
+by a controlling process forked by libvirt in the background and
+which launch and control the QEmu or KVM process. That program called
+libvirt_qemud talks though a specific protocol to the library, and
+connects to the console of the QEmu process in order to control and
+report on its status. Libvirt tries to expose all the emulations
+models of QEmu, the selection is done when creating the new domain,
+by specifying the architecture and machine type targetted. The code controlling the QEmu process is available in the
+ As the previous section explains, libvirt can communicate using different
+channels with the Xen hypervisor, and is also able to use different kind
+of hypervisor. To simplify the internal design, code, ease
maintainance and simplify the support of other virtualization engine the
internals have been structured as one core component, the libvirt.c module
acting as a front-end for the library API and a set of hypvisor drivers
defining a common set of routines. That way the Xen Daemon accces, the Xen
Store one, the Hypervisor hypercall are all isolated in separate C modules
implementing at least a subset of the common operations defined by the
-drivers present in driver.h: Note that a given driver may only implement a subset of those functions,
-for example saving a domain state to disk and restoring it is only possible
-though the Xen Daemon, on the other hand all interfaces allow to query the
-runtime state of a given domain. Graphics and design by Diana Fong Graphics and design by Diana Fong This section describes the XML format used to represent domains, there are
variations on the format based on the kind of domains run and the options
-used to launch them: Normal paravirtualized Xen domains The formats try as much as possible to follow the same structure and reuse
+used to launch them: The formats try as much as possible to follow the same structure and reuse
elements and attributes where it makes sense. The library use an XML format to describe domains, as input to virDomainCreateLinux()
+domains: The library use an XML format to describe domains, as input to virDomainCreateLinux()
and as the output of virDomainGetXMLDesc(),
the following is an example of the format as returned by the shell command
It is likely that the HVM description gets additional optional elements
and attributes as the support for fully virtualized domain expands,
especially for the variety of devices emulated and the graphic support
-options offered. Graphics and design by Diana Fonglibvirt architecture
This is in a large part Xen specific since this is the only hypervisor
-supported at the moment
libvirt architecture
Libvirt Xen support
/var/run/xenstored/socket_ro
to connect to the Xen Store and
-also try to use the RPC to the Xen daemon. In this case use of hypervisor
-calls and write to the Xen Store will not be possible, restraining the amount
-of APIs available and slowing down information gathering about domains.Internal architecture
Libvirt QEmu and KVM support
qemud/
subdirectory.the driver based architecture
proxy/
sub directory.main menu
related links
main menu
related links
XML Format
Normal paravirtualized Xen
-guests:
virsh xmldump fc4
, where fc4 was one of the running domains:<domain type='xen' id='18'>
@@ -175,4 +179,4 @@ systems:
<domain type='xen' id='3'>
main menu
related links
Graphics and design by Diana Fong