mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Add a new --test-no-warnings option
It disables annoying warnings that expert user don't want to see.
This commit is contained in:
parent
cffa2f0c10
commit
a79052baa6
4 changed files with 26 additions and 14 deletions
|
|
@ -243,7 +243,7 @@ endif
|
|||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) up
|
||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) down
|
||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) devices
|
||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS_VERBOSE) -c $(CONF) smart
|
||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS_VERBOSE) -c $(CONF) smart --test-no-warnings
|
||||
$(FAILENV) ./snapraid$(EXEEXT) $(CHECKFLAGS_VERBOSE) -c $(CONF) smart --test-fake-device --test-expect-failure
|
||||
if HAVE_SYMLINK
|
||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(PAR1) pool
|
||||
|
|
|
|||
|
|
@ -245,6 +245,7 @@ void config(char* conf, size_t conf_size, const char* argv0)
|
|||
#define OPT_TEST_FORCE_AUTOSAVE_AT 283
|
||||
#define OPT_TEST_FAKE_DEVICE 284
|
||||
#define OPT_TEST_EXPECT_NEED_SYNC 285
|
||||
#define OPT_NO_WARNINGS 286
|
||||
|
||||
#if HAVE_GETOPT_LONG
|
||||
struct option long_options[] = {
|
||||
|
|
@ -360,6 +361,9 @@ struct option long_options[] = {
|
|||
/* Fake device data */
|
||||
{ "test-fake-device", 0, 0, OPT_TEST_FAKE_DEVICE },
|
||||
|
||||
/* Disable annoying warnings */
|
||||
{ "test-no-warnings", 0, 0, OPT_NO_WARNINGS },
|
||||
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
#endif
|
||||
|
|
@ -726,6 +730,9 @@ int main(int argc, char* argv[])
|
|||
case OPT_TEST_FAKE_DEVICE :
|
||||
opt.fake_device = 1;
|
||||
break;
|
||||
case OPT_NO_WARNINGS :
|
||||
opt.no_warnings = 1;
|
||||
break;
|
||||
default :
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Unknown option '%c'\n", (char)c);
|
||||
|
|
|
|||
|
|
@ -250,7 +250,8 @@ static void state_config_check(struct snapraid_state* state, const char* path, t
|
|||
/* mark disks to be skipped */
|
||||
disk->skip_access = 1;
|
||||
other->skip_access = 1;
|
||||
log_fatal("DANGER! Ignoring that disks '%s' and '%s' are on the same device\n", disk->name, other->name);
|
||||
if (!state->opt.no_warnings)
|
||||
log_fatal("DANGER! Ignoring that disks '%s' and '%s' are on the same device\n", disk->name, other->name);
|
||||
} else {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Disks '%s' and '%s' are on the same device.\n", disk->dir, other->dir);
|
||||
|
|
@ -330,7 +331,8 @@ static void state_config_check(struct snapraid_state* state, const char* path, t
|
|||
/* mark disks to be skipped */
|
||||
state->parity[l].skip_access = 1;
|
||||
state->parity[j].skip_access = 1;
|
||||
log_fatal("DANGER! Skipping parities '%s' and '%s' on the same device\n", lev_config_name(l), lev_config_name(j));
|
||||
if (!state->opt.no_warnings)
|
||||
log_fatal("DANGER! Skipping parities '%s' and '%s' on the same device\n", lev_config_name(l), lev_config_name(j));
|
||||
} else {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Parity '%s' and '%s' are on the same device.\n", state->parity[l].path, state->parity[j].path);
|
||||
|
|
@ -418,7 +420,7 @@ static void state_config_check(struct snapraid_state* state, const char* path, t
|
|||
#ifdef CONFIG_X86
|
||||
if (!raid_cpu_has_ssse3())
|
||||
#endif
|
||||
if (state->raid_mode == RAID_MODE_CAUCHY) {
|
||||
if (state->raid_mode == RAID_MODE_CAUCHY && !state->opt.no_warnings) {
|
||||
if (state->level == 3) {
|
||||
log_fatal("WARNING! Your CPU doesn't have a fast implementation for triple parity.\n");
|
||||
log_fatal("WARNING! It's recommended to switch to 'z-parity' instead than '3-parity'.\n");
|
||||
|
|
@ -1356,16 +1358,18 @@ static void state_map(struct snapraid_state* state)
|
|||
diskcount = tommy_list_count(&state->maplist);
|
||||
|
||||
/* recommend number of parities */
|
||||
if (diskcount >= 36 && state->level < 6) {
|
||||
log_fatal("WARNING! With %u disks it's recommended to use six parity levels.\n", diskcount);
|
||||
} else if (diskcount >= 29 && state->level < 5) {
|
||||
log_fatal("WARNING! With %u disks it's recommended to use five parity levels.\n", diskcount);
|
||||
} else if (diskcount >= 22 && state->level < 4) {
|
||||
log_fatal("WARNING! With %u disks it's recommended to use four parity levels.\n", diskcount);
|
||||
} else if (diskcount >= 15 && state->level < 3) {
|
||||
log_fatal("WARNING! With %u disks it's recommended to use three parity levels.\n", diskcount);
|
||||
} else if (diskcount >= 5 && state->level < 2) {
|
||||
log_fatal("WARNING! With %u disks it's recommended to use two parity levels.\n", diskcount);
|
||||
if (!state->opt.no_warnings) {
|
||||
if (diskcount >= 36 && state->level < 6) {
|
||||
log_fatal("WARNING! With %u disks it's recommended to use six parity levels.\n", diskcount);
|
||||
} else if (diskcount >= 29 && state->level < 5) {
|
||||
log_fatal("WARNING! With %u disks it's recommended to use five parity levels.\n", diskcount);
|
||||
} else if (diskcount >= 22 && state->level < 4) {
|
||||
log_fatal("WARNING! With %u disks it's recommended to use four parity levels.\n", diskcount);
|
||||
} else if (diskcount >= 15 && state->level < 3) {
|
||||
log_fatal("WARNING! With %u disks it's recommended to use three parity levels.\n", diskcount);
|
||||
} else if (diskcount >= 5 && state->level < 2) {
|
||||
log_fatal("WARNING! With %u disks it's recommended to use two parity levels.\n", diskcount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ struct snapraid_option {
|
|||
int force_progress; /**< Force the use of the progress status. */
|
||||
unsigned force_autosave_at; /**< Force autosave at the specified block. */
|
||||
int fake_device; /**< Fake device data. */
|
||||
int no_warnings; /**< Remove some warning messages. */
|
||||
int expected_missing; /**< If missing files are expected and should not be reported. */
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue