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

David Teigland teigland at redhat.com
Thu Jun 23 17:26:02 UTC 2011


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 ((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.

> +# 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).

Dave




More information about the libvir-list mailing list