master - lvmetad: check pid for warning case
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e44c4806db2424c6e375ac06391f0bcd475e6ce7 Commit: e44c4806db2424c6e375ac06391f0bcd475e6ce7 Parent: d00b70c789cca1ca73b3d1311db9981d9ca5056b Author: David Teigland <[email protected]> AuthorDate: Thu Apr 21 09:50:59 2016 -0500 Committer: David Teigland <[email protected]> CommitterDate: Thu Apr 21 09:50:59 2016 -0500
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.)
--- lib/cache/lvmetad.c | 7 +++++++ lib/cache/lvmetad.h | 6 ++++++ lib/commands/toolcontext.c | 2 +- 3 files changed, 14 insertions(+), 1 deletions(-)
lib/cache/lvmetad.c +7 -0
@@ -165,6 +165,13 @@ void lvmetad_make_unused(struct cmd_context *cmd) 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 ) {const char *socket = _lvmetad_socket ?:LVMETAD_SOCKET ;
lib/cache/lvmetad.h +6 -0
@@ -53,6 +53,12 @@ void lvmetad_set_socket(const char *);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 * filter. See lvm.conf. */
lib/commands/toolcontext.c +1 -1
@@ -1720,7 +1720,7 @@ static int _init_lvmetad(struct cmd_context *cmd) }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." );return 1 ; }