mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvmetad: Avoid "connect failed" spamming when lvmetad is not available.
This commit is contained in:
parent
150165591f
commit
02e1bf406b
20
lib/cache/lvmetad.c
vendored
20
lib/cache/lvmetad.c
vendored
@ -26,7 +26,7 @@
|
||||
#define SCAN_TIMEOUT_SECONDS 80
|
||||
#define MAX_RESCANS 10 /* Maximum number of times to scan all PVs and retry if the daemon returns a token mismatch error */
|
||||
|
||||
static daemon_handle _lvmetad;
|
||||
static daemon_handle _lvmetad = { .error = 0 };
|
||||
static int _lvmetad_use = 0;
|
||||
static int _lvmetad_connected = 0;
|
||||
|
||||
@ -68,12 +68,12 @@ void lvmetad_connect_or_warn(void)
|
||||
if (!_lvmetad_use)
|
||||
return;
|
||||
|
||||
if (!_lvmetad_connected)
|
||||
if (!_lvmetad_connected && !_lvmetad.error) {
|
||||
_lvmetad_connect();
|
||||
|
||||
if ((_lvmetad.socket_fd < 0 || _lvmetad.error))
|
||||
log_warn("WARNING: Failed to connect to lvmetad: %s. Falling back to internal scanning.",
|
||||
strerror(_lvmetad.error));
|
||||
if ((_lvmetad.socket_fd < 0 || _lvmetad.error))
|
||||
log_warn("WARNING: Failed to connect to lvmetad. Falling back to internal scanning.");
|
||||
}
|
||||
}
|
||||
|
||||
int lvmetad_used(void)
|
||||
@ -94,15 +94,7 @@ int lvmetad_socket_present(void)
|
||||
|
||||
int lvmetad_active(void)
|
||||
{
|
||||
if (!_lvmetad_use)
|
||||
return 0;
|
||||
|
||||
if (!_lvmetad_connected)
|
||||
_lvmetad_connect();
|
||||
|
||||
if ((_lvmetad.socket_fd < 0 || _lvmetad.error))
|
||||
log_debug_lvmetad("Failed to connect to lvmetad: %s.", strerror(_lvmetad.error));
|
||||
|
||||
lvmetad_connect_or_warn();
|
||||
return _lvmetad_connected;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user