[libvirt] Using leases with virtlockd

Daniel P. Berrange berrange at redhat.com
Wed Apr 24 08:29:04 UTC 2013


On Tue, Apr 23, 2013 at 10:05:18PM -0600, Jim Fehlig wrote:
> Nearly a question for the users list, but I might be encountering a bug too.
> 
> I'm using virtlockd with 'auto_disk_leases = 0' and struggle with the
> correct configuration for a lease in the domXML.  Using
> 
>     <lease>
>       <lockspace>test-ls</lockspace>
>       <key>test-lock</key>
>       <target path='/var/lib/libvirt/lockd'/>
>     </lease>
> 
> results in the following error when starting the domain
> 
> internal error Lockspace for path /var/lib/libvirt/lockd/test-ls
> 
> It appears the path attribute + lockspace are used as the Lockspace for
> this lease.  But I'm not sure what "Lockspace" means in this context. 
> Is it a directory?  A file?  I assume the latter since it is just
> flock()ed when the domain is started, right?

There are three attributes involved. Path gives the base location
in which lockspaces are to be stored. Lockspace, gives the name of
a directory below this location, where leases are to be stored.
Finally 'key' gives the name of the file against which the lease
will be held with fcntl().

Basically lockspace is just a namespacing tool. We could have just
added it to the "path" field, but since we already have this XML
concept defined for 'sanlock', it made sense to do this for lockd
too, to make it more consistent for applications to use.

Lets say you wanted to maintain leases associated with IP addresses,
and with passthrough USB devices. You could setup a separate lockspace
for each:

     <lease>
       <lockspace>ipaddrs</lockspace>
       <key>192.168.1.2</key>
       <target path='/var/lib/libvirt/lockd'/>
     </lease>

     <lease>
       <lockspace>hostusb</lockspace>
       <key>003:005</key>
       <target path='/var/lib/libvirt/lockd'/>
     </lease>

Regards,
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