Libvirt provides a portable, long term stable C API for managing the virtualization technologies provided by many operating systems. It includes support for QEMU, KVM, Xen, LXC, bhyve, Virtuozzo, VMware vCenter and ESX, VMware Desktop, Hyper-V, VirtualBox and the POWER Hypervisor.
Go to file
Daniel P. Berrange 97e4f21782 Support automatic creation of leases for disks in sanlock
The current sanlock plugin requires a central management
application to manually add <lease> elements to each guest,
to protect resources that are assigned to it (eg writable
disks). This makes the sanlock plugin useless for usage
in more ad hoc deployment environments where there is no
central authority to associate disks with leases.

This patch adds a mode where the sanlock plugin will
automatically create leases for each assigned read-write
disk, using a md5 checksum of the fully qualified disk
path. This can work pretty well if guests are using
stable disk paths for block devices eg /dev/disk/by-path/XXXX
symlinks, or if all hosts have NFS volumes mounted in
a consistent pattern.

The plugin will create one lockspace for managing disks
with filename /var/lib/libvirt/sanlock/__LIBVIRT__DISKS__.
For each VM disks, there will be another file to hold
a lease /var/lib/libvirt/sanlock/5903e5d25e087e60a20fe4566fab41fd
Each VM disk lease is usually 1 MB in size. The script
virt-sanlock-cleanup should be run periodically to remove
unused lease files from the lockspace directory.

To make use of this capability the admin will need to do
several tasks:

 - Mount an NFS volume (or other shared filesystem)
   on /var/lib/libvirt/sanlock
 - Configure 'host_id' in /etc/libvirt/qemu-sanlock.conf
   with a unique value for each host with the same NFS
   mount
 - Toggle the 'auto_disk_leases' parameter in qemu-sanlock.conf

Technically the first step can be skipped, in which case
sanlock will only protect against 2 vms on the same host
using the same disk (or the same VM being started twice
due to error by libvirt).

* src/locking/libvirt_sanlock.aug,
  src/locking/sanlock.conf,
  src/locking/test_libvirt_sanlock.aug: Add config params
  for configuring auto lease setup
* libvirt.spec.in: Add virt-sanlock-cleanup program, man
  page
* tools/virt-sanlock-cleanup.in: Script to purge unused
  disk resource lease files
2011-06-28 18:18:06 +01:00
.gnulib@cbfd25f0ed build: update gnulib for intprops 2011-06-24 15:52:52 -06:00
daemon Remove obsolete libvirtd mdns code 2011-06-28 17:33:26 +01:00
docs docs: fix indentation of sub-elements of <ip> in network XML 2011-06-24 18:28:51 -04:00
examples python: events: Fix C->Python handle callback prototype 2011-06-21 10:08:48 -04:00
include Add node prefix to virNodeGet(CPU|Memory)Stats structs and defines 2011-06-28 17:18:33 +02:00
m4 tests: Lower stack usage below 4096 bytes 2011-04-30 19:59:52 +02:00
po Convert libvirtd over to the new RPC handling APIs 2011-06-28 17:33:19 +01:00
python python: Don't declare Py_ssize_t for Python 2.6 2011-06-24 19:34:56 +02:00
src Support automatic creation of leases for disks in sanlock 2011-06-28 18:18:06 +01:00
tests network: add domain to unqualified names defined with <host> 2011-06-28 12:57:14 -04:00
tools Support automatic creation of leases for disks in sanlock 2011-06-28 18:18:06 +01:00
.dir-locals.el maint: make spacing in .sh files easier 2011-03-14 21:57:42 -06:00
.gitignore Convert libvirtd over to the new RPC handling APIs 2011-06-28 17:33:19 +01:00
.gitmodules make .gnulib a submodule 2009-07-08 16:17:51 +02:00
.mailmap spice: add <clipboard copypaste='yes|no'> option 2011-06-14 17:03:26 -06:00
AUTHORS Only include parthelper if built with storage_disk 2011-06-27 08:50:40 -06:00
autobuild.sh Remove the Open Nebula driver 2011-03-28 14:09:11 +01:00
autogen.sh build: avoid problems with autogen.sh runs from tarball 2011-02-12 06:28:28 -07:00
bootstrap build: update to latest gnulib 2011-06-23 10:52:08 -06:00
bootstrap.conf build: update gnulib for intprops 2011-06-24 15:52:52 -06:00
cfg.mk Move the RPC generator scripts into src/rpc 2011-06-24 11:48:49 +01:00
ChangeLog-old generate ChangeLog from git logs into distribution tarball 2009-07-08 16:17:51 +02:00
configure.ac Convert libvirtd over to the new RPC handling APIs 2011-06-28 17:33:19 +01:00
COPYING.LIB remove all trailing blank lines 2009-07-16 15:06:42 +02:00
HACKING maint: rename virBufferVSprintf to virBufferAsprintf 2011-05-05 13:47:40 -06:00
libvirt.pc.in * libvirt.pc.in: applied patch from Daniel Berrange to fix --cflags 2006-03-24 13:18:12 +00:00
libvirt.spec.in Support automatic creation of leases for disks in sanlock 2011-06-28 18:18:06 +01:00
Makefile.am Re-add libvirt.spec to tarball to allwo "make rpm" 2011-05-09 14:23:19 +08:00
Makefile.nonreentrant Ban use of all inet_* functions 2010-10-22 11:59:23 +01:00
mingw32-libvirt.spec.in Remove iohelper on Win32 since it is not required 2011-03-31 17:41:51 +01:00
README Correct typos in the documentation (Atsushi SAKAI) 2008-01-24 10:15:13 +00:00
README-hacking maint: relax git minimum version 2010-02-24 14:29:27 -05:00
TODO Update todo list file to point at bugzilla/website 2010-10-13 16:45:26 +01:00

         LibVirt : simple API for virtualization

  Libvirt is a C toolkit to interact with the virtualization capabilities
of recent versions of Linux (and other OSes). It is free software
available under the GNU Lesser General Public License. Virtualization of
the Linux Operating System means the ability to run multiple instances of
Operating Systems concurrently on a single hardware system where the basic
resources are driven by a Linux instance. The library aim at providing
long term stable C API initially for the Xen paravirtualization but
should be able to integrate other virtualization mechanisms if needed.

Daniel Veillard <veillard@redhat.com>