3 # A script to cleanup resource leases auto-created by
4 # the libvirt lock plugin for sanlock
7 if test "x$1" = "x-q" ; then
11 LOCKSPACE
="__LIBVIRT__DISKS__"
13 LOCKDIR
=`augtool print '/files@SYSCONFDIR@/libvirt/qemu-sanlock.conf/disk_lease_dir'`
14 if test $?
!= 0 ||
"x$LOCKDIR" = "x" ; then
15 LOCKDIR
="@LOCALSTATEDIR@/lib/libvirt/sanlock"
19 test $verbose = 1 ||
return
20 if test "x$1" = "x-n"; then
28 cd "$LOCKDIR" ||
exit 1
32 if test $MD5 != '*' && $MD5 != $LOCKSPACE ; then
33 RESOURCE
="$LOCKSPACE:$MD5:$LOCKDIR/$MD5:0"
34 notify
-n "Cleanup: $RESOURCE "
35 sanlock client
command -r $RESOURCE -c /bin
/rm -f "$LOCKDIR/$MD5" 2>/dev
/null
51 virt-sanlock-cleanup
- remove stale sanlock resource lease files
59 This tool removes any resource lease files created by the sanlock
60 lock manager plugin. The resource lease files only need to exist
61 on disks when a guest using the resource is active. This
script
62 reclaims the disk space used by resources
which are not currently
67 Upon successful processing of leases cleanup
, the
exit status
68 will be
0 will be
set. Upon fatal error a non-zero status will
77 Report any bugs discovered to the libvirt community via the
78 mailing list C
<http
://libvirt.org
/contact.html
> or bug tracker C
<http
://libvirt.org
/bugs.html
>.
79 Alternatively report bugs to your software distributor
/ vendor.
83 Copyright
(C
) 2011 Red Hat
, Inc.
87 virt-sanlock-cleanup is distributed under the terms of the GNU GPL v2
+.
88 This is free software
; see the
source for copying conditions. There
89 is NO warranty
; not even
for MERCHANTABILITY or FITNESS FOR A PARTICULAR
94 C
<virsh
(1)>, online instructions C
<http
://libvirt.org
/locksanlock.html
>