mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvmetad: check pid for warning case
When command is not using lvmetad because use_lvmetad=0 in the config, but the lvmetad pidfile exists, print a warning (previously this checked for the socket existing instead of the pidfile existing.)
This commit is contained in:
parent
d00b70c789
commit
e44c4806db
7
lib/cache/lvmetad.c
vendored
7
lib/cache/lvmetad.c
vendored
@ -165,6 +165,13 @@ void lvmetad_make_unused(struct cmd_context *cmd)
|
|||||||
stack;
|
stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lvmetad_pidfile_present(void)
|
||||||
|
{
|
||||||
|
const char *pidfile = getenv("LVM_LVMETAD_PIDFILE") ?: LVMETAD_PIDFILE;
|
||||||
|
|
||||||
|
return !access(pidfile, F_OK);
|
||||||
|
}
|
||||||
|
|
||||||
int lvmetad_socket_present(void)
|
int lvmetad_socket_present(void)
|
||||||
{
|
{
|
||||||
const char *socket = _lvmetad_socket ?: LVMETAD_SOCKET;
|
const char *socket = _lvmetad_socket ?: LVMETAD_SOCKET;
|
||||||
|
6
lib/cache/lvmetad.h
vendored
6
lib/cache/lvmetad.h
vendored
@ -52,6 +52,12 @@ void lvmetad_set_socket(const char *);
|
|||||||
*/
|
*/
|
||||||
int lvmetad_socket_present(void);
|
int lvmetad_socket_present(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if lvmetad pidfile is present, indicating that the lvmetad
|
||||||
|
* process is running or not.
|
||||||
|
*/
|
||||||
|
int lvmetad_pidfile_present(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the "lvmetad validity token" (currently only consists of the lvmetad
|
* Set the "lvmetad validity token" (currently only consists of the lvmetad
|
||||||
* filter. See lvm.conf.
|
* filter. See lvm.conf.
|
||||||
|
@ -1720,7 +1720,7 @@ static int _init_lvmetad(struct cmd_context *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!find_config_tree_bool(cmd, global_use_lvmetad_CFG, NULL)) {
|
if (!find_config_tree_bool(cmd, global_use_lvmetad_CFG, NULL)) {
|
||||||
if (lvmetad_socket_present())
|
if (lvmetad_pidfile_present())
|
||||||
log_warn("WARNING: Not using lvmetad because config setting use_lvmetad=0.");
|
log_warn("WARNING: Not using lvmetad because config setting use_lvmetad=0.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user