[libvirt-users] How is calculate the lock with lockd_manager

Daniel P. Berrange berrange at redhat.com
Thu Mar 31 10:19:30 UTC 2016


On Thu, Mar 31, 2016 at 12:05:07PM +0200, villeneu at kassis.univ-brest.fr wrote:
> Hello
> 
> I use lock_manager with libvirt 1.3 and
> I would like to know how is exactly calculate the hash SHA256. I would
> create a table
> to retreive the name with the hash in case of crash to release manualy the
> lock.

Do you mean in the case of a host crash, and if so what filesystem ?  If
you are using NFS at lesat so you shouldn't need to know the file names,
there is the ability to tell the NFS server to release all locks associated
with a dead host.

> I do an  sha256 hash from /var/lib/libvirt/images/lock/MyVM.img but I
> don't get the same hash code form virtlockd ?

It uses the sha256 has of the filename. How did you generate your hash ?
If using shell make sure you don't include a newline

ie you want

   echo -n /var/lib/libvirt/images/lock/MyVM.img | sha256sum

not a plain 'echo' as that includes a newline

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 libvirt-users mailing list