libvirt , qemu and kvm

libvirt talks to various hypervisors underlying it. It is an open source API and a domain management tool for managing different hypervisors.

Command-line clint of libvirt is virsh.

Goal of libvirt library is to provide a common and stable layer to manage Virtual Machines running on a hypervisor.
In order to manage VMs, libvirt provides APIs for VM provision, creation, modification, monitoring, control and migration.

The libvirt process is daemonized, and is known as libvirtd.

What happens when libvirt client, such as virsh, requests service from libvirtd?
Based on connection URI passed by the client, libvirtd opens a connection to the hypervisor. This is how the clients virsh or virt-manager asks libvirtd to start talking to the hypervisor. Like any other daemon, it also provides services to its client.

Most people think that libvirt is restricted to a single node or local node
where it is running; it’s not true. libvirt has remote support built into the
library. So, any libvirt tool (for example virt-manager) can remotely connect to a libvirt daemon over the network, just by passing an extra connect argument.

Connection sample URI:

1. qemu://xxxx/system
2. qemu://xxxx/session

[1] requests to connect locally as “root” to the daemon supervising qemu / kvm virtual machines.
[2] requests to connect locally as a normal user to its own set of qemu/kvm domains.

qemu also supports remote connections. To achieve remote connections, a small change need to be done in the connection URI.
The connection format is :
[driver+transport]://[username@hostname]:[port]/[path][?extra parameters]

Example command of a virsh process for a remote connection is :

$ virsh --connect qemu+ssh://root@remtelocation.server/system list --all

Leave a Reply

Your email address will not be published.

Recent Posts


GiottoPress by Enrique Chavez