[libvirt] [PATCH 3/3] Support automatic creation of leases for disks in sanlock

Daniel P. Berrange berrange at redhat.com
Fri Jun 24 11:39:24 UTC 2011


On Thu, Jun 23, 2011 at 01:26:02PM -0400, David Teigland wrote:
> On Fri, Jun 17, 2011 at 01:38:21PM +0100, Daniel P. Berrange wrote:
> > To make use of this capability the admin will need todo
> > 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
> 
> I guess the all hosts are expected to have a consistent libvirt
> configuration also.  Is there any suggested approach for doing that in an
> ad hoc environment?  Could you use the shared file system for that
> somehow?

If you are using the libvirt storage APIs (virsh pool-create,
vol-create, etc), then you need to make sure you use the same
XML on every host. You should also make sure the XML requests
block device paths under /dev/disk/by-path/ which are stable
across hosts & reboots, and not use the unstable /dev/sdXXX
names.

> 
> > +            if ((rv = sanlock_direct_init(&ls, NULL, 0, driver->maxHosts, 0)) < 0) {
> > +            if ((rv = sanlock_direct_init(NULL, res, driver->maxHosts, driver->maxHosts, 0)) < 0) {
> 
> You should use 0 as the third arg for sanlock_direct_init().  sanlock
> names the third arg max_hosts and the fourth arg num_hosts.  sanlock's
> max_hosts is mostly useless and should always be 0 which will cause
> sanlock to use the default of 2000.
> 
> > +# Each additional host requires 1 sector of disk space, usually
> > +# 512 bytes. The default is 64, and can be reduced if you don't
> > +# have many hosts, or increased if you have more.
> > +#
> > +#max_hosts = 64
> 
> This becomes libvirt's maxHosts and sanlock's num_hosts.  The default of
> 64 seems fine.  I'm struggling a bit with what to say in the comment.  It
> doesn't affect the amount of disk space allocated, and there's little
> reason to ever make it smaller.  I think the comment could just say to
> increase it if there are more than 64 hosts.


Originally I could have saved space, but now that sanlock mandates
alignment of 1MB / 8MB, this benefit has gone.  Is there in fact any
compelling reason to allow either num_hosts or max_hosts to be
configurable at all ?  If not, then I'd just remove this and
just hardcode the sanlock standard 2000.

> > +# The unique ID for this host.
> > +#
> > +# IMPORTANT: *EVERY* host which can access the filesystem mounted
> > +# at 'disk_lease_dir' *MUST* be given a different host ID.
> > +#
> > +# This parameter has no default and must be manually set if
> > +# 'auto_disk_leases' is enabled
> > +#host_id = 1
> 
> You could say the valid range of numbers here is 1 to the max_hosts value
> above (64).


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list