mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Optionally abort on internal errors (and leverage this option in the
testsuite). (This is showing a problem in the pvmove test for me, so I expect the tests to start failing -- this needs to be fixed separately though.)
This commit is contained in:
parent
42812732a3
commit
99a304bc17
@ -316,6 +316,10 @@ global {
|
|||||||
|
|
||||||
# The external locking library to load if locking_type is set to 2.
|
# The external locking library to load if locking_type is set to 2.
|
||||||
# locking_library = "liblvm2clusterlock.so"
|
# locking_library = "liblvm2clusterlock.so"
|
||||||
|
|
||||||
|
# Treat any internal errors as fatal errors, aborting the process that
|
||||||
|
# encountered the internal error. Please only enable for debugging.
|
||||||
|
abort_on_internal_errors = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
activation {
|
activation {
|
||||||
|
@ -147,7 +147,9 @@ static void _init_logging(struct cmd_context *cmd)
|
|||||||
|
|
||||||
/* Log message formatting */
|
/* Log message formatting */
|
||||||
init_indent(find_config_tree_int(cmd, "log/indent",
|
init_indent(find_config_tree_int(cmd, "log/indent",
|
||||||
DEFAULT_INDENT));
|
DEFAULT_INDENT));
|
||||||
|
init_abort_on_internal_errors(find_config_tree_int(cmd, "global/abort_on_internal_errors",
|
||||||
|
DEFAULT_ABORT_ON_INTERNAL_ERRORS));
|
||||||
|
|
||||||
cmd->default_settings.msg_prefix = find_config_tree_str(cmd,
|
cmd->default_settings.msg_prefix = find_config_tree_str(cmd,
|
||||||
"log/prefix",
|
"log/prefix",
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
#define DEFAULT_VERBOSE 0
|
#define DEFAULT_VERBOSE 0
|
||||||
#define DEFAULT_LOGLEVEL 0
|
#define DEFAULT_LOGLEVEL 0
|
||||||
#define DEFAULT_INDENT 1
|
#define DEFAULT_INDENT 1
|
||||||
|
#define DEFAULT_ABORT_ON_INTERNAL_ERRORS 0
|
||||||
#define DEFAULT_UNITS "h"
|
#define DEFAULT_UNITS "h"
|
||||||
#define DEFAULT_SUFFIX 1
|
#define DEFAULT_SUFFIX 1
|
||||||
#define DEFAULT_HOSTTAGS 0
|
#define DEFAULT_HOSTTAGS 0
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "lvm-string.h"
|
#include "lvm-string.h"
|
||||||
#include "lvm-file.h"
|
#include "lvm-file.h"
|
||||||
#include "defaults.h"
|
#include "defaults.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
@ -35,6 +36,7 @@ static int _indent = 1;
|
|||||||
static int _log_suppress = 0;
|
static int _log_suppress = 0;
|
||||||
static char _msg_prefix[30] = " ";
|
static char _msg_prefix[30] = " ";
|
||||||
static int _already_logging = 0;
|
static int _already_logging = 0;
|
||||||
|
static int _abort_on_internal_errors = 0;
|
||||||
|
|
||||||
static lvm2_log_fn_t _lvm2_log_fn = NULL;
|
static lvm2_log_fn_t _lvm2_log_fn = NULL;
|
||||||
|
|
||||||
@ -140,6 +142,11 @@ void init_indent(int indent)
|
|||||||
_indent = indent;
|
_indent = indent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void init_abort_on_internal_errors(int fatal)
|
||||||
|
{
|
||||||
|
_abort_on_internal_errors = fatal;
|
||||||
|
}
|
||||||
|
|
||||||
void reset_lvm_errno(int store_errmsg)
|
void reset_lvm_errno(int store_errmsg)
|
||||||
{
|
{
|
||||||
_lvm_errno = 0;
|
_lvm_errno = 0;
|
||||||
@ -172,9 +179,14 @@ void print_log(int level, const char *file, int line, int dm_errno,
|
|||||||
const char *trformat; /* Translated format string */
|
const char *trformat; /* Translated format string */
|
||||||
char *newbuf;
|
char *newbuf;
|
||||||
int use_stderr = level & _LOG_STDERR;
|
int use_stderr = level & _LOG_STDERR;
|
||||||
|
int internal_error = 0;
|
||||||
|
|
||||||
level &= ~_LOG_STDERR;
|
level &= ~_LOG_STDERR;
|
||||||
|
|
||||||
|
if (!strncmp(format, "Internal error:",
|
||||||
|
strlen("Internal error:")))
|
||||||
|
internal_error = 1;
|
||||||
|
|
||||||
if (_log_suppress == 2)
|
if (_log_suppress == 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -291,6 +303,9 @@ void print_log(int level, const char *file, int line, int dm_errno,
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (internal_error && _abort_on_internal_errors)
|
||||||
|
abort();
|
||||||
|
|
||||||
if (level > debug_level())
|
if (level > debug_level())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ void init_msg_prefix(const char *prefix);
|
|||||||
void init_log_file(const char *log_file, int append);
|
void init_log_file(const char *log_file, int append);
|
||||||
void init_log_direct(const char *log_file, int append);
|
void init_log_direct(const char *log_file, int append);
|
||||||
void init_log_while_suspended(int log_while_suspended);
|
void init_log_while_suspended(int log_while_suspended);
|
||||||
|
void init_abort_on_internal_errors(int fatal);
|
||||||
|
|
||||||
void fin_log(void);
|
void fin_log(void);
|
||||||
void release_log_memory(void);
|
void release_log_memory(void);
|
||||||
|
@ -199,8 +199,9 @@ prepare_lvmconf() {
|
|||||||
archive = 0
|
archive = 0
|
||||||
}
|
}
|
||||||
global {
|
global {
|
||||||
|
abort_on_internal_errors = 1
|
||||||
library_dir = "$G_root_/lib"
|
library_dir = "$G_root_/lib"
|
||||||
locking_dir = "$G_root_/var/lock/lvm"
|
locking_dir = "$G_root_/var/lock/lvm"
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user