1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-30 10:50:34 +03:00

lvmetad: respect LVM_LVMETAD_PIDFILE settings in lvm

Test LVM_LVMETAD_PIDFILE for pid for lvm command.
Fix WHATS_NEW envvar name usage
Fix init order in prepare_lvmetad to respect set vars
and avoid clash with system settings.
Update test to really test the 'is running' message.
This commit is contained in:
Zdenek Kabelac 2014-01-24 15:59:38 +01:00
parent 89d7732617
commit f18ee04fab
5 changed files with 18 additions and 8 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
Respect LVM_LVMETAD_PIDFILE env var for lvm command.
Avoid exposing temporary devices when initializing thin pool volume.
Fix test when checking target version for available thin features.
Detect thin feature external_origin_extend and limit extend when missing.
@ -41,7 +42,7 @@ Version 2.02.105 - 20th January 2014
Add --splitsnapshot to lvconvert to separate out cow LV.
Reinstate origin reload to complete lvconvert -s with active LVs. (2.02.98)
Select only active volume groups if vgdisplay -A is used.
Add -p and LVM_LVMETAD_PID env var to lvmetad to change pid file.
Add -p and LVM_LVMETAD_PIDFILE env var to lvmetad to change pid file.
Allow lvmetad to reuse stale socket.
Only unlink lvmetad socket on error if created by the same process.
Append missing newline to lvmetad missing socket path error message.

2
lib/cache/lvmetad.c vendored
View File

@ -40,7 +40,7 @@ void lvmetad_disconnect(void)
void lvmetad_init(struct cmd_context *cmd)
{
if (!_lvmetad_use && !access(LVMETAD_PIDFILE, F_OK))
if (!_lvmetad_use && !access(getenv("LVM_LVMETAD_PIDFILE") ? : LVMETAD_PIDFILE, F_OK))
log_warn("WARNING: lvmetad is running but disabled."
" Restart lvmetad before enabling it!");
_lvmetad_cmd = cmd;

View File

@ -301,6 +301,12 @@ is executed.
The Volume Group name that is assumed for
any reference to a Logical Volume that doesn't specify a path.
Not set by default.
.TP
.B LVM_LVMETAD_PIDFILE
Path for the lvmetad pid file.
.TP
.B LVM_LVMETAD_SOCKET
Path for the lvmetad socket file.
.SH VALID NAMES
The following characters are valid for VG and LV names:
.B a-z A-Z 0-9 + _ . -

View File

@ -81,9 +81,9 @@ test -n "$BASH" && set -eE -o pipefail
aux lvmconf
aux prepare_clvmd
test -n "$LVM_TEST_LVMETAD" && {
aux prepare_lvmetad
export LVM_LVMETAD_SOCKET="$TESTDIR/lvmetad.socket"
export LVM_LVMETAD_PIDFILE="$TESTDIR/lvmetad.pid"
aux prepare_lvmetad
}
echo "@TESTDIR=$TESTDIR"
echo "@PREFIX=$PREFIX"

View File

@ -13,14 +13,17 @@
test -e LOCAL_LVMETAD || skip
kill $(cat LOCAL_LVMETAD)
while test -e "$TESTDIR/lvmetad.socket"; do echo -n .; sleep .1; done # wait for the socket close
test ! -e "$LVM_LVMETAD_PIDFILE"
test -e $LVMETAD_PIDFILE && skip
lvmetad
test -e $LVMETAD_PIDFILE
cp $LVMETAD_PIDFILE LOCAL_LVMETAD
while ! test -e "$TESTDIR/lvmetad.socket"; do echo -n .; sleep .1; done # wait for the socket
test -e "$LVM_LVMETAD_PIDFILE"
cp "$LVM_LVMETAD_PIDFILE" LOCAL_LVMETAD
pvs 2>&1 | not grep "lvmetad is running"
aux lvmconf "global/use_lvmetad = 0"
pvs 2>&1 | grep "lvmetad is running"
kill $(cat $LVMETAD_PIDFILE)
not ls $LVMETAD_PIDFILE
kill $(cat "$LVM_LVMETAD_PIDFILE")
not ls "$LVM_LVMETAD_PIDFILE"